private void button1_Click(object sender, EventArgs e) { string username = txtUsername.Text; string password = txtPassword.Text; if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password)) { MessageBox.Show("Username and password cann't be null"); } else { SystemAdminDAO adminDAO = new SystemAdminDAO(); int id = adminDAO.IsLogin(username, password); if (id > 0) { Program.adminId = id; new AdminDashboard().Show(); this.Hide(); } else { MessageBox.Show("Either username or password is wrong"); } } }
private void button1_Click(object sender, EventArgs e) { string companyName = txtCompanyName.Text; string username = txtUsername.Text; string password = txtPassword.Text; Bug_Tracker.Model.SystemAdmin admin = new Bug_Tracker.Model.SystemAdmin { CompanyName = companyName, Username = username, Password = password }; if (string.IsNullOrEmpty(companyName) || string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password)) { MessageBox.Show("Fill up the form properly"); } else { try { SystemAdminDAO adminDAO = new SystemAdminDAO(); adminDAO.Insert(admin); MessageBox.Show("Account created"); this.Hide(); new Admin().Show(); } catch (Exception ex) { MessageBox.Show(ex.Message); Console.WriteLine(ex.Message); } } }