Skip to content

Commit

Permalink
Implementacija hijerarhije
Browse files Browse the repository at this point in the history
  • Loading branch information
Juric22 committed Jun 13, 2024
1 parent 216cfef commit 35fc8e7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Software/SZUUP/SZUUP/FrmPrijava.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using SZUUP.Repozitoris;

namespace SZUUP
{
Expand All @@ -29,7 +30,7 @@ private void button1_Click(object sender, EventArgs e)
// Provjera korisničkih podataka
var zaposlenik = RepozitorijZaposlenik.GetZaposlenik(username);

if (zaposlenik != null && student.Password == password)
if (zaposlenik != null && zaposlenik.Password == password)
{
// Uspješna prijava
MessageBox.Show("Login successful!");
Expand Down Expand Up @@ -68,7 +69,6 @@ private void btnLogin_Click(object sender, EventArgs e)
MessageBoxButtons.OK, MessageBoxIcon.Information);

// Open the FrmUnos form

frmPopisJela frmPopisJela = new frmPopisJela();
frmPopisJela.Show();
this.Hide(); // Hide the current login form
Expand Down
10 changes: 8 additions & 2 deletions Software/SZUUP/SZUUP/Models/Zaposlenik.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,16 @@

namespace SZUUP.Models
{
internal class Zaposlenik
public abstract class Zaposlenik
{
public int Id_zaposlenika { get; set; }
public string Kor_ime { get; set; }
public string KorisnickoIme { get; set; }
public string Lozinka { get; set; }
public int GodineIskustva { get; set; }
public string RadnoMjesto { get; set; }
public override string ToString()
{
return KorisnickoIme + " - " + RadnoMjesto;
}
}
}
7 changes: 7 additions & 0 deletions Software/SZUUP/SZUUP/Repozitoris/RepozitorijZaposlenik.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SZUUP.Models;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel;

namespace SZUUP.Repozitoris
Expand All @@ -13,6 +14,12 @@ public class RepozitorijZaposlenik
{
string sql = $"SELECT * FROM zaposlenik WHERE Kor_ime = '{Kor_ime}'";
return FetchZaposlenik(sql);

public static Zaposlenik GetZaposlenik(string username)
{
// Pretpostavljena implementacija metode
// Vratite odgovarajućeg zaposlenika temeljem korisničkog imena
}
}
public static Zaposlenik GetZaposlenik(int id)
{
Expand Down

0 comments on commit 35fc8e7

Please sign in to comment.