private void ValidationButton_Click(object sender, EventArgs e) { StringBuilder err = new StringBuilder(); Object data = ValidationClass.isPositiveInteger(textBox1.Text, err); if (data == null) { MessageBox.Show(err.ToString()); } else { int x = (int)data; MessageBox.Show("The entered data is " + x); } }
private void getemployeeswithlesssalarybutton_Click(object sender, EventArgs e) { if (salary_textBox.Text == "")//validation part { MessageBox.Show("Please, insert a value for base salary."); } else { StringBuilder err = new StringBuilder(); Object salary = ValidationClass.isPositiveInteger(salary_textBox.Text, err); if (salary == null) { MessageBox.Show("Salary has an incorrect value " + err.ToString()); } else { DataTable dt = controllerObj.SelectAllEmployeesWithSalaryLessThan(salary_textBox.Text); EmployeeLessSalary_ComboBox.DataSource = dt; } } }
private void getemployeeswithlesshours_button_Click(object sender, EventArgs e) { if (hours_textbox.Text == "")//validation part { MessageBox.Show("Please, insert a value for hours."); } else { StringBuilder err = new StringBuilder(); Object hours = ValidationClass.isPositiveInteger(hours_textbox.Text, err); if (hours == null) { MessageBox.Show("Hours has an incorrect value " + err.ToString()); } else { DataTable dt = controllerObj.GetEmployeesWithLessHours(hours_textbox.Text, deptloc1_comboBox.Text, deptloc2_comboBox.Text); EmployeeLessSalary_ComboBox.DataSource = dt; } } }
private void button1_Click(object sender, EventArgs e) { if (ProjectName_textBox.Text == "" || ProjectNo_textBox.Text == "" || ProjectLocation_textBox.Text == "")//validation part { MessageBox.Show("Please, insert all values"); } else { StringBuilder err = new StringBuilder(); Object PNO = ValidationClass.isPositiveInteger(ProjectNo_textBox.Text, err); Object DNO = ValidationClass.isPositiveInteger(DepartmentNo_ComboBox.SelectedValue.ToString(), err); if (PNO == null || DNO == null) { MessageBox.Show("Some inputs has incorrect values " + err.ToString()); } else { int r = controllerObj.InsertProject(ProjectName_textBox.Text, (int)PNO, ProjectLocation_textBox.Text, (int)DNO); MessageBox.Show("Project inserted successfully"); } } }
private void updatesalary_button_Click(object sender, EventArgs e) { if (ussn_textbox.Text == "" || usalary_textbox.Text == "")//validation part { MessageBox.Show("Please, insert a value for SSN & New Salary."); } else { StringBuilder err = new StringBuilder(); Object ssn = ValidationClass.isPositiveInteger(ussn_textbox.Text, err); Object salary = ValidationClass.isPositiveInteger(usalary_textbox.Text, err); if (ssn == null || salary == null) { MessageBox.Show("SSN and/or Salary has an incorrect value " + err.ToString()); } else { DataTable dt = controllerObj.EditSalarybySSN(ussn_textbox.Text, usalary_textbox.Text); EmployeeLessSalary_ComboBox.DataSource = dt; } } }
private void insertdept_button_Click(object sender, EventArgs e) { if (newdeptmgrstartd_textbox.Text == "" || newdeptmgr_textbox.Text == "" || newdept_textbox.Text == "" || newdno_textbox.Text == "")//validation part { MessageBox.Show("Please, insert values for required data (new department's name, new dept. ID, newdept. manager's SSN, new dept. manager's start date ."); } else { StringBuilder err = new StringBuilder(); Object startd = ValidationClass.isPositiveInteger(newdeptmgrstartd_textbox.Text, err); Object dmgr = ValidationClass.isPositiveInteger(newdeptmgr_textbox.Text, err); Object newd = ValidationClass.isPositiveInteger(newdept_textbox.Text, err); Object dno = ValidationClass.isPositiveInteger(newdno_textbox.Text, err); if (startd == null || dmgr == null || newd != null || dno == null) { MessageBox.Show("An entered data has incorrect value " + err.ToString()); } else { DataTable dt = controllerObj.InsertDept(newdept_textbox.Text, newdno_textbox.Text, newdeptmgr_textbox.Text, newdeptmgrstartd_textbox.Text); EmployeeLessSalary_ComboBox.DataSource = dt; } } }