public Laborant UlogujKorisnika(string korisnickoIme, string lozinka) { SqlCommand command = connection.CreateCommand(); command.CommandText = $"select * from Laborant where KorisnickoIme = '{korisnickoIme}' and Lozinka = '{lozinka}'"; SqlDataReader reader = command.ExecuteReader(); Laborant l = null; while (reader.Read()) { l = new Laborant { LaborantID = (int)reader["LaborantID"], Ime = (string)reader["Ime"], KorisnickoIme = (string)reader["KorisnickoIme"], LaboratorijaID = (int)reader["LaboratorijaID"], Lozinka = (string)reader["Lozinka"], Prezime = (string)reader["Prezime"], }; } reader.Close(); return(l); }
public LaborantPageView(Laborant Laborant) { this.Laborant = Laborant; controller = new LaborantsController(); InitializeComponent(); Loaded += LaborantPageView_LoadedUpdate; }
private void buttonPrijaviSe_Click(object sender, EventArgs e) { laborant = Connection.Instance.Login(txtUsername.Text, txtPassword.Text); if (laborant == null) { MessageBox.Show("Nema tog"); return; } FormKlijent formKlijent = new FormKlijent(laborant); this.Visible = false; formKlijent.ShowDialog(); this.Visible = true; }
public void AddLaborant(Laborant Laborant) { using (var db = new MedicModel()) { try { db.Laborants.Add(Laborant); db.SaveChanges(); } finally { db.Dispose(); } } }
public void DeleteLaborant(Laborant Laborant) { using (var db = new MedicModel()) { try { db.Entry(Laborant.User).State = EntityState.Deleted; db.Entry(Laborant).State = EntityState.Deleted; db.SaveChanges(); } finally { db.Dispose(); } } }
private bool CheckSelected(out Laborant Laborant) { var selected = ClList.SelectedItem; if (selected == null) { HelpMessageBox.MessageBoxError("Объект не выбран"); Laborant = null; return(false); } else { Laborant = selected as Laborant; return(true); } }
static void Main(string[] args) { AssemblyLaboratory al = new AssemblyLaboratory(); Laborant l = new Laborant { name = "SomeName", DateofBirth = DateTime.Now.AddMonths(-400), gender = sex.female, login = "******", password = "******" }; al.createLaborant(l); /*sendMessage sm; * sm = sendMessage; * AssemblyLaboratory al = new AssemblyLaboratory(); * al.RegisterDelegate(sm); * /*Laboratiry lab = new Laboratiry { adress = "someadres", LabId = 1, LabNumber = "ln#1",telNumber="8-701-000-00-01" };*/ //al.CreateLaboratory(lab); }
static void Main(string[] args) { AssemblyLaboratory al = new AssemblyLaboratory(); //Laborant lb = new Laborant(2, "John", DAL.Gender.male); //lb.BirthDay = DateTime.Now.AddMonths(-250); //lb.LogIn = "******"; //lb.Password = "******"; //al.CreateLabWorkers(lb); Laborant lb = al.LogOn(Console.ReadLine(), Console.ReadLine()); if (lb != null) { Console.WriteLine("Hi " + lb.Name); } else { Console.WriteLine("Access denied"); } //DGenerate del = sentMsg; //Generator g = new Generator(); //g.RegisterHedler(del); //g.Generate(Gender.man); //sentMessage sm = sentMsg; //AssemblyLaboratory al = new AssemblyLaboratory(); //al.RegistrDelegate(sm); //Laboratory lab = new Laboratory(); //lab.Adress = "Adress"; //lab.LabId = 1; //lab.PhoneNumber = "8777 77 77 000"; //al.CreateLaboratory(lab); }
private async void BtnAdd_Click(object sender, RoutedEventArgs e) { try { var Laborant = new Laborant() { User = new User() }; Laborant.Fio = pageFio.Input; Laborant.Salary = decimal.Parse(pageSalary.Input); Laborant.IdLaboratory = (pageLab.Input as Laboratory).Id; Laborant.Birthday = pageDate.Input.GetValueOrDefault(); Laborant.User.IdType = HelpDb.IdTypeForLaborant; Laborant.User.Login = pageLogin.Input; Laborant.User.Password = pagePassword.Input; await Task.Run(() => controller.AddLaborant(Laborant)); GoodClose(); } catch (Exception ex) { HelpMessageBox.MessageBoxError(ex.Message, Title); } }
public FormKlijent(Laborant laborant) { InitializeComponent(); this.laborant = laborant; }