private void btnHuy_Click(object sender, EventArgs e) { this.Hide(); Admin ad = new Admin(); ad.ShowDialog(); this.Close(); }
private void OK_Click(object sender, EventArgs e) { Sprawdz_haslo(); Sprawdz_stanowisko(); if (Haslo.Text == haslo) { Log_kom.Text = "Haslo poprawne"; Poprawne = true; } else { Log_kom.Text = "Bledne haslo"; } if (stanowisko == "Administrator" && Poprawne == true) // Tu trzeba bedzie zmienic zeby patrzyl na stanowisko a nie na login { Admin admin = new Admin(); admin.Region = this.Region; this.Hide(); admin.ShowDialog(); this.Close(); } else if (stanowisko == "Dyrektor" && Poprawne == true) // Tutaj tak samo { this.Hide(); Dyrektor dyrektor = new Dyrektor(); dyrektor.Region = this.Region; this.Close(); } else if (stanowisko == "Kierownik" && Poprawne == true) // Tutaj tak samo { KierownikZmiany kierownik = new KierownikZmiany(); kierownik.Region = this.Region; this.Hide(); kierownik.ShowDialog(); this.Close(); } else if (stanowisko == "Kasjer" && Poprawne == true) // Tutaj tak samo { Kasjer kasjer = new Kasjer(); kasjer.Region = this.Region; this.Hide(); kasjer.ShowDialog(); this.Close(); } else if (stanowisko == "zwolniony" && Poprawne == true) // Tutaj tak samo { Log_kom.Text = "Ty juz tu nie pracujesz!!!!"; } }
private void OK_Click(object sender, EventArgs e) { Sprawdz_haslo(); Sprawdz_stanowisko(); if (Haslo.Text == haslo) { Log_kom.Text = "Haslo poprawne"; Poprawne = true; } else { Log_kom.Text = "Bledne haslo"; } if (stanowisko == "Administrator" && Poprawne == true) // Tu trzeba bedzie zmienic zeby patrzyl na stanowisko a nie na login { Admin admin = new Admin(); admin.Region = this.Region; this.Hide(); admin.ShowDialog(); this.Close(); } else if (stanowisko == "Dyrektor" && Poprawne == true) // Tutaj tak samo { this.Hide(); Dyrektor dyrektor = new Dyrektor(); dyrektor.Region = this.Region; this.Close(); } else if (stanowisko == "Kierownik" && Poprawne == true) // Tutaj tak samo { KierownikZmiany admin = new KierownikZmiany(); admin.Region = this.Region; this.Hide(); admin.ShowDialog(); this.Close(); } else { Log_kom.Text = "Podano błędny format danych"; } }
private void btn_LogIn_Click(object sender, EventArgs e) { if (txt_UserName.Text == "" || txt_PassWord.Text == "") { MessageBox.Show("Vui lòng nhập đầy đủ thông tin!", "Thông báo"); return; } SqlConnection conn; conn = DataProvider.OpenConnection(); int temp; if (checkBoxNhanVien.Checked) { temp = 1; } else { temp = 0; } string proc = "DangNhapHeThong"; SqlCommand cmd = new SqlCommand(proc); cmd.CommandType = CommandType.StoredProcedure; cmd.Connection = conn; try { cmd.CommandType = CommandType.StoredProcedure; //cmd.Connection = cn; cmd.Parameters.Add("@tenDangNhap", SqlDbType.NVarChar).Value = txt_UserName.Text; cmd.Parameters.Add("@matKhau", SqlDbType.VarChar).Value = txt_PassWord.Text; cmd.Parameters.Add("@isNhanVien", SqlDbType.Int).Value = temp; //Doc du lieu cua Procedure SqlDataReader reader = cmd.ExecuteReader(); if (reader.Read()) { MessageBox.Show("Đăng nhập thành công!\nXin chào " + (string)(reader[1])); Program.username = txt_UserName.Text; if (checkBoxNhanVien.Checked) { this.Hide(); NhanVienQuanLy nvql = new NhanVienQuanLy(); nvql.ShowDialog(); DataProvider.CloseConnection(conn); this.Close(); } else { if (txt_UserName.Text != "admin") { this.Hide(); TimKiemKhachSan tkks = new TimKiemKhachSan(); tkks.ShowDialog(); DataProvider.CloseConnection(conn); this.Close(); } else { this.Hide(); Admin ad = new Admin(); ad.ShowDialog(); DataProvider.CloseConnection(conn); this.Close(); } } } else { MessageBox.Show("Thông tin đăng nhập không đúng.Vui lòng kiểm tra lại", "Lỗi Đăng Nhập", MessageBoxButtons.OK, MessageBoxIcon.Error); txt_PassWord.Text = ""; txt_UserName.Text = ""; } } catch (Exception ex) { MessageBox.Show("Lỗi: " + ex.Message); } }
private void Btnadmin_Click(object sender, EventArgs e) { Admin ad = new Admin(); ad.ShowDialog(); }