示例#1
0
 private void submitButton_Click(object sender, EventArgs e)
 {
     PopulateObject(roleValue);
     MessageBox.Show("To be submitted to the Database!");
     employeeController.DataMaintenance(employee, DatabaseLayer.DB.DBOperation.Add);
     employeeController.FinalizeChanges(employee);
     ClearAll();
     ShowAll(false, roleValue);
 }
 private void submitButton_Click(object sender, EventArgs e)
 {
     //The employee object is already populated in the  employeeListView_SelectedIndexChanged event
     // hence no need to populate now
     // if the add operation will be included on this form, it will become necessary to populate the employee
     if (state == FormStates.Edit)
     {
         PopulateObject(employee.role.RoleValue);
         employeeController.DataMaintenance(employee, DatabaseLayer.DB.DBOperation.Edit);
     }
     else
     {
         employeeController.DataMaintenance(employee, DatabaseLayer.DB.DBOperation.Delete);
     }
     employeeController.FinalizeChanges(employee);
     ClearAll();
     state = FormStates.View;
     ShowAll(false, roleValue);
     setUpEmployeeListView();   //refresh List View
     employee = null;
 }