// //On click og Change button: validates the old password, verifies new password and changes the password // private void change_Click(object sender, EventArgs e) { String oldpassword = initialText.Text.ToString(); String newpassword = newText.Text.ToString(); String verifypassword = verifyText.Text.ToString(); EmployeeBS eb=new EmployeeBS(); string feed = eb.validatePassword(oldpassword, newpassword, verifypassword, emp); MessageBox.Show(feed,"Change Password"); }
// //On click of Add button, validates, adds Employee & displays assigned Employee ID // protected void register_Click(object sender, EventArgs e) { Employee emp = new Employee(); emp.first_Name = firstNameText.Text.ToString(); emp.last_Name = lastNameText.Text.ToString(); emp.birthdate = DateTime.Parse(Request.Form[birthdatePicker.UniqueID]); emp.hire_Date = DateTime.Parse(Request.Form[hireDatePicker.UniqueID]); emp.address = addressText.Text.ToString(); emp.city = cityText.Text.ToString(); emp.region = regionText.Text; string temp = emp.birthdate + ""; emp.password = temp.Substring(0, 10); if (postalCodeText.Text.Length == 0) emp.postalCode = 9999999; else emp.postalCode = Convert.ToInt32(postalCodeText.Text); emp.country = countryText.Text.ToString(); emp.mobile_Number = mobileText.Text.ToString(); emp.password = passwordText.Text.ToString(); string confirm = confirmPasswordText.Text.ToString(); emp.type = 2; EmployeeBS cs = new EmployeeBS(); string feedback = cs.addEmployee(emp, confirm); if (feedback.Contains("successfully")) { /*DialogResult result = MessageBox.Show(feedback + " Click Ok to go to Home Page. Click Cancel to Logout", "Add Employee", MessageBoxButtons.OKCancel); //if (result == DialogResult.OK) //{ // EmpHome f = new EmpHome(emp); // this.Close(); // f.Show(); //ParentForm f = new ParentForm(emp); //this.Close(); //f.Show(); //} else if (result == DialogResult.Cancel) { Application.Exit(); }*/ Response.Redirect("~/EmpHome.aspx"); } else myMessageFromCodeBehind = feedback; //ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "showMessage({0});", true); //ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", feedback); //ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "alert(feedback);", true); //System.Web.HttpContext.Current.Response.Write("<SCRIPT LANGUAGE='JavaScript'>alert('Some error! Please Check again!')</SCRIPT>"); //MessageBox.Show(feedback, "Error", MessageBoxButtons.OK); }
// //Of Loading of Form, loads Exam IDs and Employee IDs // private void AddApplicant_Load(object sender, EventArgs e) { // to allign the Legend(Group Box) to // the center of form int centerForm; int centerGroup; int groupStartPosition; centerForm = this.Width / 2; centerGroup = addApplicantLegend.Width / 2; groupStartPosition = centerForm - centerGroup; addApplicantLegend.Left = groupStartPosition; //Exam IDs Exam_DetailsBS em = new Exam_DetailsBS(); int i = em.getCount(); if(i>0) { string[] abc = new string[i]; abc = em.loadExamDetail(i); for (int m = 0; m < i; m++) { examIDCombo.Items.Add(abc[m]); } examIDCombo.SelectedIndex = 0; } else MessageBox.Show("No Exams present in the databse.", "Error"); //Employee IDs EmployeeBS emp = new EmployeeBS(); int j = emp.getCount(); if(j>0) { string[] abcd = new string[j]; abcd = emp.loadEmployee(j); for (int k = 0; k < j; k++) { employeeIDCombo.Items.Add(abcd[k]); } employeeIDCombo.SelectedIndex = 0; } else MessageBox.Show("No Employees present in the databse.", "Error"); }
// //On click of Add button, validates, adds Employee & displays assigned Employee ID // private void register_Click(object sender, EventArgs e) { Employee emp = new Employee(); emp.first_Name = firstNameText.Text.ToString(); emp.last_Name = lastNameText.Text.ToString(); emp.birthdate = birthdatePicker.Value; emp.hire_Date = hireDatePicker.Value; emp.address = addressText.Text.ToString(); emp.city = cityText.Text.ToString(); emp.region = regionText.Text; string temp = emp.birthdate + ""; emp.password = temp.Substring(0, 10); if (postalCodeText.TextLength == 0) emp.postalCode = 9999999; else emp.postalCode = Convert.ToInt32(postalCodeText.Text); emp.country = countryText.Text.ToString(); emp.mobile_Number = mobileText.Text.ToString(); emp.password = passwordText.Text.ToString(); string confirm = confirmPasswordText.Text.ToString(); emp.type = 2; EmployeeBS cs = new EmployeeBS(); string feedback = cs.addEmployee(emp,confirm); if (feedback.Contains("successfully")) { DialogResult result = MessageBox.Show(feedback + " Click Ok to go to Home Page. Click Cancel to Logout", "Add Employee", MessageBoxButtons.OKCancel); if (result == DialogResult.OK) { // EmpHome f = new EmpHome(emp); // this.Close(); // f.Show(); ParentForm f = new ParentForm(emp); this.Close(); f.Show(); } else if (result == DialogResult.Cancel) { Application.Exit(); } } else MessageBox.Show(feedback,"Error",MessageBoxButtons.OK); }