private void BtnMain_Click(object sender, EventArgs e) { MainFrm main = new MainFrm(); if (!FrmValid.checkformopen(main.Text)) { main.Show(); this.Close(); } else { main.Activate(); this.Close(); } }
private void BtnLogin_Click(object sender, EventArgs e) { if (validation()) { AgentLogin agent = new AgentLogin(); agent.nAgentId = Convert.ToInt32(txtUsrID.Text); agent.strPassword = GetHashString(txtPwd.Text); if (AgentLogInDB.CheckIDexist(agent.nAgentId)) { if (AgentLogInDB.CheckPwdMatch(agent)) { MainFrm mainfrm = new MainFrm(); if (!FrmValid.checkformopen(mainfrm.Text)) { FrmValid.AgentId = agent.nAgentId; //this.Close(); mainfrm.Show(); this.Visible = false; } } else { CustMesg msgfrm = new CustMesg(); msgfrm.Showmsg("Password Wrong!"); msgfrm.Show(); //MessageBox.Show("Password Wrong!"); } } else { CustMesg msgfrm = new CustMesg(); msgfrm.Showmsg("User is not exist!"); msgfrm.Show(); //MessageBox.Show("User is not exist!"); } } }