private void LoadUserType() { LoginValidation lm=new LoginValidation(); DataTable dtTable = lm.displayUserType(); DataRow dTrow = dtTable.NewRow(); dTrow["Type"] = "--Select One--"; dTrow["Id"] = "-1"; dtTable.Rows.InsertAt(dTrow, 0); cboUserType.DataSource = dtTable; cboUserType.DisplayMember = "Type"; cboUserType.ValueMember = "Id"; }
private void btnLogin_Click(object sender, EventArgs e) { EmployeeProperties.Name = txtName.Text;//here Name is called from EmployeeProperties. string password = txtPassword.Text.Trim(); // string type = "Admin"; LoginValidation loginValidation = new LoginValidation(); DataTable dtTable = new DataTable(); int id = (int)cboUserType.SelectedValue; dtTable = loginValidation.userType(id); string type = dtTable.Columns[0].ToString(); if (loginValidation.ValidateUser(EmployeeProperties.Name, password)) { frmMdiMain MdiMain = new frmMdiMain(); this.Hide(); MdiMain.Show(); if (type == "admin") { UcRegisterEmployee EMP = new UcRegisterEmployee(); EMP.btnManageEmployee.Enabled = false; } } else { MessageBox.Show("Name or Password does not match"); } //if (loginValidation.ValidateMainAdmin(EmployeeProperties.Name, password)) //{ // frmMdiMain MdiMain = new frmMdiMain(); // this.Hide(); // MdiMain.Show(); //} //else // MessageBox.Show("Something Error"); }