} // end activateWorker // Disables Person textboxes and highlights the Person groupbox public static void deactivatePerson(frmEmpMan f) { deactivateEmployee(f); // Must deactivate Employee too deactivateClient(f); // Must deactivate Client too f.grpPerson.Enabled = false; f.grpPerson.BackColor = Color.Red; } // end deactivatePerson
// Resets form to initial state after form is loaded or // an add Employee operation is performed public static void resetForm(frmEmpMan f) { // Reset button components // f.btnClear.Enabled = true; f.btnDelete.Enabled = false; //f.btnEdit.Enabled = false; // f.btnToString.Enabled = false; f.btnCreateManager.Enabled = true; f.btnCreateManager.Text = "Create Manager"; f.btnCreateWorker.Enabled = true; f.btnCreateWorker.Text = "Create Worker"; f.btnCreateClient.Enabled = true; f.btnCreateClient.Text = "Create Client"; //f.btnNext.Visible = true; //f.btnPrevious.Visible = true; //f.btnCancel.Visible = false; // Reset group components f.grpPerson.Enabled = false; f.grpPerson.BackColor = Color.Gainsboro; f.grpEmployee.Enabled = false; f.grpEmployee.BackColor = Color.Gainsboro; f.grpClient.Enabled = false; f.grpClient.BackColor = Color.Gainsboro; f.grpManager.Enabled = false; f.grpManager.BackColor = Color.Gainsboro; f.grpWorker.Enabled = false; f.grpWorker.BackColor = Color.Gainsboro; } // end resetForm
} // end deactivatePerson // Disables Employee textboxes and highlights the Employee groupbox public static void deactivateEmployee(frmEmpMan f) { deactivateManager(f); // Must deactivate Manager too deactivateWorker(f); // Must deactivate Worker too f.grpEmployee.Enabled = false; f.grpEmployee.BackColor = Color.Red; } // end deactivateEmployee
} // end activateAddButtons // Enable/disable buttons when not in edit mode public static void deactivateAddButtons(frmEmpMan f) { f.btnCreateManager.Enabled = false; f.btnCreateWorker.Enabled = false; f.btnCreateClient.Enabled = false; // f.btnNext.Visible = false; // f.btnPrevious.Visible = false; // f.btnCancel.Visible = true; } // end deactivateAddButtons
} // end Clear public static void initialActivate(frmEmpMan f) { f.lblID.Enabled = true; f.txtPersonID.Enabled = true; f.lblName.Enabled = true; f.txtPersonName.Enabled = true; f.lblBirthDate.Enabled = true; f.txtPersonBirthDate.Enabled = true; }
} // end resetForm // Activates and deactivates necessary form buttons // when in add mode public static void formAddMode(frmEmpMan f) { clear(f); // f.btnClear.Enabled = true; f.btnDelete.Enabled = false; // f.btnEdit.Enabled = false; // f.btnToString.Enabled = false; // f.btnNext.Visible = false; // f.btnPrevious.Visible = false; // f.btnCancel.Visible = true; } // end formAddMode
} // end deativateWorker // Clear all textboxes on the form public static void clear(frmEmpMan f) { f.txtPersonName.Text = ""; f.txtPersonBirthDate.Text = ""; f.txtPersonID.Text = ""; f.txtClientType.Text = ""; f.txtEmployeeJobTitle.Text = ""; f.txtManagerSalary.Text = ""; f.txtManagerBonus.Text = ""; f.txtWorkerHourlyPay.Text = ""; } // end Clear
public FormController(frmEmpMan parentForm) { f = parentForm; }
public static void createWorker(frmEmpMan f) { f.grpEmployee.Enabled = true; f.grpClient.Enabled = true; }
public static void createManager(frmEmpMan f) { f.grpEmployee.Enabled = true; f.grpManager.Enabled = true; }
public static void createClient(frmEmpMan f) { f.grpClient.Enabled = true; }
public static void deactivatePerson1(frmEmpMan f) { f.grpPerson.Enabled = false; }
} // end Save // Display data in object on form public override void Display(frmEmpMan f) { base.Display(f); f.txtManagerSalary.Text = managerSalary.ToString(); f.txtManagerBonus.Text = managerBonus.ToString(); } // end Display
} // end Save // Display data in object on form public override void Display(frmEmpMan f) { base.Display(f); f.txtWorkerTitle.Text = employeeJobTitle.ToString(); } // end Display
} // end Save // Display data in object on form public override void Display(frmEmpMan f) { base.Display(f); f.txtClientType.Text = clientType.ToString(); } // end Display
} // end Property // Accessor/mutator for bonus // Save data from form to object public override void Save(frmEmpMan f) { base.Save(f); workerPay = Convert.ToDecimal(f.txtWorkerPay.Text); } // end Save
} // End Property // Save data from form to object public virtual void Save(frmEmpMan f) { personName = f.txtPersonName.Text; personBirthDate = DateTime.Parse(f.txtPersonBirthDate.Text); personID = f.txtPersonID.Text; } // end Save
} // end Save // Display data in object on form public virtual void Display(frmEmpMan f) { f.txtPersonName.Text = personName; f.txtPersonBirthDate.Text = personBirthDate.ToShortDateString(); f.txtPersonID.Text = personID; } // end Display
} // end activateManager // Enables Worker textboxes and highlights the Worker groupbox public static void activateWorker(frmEmpMan f) { activateEmployee(f); // Employee must be activated too f.grpWorker.Enabled = true; f.grpWorker.BackColor = Color.LimeGreen; } // end activateWorker
} // end ActivateEm[ployee // Enables Employee textboxes and highlights the Client groupbox public static void activateClient(frmEmpMan f) { activatePerson(f); f.grpClient.Enabled = true; f.grpClient.BackColor = Color.LimeGreen; } // end activateClient
} // end activatePerson // Enables Employee textboxes and highlights the Employee groupbox public static void activateEmployee(frmEmpMan f) { activatePerson(f); f.grpEmployee.Enabled = true; f.grpEmployee.BackColor = Color.LimeGreen; } // end ActivateEm[ployee
} // end Property // Save data from form to object public override void Save(frmEmpMan f) { base.Save(f); managerSalary = Convert.ToDecimal(f.txtManagerSalary.Text); managerBonus = Convert.ToDecimal(f.txtManagerBonus.Text); } // end Save
} // end deactivateEmployee // Disables Client textboxes and highlights the Client groupbox public static void deactivateClient(frmEmpMan f) { f.grpClient.Enabled = false; f.grpClient.BackColor = Color.Red; } // end deactivateClient
} // end Property // Save data from form to object public override void Save(frmEmpMan f) { base.Save(f); employeeJobTitle = Convert.ToString(f.txtWorkerTitle.Text); } // end Save
} // end deactivateAddButtons // Enables Employee textboxes and highlights the Person groupbox public static void activatePerson(frmEmpMan f) { f.grpPerson.Enabled = true; f.grpPerson.BackColor = Color.LimeGreen; } // end activatePerson
} // end deactivateManager // Disables Worker textboxes and highlights the Worker groupbox public static void deactivateWorker(frmEmpMan f) { f.grpWorker.Enabled = false; f.grpWorker.BackColor = Color.Red; } // end deativateWorker
} // end Save // Display data in object on form public override void Display(frmEmpMan f) { base.Display(f); f.txtWorkerPay.Text = workerPay.ToString(); } // end Display
} // end Property // Save data from form to object public override void Save(frmEmpMan f) { base.Save(f); clientType = Convert.ToString(f.txtClientType.Text); } // end Save