private void ClearMethod() { FirstNameTB.Clear(); LastNametextBox.Clear(); DateOfBirthTB.Value = DateTime.Now; GenderTB.SelectedIndex = -1; ContacttextBox.Text = "03"; NICtextBox.Clear(); HouseNOtextBox.Clear(); AddLine1Tb.Clear(); AddLine2tb.Clear(); postCodetextBox.Clear(); DepartmentTextBoc.SelectedIndex = -1; designationtextBox.SelectedIndex = -1; ; StatuscomboBox.SelectedIndex = -1; DateOfHired.Value = DateTime.Now; BasicSalarytextBox.Clear(); JobTitletextBox.Clear(); PasswordTb.Clear(); ImgLocation = ""; ProfilePicture.Image = Resources.User1; }
private void UpdateBtn_Click(object sender, EventArgs e) { if (UsernameTb.Text != "" || PasswordTb.Text != "" || RecoveryTb.Text != "") { if (IdTb.Text != "") { DialogResult result = MessageBox.Show("Do You Really Want To Update this Account?", "Confirm Update", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (result == DialogResult.OK) { _admin.Id = int.Parse(IdTb.Text); _admin.Username = UsernameTb.Text; _admin.Password = PasswordTb.Text; _admin.RecoveryName = RecoveryTb.Text; _adminService.UpdateLogín(_admin); AdminService adminService = new AdminService(); var dataSource = adminService.GetLogínsDataTable(); grid.DataSource = dataSource; MessageBox.Show("Account Updated Successfully!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); IdTb.ResetText(); UsernameTb.ResetText(); PasswordTb.ResetText(); RecoveryTb.ResetText(); } } } else { MessageBox.Show("Please Select an account from the grid!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void ClearMethod() { IDTB.Clear(); FirstNameTB.Clear(); LastNametextBox.Clear(); DateOfBirthTB.Value = DateTime.Now; GenderTB.SelectedIndex = -1; ContacttextBox.Clear(); NICtextBox.Clear(); HouseNOtextBox.Clear(); AddLine1Tb.Clear(); AddLine2tb.Clear(); postCodetextBox.Clear(); DepartmentTextBoc.SelectedIndex = -1; designationtextBox.SelectedIndex = -1; StatuscomboBox.SelectedIndex = -1; DateOfHired.Value = DateTime.Now; BasicSalarytextBox.Clear(); JobTitletextBox.Clear(); PasswordTb.Clear(); UpdateBtn.Enabled = false; button1.Enabled = false; ReadID(); ProfilePicture.Image = Resources.User1; }
private void ClearBtn_Click(object sender, EventArgs e) { IdTb.ResetText(); UsernameTb.ResetText(); PasswordTb.ResetText(); RecoveryTb.ResetText(); }
private void CreateAccountBtn_Click(object sender, EventArgs e) { if (UsernameTb.Text != "" || PasswordTb.Text != "" || RecoveryTb.Text != "") { _admin.Username = UsernameTb.Text; _admin.Password = PasswordTb.Text; _admin.RecoveryName = RecoveryTb.Text; _adminService.InsertLogín(_admin); AdminService adminService = new AdminService(); var dataSource = adminService.GetLogínsDataTable(); grid.DataSource = dataSource; MessageBox.Show("Account Created Successfully!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); IdTb.ResetText(); UsernameTb.ResetText(); PasswordTb.ResetText(); RecoveryTb.ResetText(); } else { MessageBox.Show("Please Fill in the fields!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); IdTb.ResetText(); UsernameTb.ResetText(); PasswordTb.ResetText(); RecoveryTb.ResetText(); } }
private void textbox2_Click(object sender, EventArgs e) { PasswordTb.Clear(); pictureBox3.BackgroundImage = Properties.Resources.password; PasswordTb.ForeColor = Color.FromArgb(255, 99, 55); PasswordTb.MaxLength = 14; PasswordTb.PasswordChar = '*'; }
//Password private void PasswordTb_Leave(object sender, EventArgs e) { switch (First_Page.opt1) { case 0: if (string.IsNullOrEmpty(PasswordTb.Text)) { PasswordTb.Focus(); errorProvider1.SetError(PasswordTb, "Please Enter Your Password !"); } else if (!d1.isValidPassword(PasswordTb.Text)) { PasswordTb.Focus(); errorProvider1.SetError(PasswordTb, "Password Should be of atleast 8 Characters!"); } else { errorProvider1.Clear(); } break; case 1: if (string.IsNullOrEmpty(PasswordTb.Text)) { PasswordTb.Focus(); errorProvider1.SetError(PasswordTb, "Please Enter Your Password !"); } else if (!p.isValidPassword(PasswordTb.Text)) { PasswordTb.Focus(); errorProvider1.SetError(PasswordTb, "Password Should be of atleast 8 Characters!"); } else { errorProvider1.Clear(); } break; } }
private void DeleteBtn_Click(object sender, EventArgs e) { if (IdTb.Text != "") { DialogResult result = MessageBox.Show("Do You Really Want To Delete this Account?", "Confirm Delete", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (result == DialogResult.OK) { _adminService.DeleteLogín(int.Parse(IdTb.Text)); AdminService adminService = new AdminService(); var dataSource = adminService.GetLogínsDataTable(); grid.DataSource = dataSource; MessageBox.Show("Account Deleted Successfully!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); IdTb.ResetText(); UsernameTb.ResetText(); PasswordTb.ResetText(); RecoveryTb.ResetText(); } } else { MessageBox.Show("Please Select an Id from the grid!", "Id is not provided", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private Boolean Validation() { if (FirstNameTB.Text == "") { FirstNameTB.BackColor = Color.DodgerBlue; MessageBox.Show("First Name Is Required", "Please Enter First Name", MessageBoxButtons.OK, MessageBoxIcon.Warning); FirstNameTB.Focus(); return true; } if (LastNametextBox.Text == "") { LastNametextBox.BackColor = Color.DodgerBlue; MessageBox.Show("Last Name Is Required", "Please Enter Last Name", MessageBoxButtons.OK, MessageBoxIcon.Warning); LastNametextBox.Focus(); return true; } if (DateOfBirthTB.Value == Dt) { DateOfBirthTB.BackColor = Color.DodgerBlue; MessageBox.Show("Date Of Birth Is Required", "Please Enter Date Of Birth", MessageBoxButtons.OK, MessageBoxIcon.Warning); DateOfBirthTB.Focus(); return true; } if (GenderTB.SelectedIndex == -1) { GenderTB.BackColor = Color.DodgerBlue; MessageBox.Show("Gender Is Required", "Please Select Gender", MessageBoxButtons.OK, MessageBoxIcon.Warning); GenderTB.Focus(); return true; } if (ContacttextBox.Text == "") { ContacttextBox.BackColor = Color.DodgerBlue; MessageBox.Show("Contact Number Is Required", "Please Enter Contact", MessageBoxButtons.OK, MessageBoxIcon.Warning); ContacttextBox.Focus(); return true; } if (NICtextBox.Text == "") { NICtextBox.BackColor = Color.DodgerBlue; MessageBox.Show("NIC Is Required", "Please Enter NIC", MessageBoxButtons.OK, MessageBoxIcon.Warning); NICtextBox.Focus(); return true; } if (DepartmentTextBoc.SelectedIndex == -1) { DepartmentTextBoc.BackColor = Color.DodgerBlue; MessageBox.Show("Department Is Required", "Please Select Department", MessageBoxButtons.OK, MessageBoxIcon.Warning); DepartmentTextBoc.Focus(); return true; } if (designationtextBox.SelectedIndex == -1) { designationtextBox.BackColor = Color.DodgerBlue; MessageBox.Show("Designation Is Required", "Please Select Designation", MessageBoxButtons.OK, MessageBoxIcon.Warning); designationtextBox.Focus(); return true; } if (StatuscomboBox.SelectedIndex == -1) { StatuscomboBox.BackColor = Color.DodgerBlue; MessageBox.Show("Status Is Required", "Please Select Status", MessageBoxButtons.OK, MessageBoxIcon.Warning); StatuscomboBox.Focus(); return true; } if (DateOfHired.Value == Dt) { DialogResult Result = MessageBox.Show("Do You Want To Enter To Day's Date ? ", "Yes Or No", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (Result == DialogResult.No) { DateOfHired.Focus(); return true; } } if (BasicSalarytextBox.Text == "") { BasicSalarytextBox.BackColor = Color.DodgerBlue; MessageBox.Show("Basic Salary Is Required", "Please Enter Basic Salary", MessageBoxButtons.OK, MessageBoxIcon.Warning); BasicSalarytextBox.Focus(); return true; } if (JobTitletextBox.Text == "") { JobTitletextBox.BackColor = Color.DodgerBlue; MessageBox.Show("Job Title Is Required", "Please Enter Title", MessageBoxButtons.OK, MessageBoxIcon.Warning); JobTitletextBox.Focus(); return true; } if (HouseNOtextBox.Text == "") { HouseNOtextBox.BackColor = Color.DodgerBlue; MessageBox.Show("House Number Is Required", "Please Enter House Number", MessageBoxButtons.OK, MessageBoxIcon.Warning); HouseNOtextBox.Focus(); return true; } if (AddLine1Tb.Text == "") { AddLine1Tb.BackColor = Color.DodgerBlue; MessageBox.Show("Address Is Required", "Please Enter Address", MessageBoxButtons.OK, MessageBoxIcon.Warning); AddLine1Tb.Focus(); return true; } if (PasswordTb.Text == "") { PasswordTb.BackColor = Color.DodgerBlue; MessageBox.Show("Password Number Is Required", "Please Enter Password", MessageBoxButtons.OK, MessageBoxIcon.Warning); PasswordTb.Focus(); return true; } return false; }