public EdycjaPracownika(int id = 0) { InitializeComponent(); if (id > 0) { p = baza.Pracownik.FirstOrDefault(x => x.Id == id); button3.Visible = true; } }
private void button1_Click(object sender, EventArgs e) { string Login = textBox1.Text; string Haslo = textBox2.Text; var p = baza.Pracownik.FirstOrDefault(x => x.Login == Login && x.Haslo == Haslo); if (p == null) { MessageBox.Show("Niepoprawne dane logowania!"); return; } Pracownik = p; DialogResult = DialogResult.OK; }
private void Zaloguj() { label3.Text = "-"; dataGridView1.DataSource = null; Logowanie l = new Logowanie(); if (l.ShowDialog(this) == DialogResult.OK) { Zalogowany = l.Pracownik; label3.Text = Zalogowany.Nazwa; Laduj(); } else { Close(); } }