private void btnLogin_Click(object sender, EventArgs e) { l.username = txtUserName.Text.Trim(); l.password = txtPassword.Text.Trim(); l.user_type = cmbUsertype.Text.Trim(); bool issuccess = dal.loginCheck(l); if (issuccess == true) { Mymessage msg = new Mymessage("Logged In Successfull!"); msg.Show(); loggedInUser = txtUserName.Text; if (cmbUsertype.Text.Trim() == "admin") { AdminDashboard adminDashboard = new AdminDashboard(); adminDashboard.Show(); } else { UserDashboard userDashboard = new UserDashboard(); userDashboard.Show(); } } else { Mymessage mymessage = new Mymessage("Login Failed"); mymessage.Show(); } }
private void Login_Load(object sender, EventArgs e) { if (!CheckDataBaseExist()) { Mymessage mymessage = new Mymessage("Database Connection Error"); mymessage.Show(); } else { Mymessage mymessage = new Mymessage("Database Connection Successfull"); mymessage.Show(); } txtUserName.Focus(); }
public bool CheckDataBaseExist() { SqlCeConnection connection = new SqlCeConnection(myconnstrng); try { connection.Open(); return(true); } catch (Exception ex) { Mymessage mymessage = new Mymessage(ex.Message); mymessage.Show(); return(false); } }
public void Show(string msg) { Mymessage mymessage = new Mymessage(msg); mymessage.Show(); }