public Koszyk(Sklep sklep, Logowanie logowanie, Kasjer kasjer, List <Klient> klienci_kolejka, List <Produkt> produkty_skasowane, StaticLine note = null) : base(sklep, note) { if (logowanie != null) { this.logowanie = logowanie; } if (kasjer != null) { this.kasjer = kasjer; } if (klienci_kolejka != null) { this.klienci_kolejka = klienci_kolejka; } if (produkty_skasowane != null) { this.produkty_skasowane = produkty_skasowane; } Contents.Add(new StaticLine("WYBIERZ PRODUKT Z LISTY")); if (sklep.asortyment.Count == 0) { Contents.Add(new StaticLine("Brak produktów w magazynie")); } else { foreach (var p in sklep.asortyment) { Contents.Add(new ActiveLine($" {p.nazwa} ({p.cena}zł)")); } } Contents.Add(new ActiveLine("Powrót")); Contents.Add(this.Note); }
public void run() { Application.Run(new CELogowanie()); if (Kasjer.czy_kasjer_zalogowany()) { Application.Run(new CEokno_Glowne()); } }
public Kasa(Sklep sklep, Logowanie logowanie, Kasjer kasjer = null, List <Klient> klienci_kolejka = null, List <Produkt> produkty_skasowane = null, StaticLine note = null) : base(sklep, note) { if (logowanie != null) { this.logowanie = logowanie; } if (kasjer != null) { this.kasjer = kasjer; } if (klienci_kolejka != null) { this.klienci_kolejka = klienci_kolejka; } if (produkty_skasowane != null) { this.produkty_skasowane = produkty_skasowane; } Contents.Add(new StaticLine("ZMIANA PRACOWNIKA " + this.logowanie.nazwa)); Contents.Add(new StaticLine("Rozpoczęcie: " + this.kasjer.data_rozpoczecia)); Contents.Add(new ActiveLine("Dodaj klienta do kolejki")); Contents.Add(new ActiveLine("Skasuj produkt")); Contents.Add(new ActiveLine("Finalizuj transakcję")); Contents.Add(new ActiveLine("Zakończ zmianę")); Contents.Add(new StaticLine("==SKASOWANE PRODUKTY==")); if (this.produkty_skasowane.Count == 0) { Contents.Add(new StaticLine("Lista jest pusta")); } else { decimal suma = 0; foreach (var p in this.produkty_skasowane) { Contents.Add(new StaticLine($" {p.nazwa} ({p.cena}zł)")); suma += p.cena; } Contents.Add(new StaticLine($"-DO zapłaty: {suma}zł")); } Contents.Add(new StaticLine("==KOLEJKA KLIENTÓW==")); if (this.klienci_kolejka.Count == 0) { Contents.Add(new StaticLine("Lista jest pusta")); } else { int licznikKlientow = 1; foreach (var k in this.klienci_kolejka) { Contents.Add(new StaticLine($" Pozycja: {licznikKlientow}, wejście: {k.data_wejscia}")); licznikKlientow++; } } Contents.Add(this.Note); }
private void BLogowanie_Click(object sender, EventArgs e) { if (Kasjer.sprawdz_dane(TID_Kasjera.Text, THaslo.Text)) { this.Close(); } else { LInformacje_logowania.Text = "Blad logowania"; } }
public override void React(_Line line) { switch (line.Index) { case 1: logowanie.nazwa = Console.ReadLine(); break; case 2: logowanie.haslo = Console.ReadLine(); break; case 3: if (!logowanie.IsAnyNullOrEmpty()) { var logowania = BazaDanych.Rekordy <Logowanie>(); foreach (var log in logowania) { if (log.nazwa == logowanie.nazwa && log.haslo == logowanie.haslo && sklep.asortyment.Count > 0) { var kasjer = new Kasjer(); kasjer.idlogowania = log.id; kasjer.data_rozpoczecia = DateTime.Now; kasjer.data_zakonczenia = DateTime.Now; kasjer = BazaDanych.Wstaw(kasjer); MWS.DisplayAdapter.Display(new Kasa(sklep, log, kasjer)); } } } break; case 4: MWS.DisplayAdapter.Display(new Rejestracja(sklep)); break; case 5: MWS.DisplayAdapter.Display(new Statystyki(sklep)); break; case 6: MWS.DisplayAdapter.Display(new Asortyment(sklep)); break; case 7: MWS.DisplayAdapter.Display(new Sklepy()); break; } MWS.DisplayAdapter.Display(new Zaloguj(sklep, logowanie)); }
public static T Wstaw <T>(T obiekt, Encja obiekt2 = null) where T : Encja { if (typeof(T) == typeof(Sklep)) { if (obiekt2 is null) { return(Sklep.Wstaw(obiekt as Sklep) as T); } else if (obiekt2 is Produkt) { Sklep_Produkt.Wstaw(obiekt as Sklep, obiekt2 as Produkt); } } else if (typeof(T) == typeof(Kasjer)) { return(Kasjer.Wstaw(obiekt as Kasjer) as T); } else if (typeof(T) == typeof(Klient)) { if (obiekt2 is null) { return(Klient.Wstaw(obiekt as Klient) as T); } else if (obiekt2 is Produkt) { Klient_Produkt.Wstaw(obiekt as Klient, obiekt2 as Produkt); } } else if (typeof(T) == typeof(Logowanie)) { return(Logowanie.Wstaw(obiekt as Logowanie) as T); } else if (typeof(T) == typeof(Produkt)) { return(Produkt.Wstaw(obiekt as Produkt) as T); } return(null); }
public static void Usun <T>(T obiekt, Encja obiekt2 = null) where T : Encja { if (typeof(T) == typeof(Sklep)) { if (obiekt2 is null) { Sklep.Usun(obiekt as Sklep); } else if (obiekt2 is Produkt) { Sklep_Produkt.Usun(obiekt as Sklep, obiekt2 as Produkt); } } else if (typeof(T) == typeof(Kasjer)) { Kasjer.Usun(obiekt as Kasjer); } else if (typeof(T) == typeof(Klient)) { if (obiekt2 is null) { Klient.Usun(obiekt as Klient); } else if (obiekt2 is Produkt) { Klient_Produkt.Wstaw(obiekt as Klient, obiekt2 as Produkt); } } else if (typeof(T) == typeof(Logowanie)) { Logowanie.Usun(obiekt as Logowanie); } else if (typeof(T) == typeof(Produkt)) { Produkt.Usun(obiekt as Produkt); } }
public static T ZnajdzRekord <T>(int id) where T : Encja { if (typeof(T) == typeof(Sklep)) { return(Sklep.ZnajdzRekord(id) as T); } else if (typeof(T) == typeof(Kasjer)) { return(Kasjer.ZnajdzRekord(id) as T); } else if (typeof(T) == typeof(Klient)) { return(Klient.ZnajdzRekord(id) as T); } else if (typeof(T) == typeof(Logowanie)) { return(Logowanie.ZnajdzRekord(id) as T); } else if (typeof(T) == typeof(Produkt)) { return(Produkt.ZnajdzRekord(id) as T); } throw new Exception("Nie sprecyzowano typu"); }
public static void Zmien <T>(T obiektPrzed, T obiektPo = null) where T : Encja { obiektPo.id = obiektPrzed.id; if (typeof(T) == typeof(Sklep)) { Sklep.Zmien(obiektPo as Sklep); } else if (typeof(T) == typeof(Kasjer)) { Kasjer.Zmien(obiektPo as Kasjer); } else if (typeof(T) == typeof(Klient)) { Klient.Zmien(obiektPo as Klient); } else if (typeof(T) == typeof(Logowanie)) { Logowanie.Zmien(obiektPo as Logowanie); } else if (typeof(T) == typeof(Produkt)) { Produkt.Zmien(obiektPo as Produkt); } }
public static List <T> Rekordy <T>() where T : Encja { if (typeof(T) == typeof(Sklep)) { return(Sklep.Rekordy().Cast <T>().ToList()); } else if (typeof(T) == typeof(Kasjer)) { return(Kasjer.Rekordy().Cast <T>().ToList()); } else if (typeof(T) == typeof(Klient)) { return(Klient.Rekordy().Cast <T>().ToList()); } else if (typeof(T) == typeof(Logowanie)) { return(Logowanie.Rekordy().Cast <T>().ToList()); } else if (typeof(T) == typeof(Produkt)) { return(Produkt.Rekordy().Cast <T>().ToList()); } throw new Exception("Nie sprecyzowano typu"); }