private void lblHome_Click(object sender, EventArgs e) { EmpHomeForm home = new EmpHomeForm(usersTable); home.Show(); this.Hide(); }
private void editProfile() { if (isValidPassword() && isEmpty() && isvalidphone() && isValidEmail()) { Employee employee = setEmployee(); int rowsAffected = dataAccess.Insert <Employee>(employee, true); if (rowsAffected > 0) { Users user = setUsers(); rowsAffected = dataAccess.Insert <Users>(user, true); if (rowsAffected > 0) { MessageBox.Show("Profile Edit Successfully"); EmpHomeForm home = new EmpHomeForm(usersTable); home.Show(); this.Hide(); } else { MessageBox.Show("Something Went Wrong!!"); } } } }
private void updateProblem() { Employee_Problem ep = setEmployeeProblem(); int rowsAffected = dataAccess.Insert <Employee_Problem>(ep, true); if (rowsAffected > 0) { MessageBox.Show("Complain Updated Sucessfully"); EmpHomeForm home = new EmpHomeForm(usersTable); home.Show(); this.Hide(); } else { MessageBox.Show("Something Went Wrong!!!"); } }
private void login() { if (isEmpty()) { DataTable userTable; userTable = dataAccess.GetData <Users>($"where UserName = '******' and Password = '******'"); if (userTable.Rows.Count > 0) { if (userTable.Rows[0].Field <int>("UserType") == (int)Users.UserTypeEnum.Admin) { AdminHomeForm adminHome = new AdminHomeForm(userTable); adminHome.Show(); this.Hide(); } else if (userTable.Rows[0].Field <int>("UserType") == (int)Users.UserTypeEnum.Employee) { if (userTable.Rows[0].Field <bool>("Information_given")) { DataTable employeeTable = dataAccess.GetData <Employee>($"where User_id = '{userTable.Rows[0].Field<int>("id")}'"); if (employeeTable.Rows[0].Field <int>("Designation") == (int)Employee.DesignationEnum.Manager) { EmpHomeForm employeeHome = new EmpHomeForm(userTable); employeeHome.Show(); this.Hide(); } else { MessageBox.Show("You are not a manager So you can't Login to the home page!!!"); } } else { EmpRegistration employeeRegistration = new EmpRegistration(userTable); employeeRegistration.Show(); this.Hide(); } } else if (userTable.Rows[0].Field <int>("UserType") == (int)Users.UserTypeEnum.Customer) { DataTable customerTable = dataAccess.GetData <Customers>($"where User_Id = '{userTable.Rows[0].Field<int>("Id")}'"); if (customerTable.Rows[0].Field <bool>("Is_verified")) { CustHomeForm customeerHome = new CustHomeForm(userTable); customeerHome.Show(); this.Hide(); } else { MessageBox.Show("Please wait for verification"); } } } else { MessageBox.Show("UserName or Password is not correct!!!"); errorProvider1.SetError(txtUserName, "User Name maybe wrong!!!"); errorProvider1.SetError(txtPassword, "Password Maybe wrong!!!"); } } }