/** * @desc Constructor for creating new staff, that was opened from staff list. * @params [frm_staff_list] frmStaffList: by taking this parameter there will be a reference * to the staff list so it can be refreshed after saving the new staff * @return [none] No directly returned data. */ public frm_staff(frm_staff_list frmStaffList) { this.frmStaffList = frmStaffList; clStaff = new Staff(); InitializeComponent(); button_saveOpen.Hide(); button_equipmentbooking.Hide(); DateTime today = DateTime.Today; txt_contract_start.Text = String.Format("{0:dd-MM-yyyy}", today); }
/** * @desc Constructor for editing an existing staff. * @params [int] id_staff: identifies the staff to modify * @params [frm_staff_list] frmStaffList: by taking this parameter there will be a reference * to the staff list so it can be refreshed after saving the edited staff * @return [none] No directly returned data. */ public frm_staff(int id_staff, frm_staff_list frmStaffList) { // Create reference to the parent form this.frmStaffList = frmStaffList; InitializeComponent(); this.Text = "Edit Gym Staff Form"; button_equipmentbooking.Enabled = true; button_saveOpen.Enabled = false; // Load in staff details for specified staff clStaff = new Staff(id_staff); if (clStaff.Id_staff < 1) MessageBox.Show("The staff member could not be found"); else { // If the staff was found, load in all staff details into staff object from database vLoadBookedList(); txt_firstName.Text = clStaff.FirstName; txt_lastName.Text = clStaff.LastName; txt_dob.Text = Utils.sGetCsharpDateFromMysqlDate(clStaff.Birthdate); txt_address1.Text = clStaff.Address_1; txt_address2.Text = clStaff.Address_2; txt_city.Text = clStaff.City; txt_county.Text = clStaff.County; txt_emerg_mobile.Text = clStaff.EmergContactMobile; txt_emerg_name.Text = clStaff.EmergContactName; txt_emerg_telephone.Text = clStaff.EmergContactPhone; txt_emerg_relation.Text = clStaff.EmergContactRelation; txt_allergies.Text = clStaff.MedicalAllergies; txt_doctor_name.Text = clStaff.MedicalDoctorName; txt_medical_notes.Text = clStaff.MedicalNotes; txt_qualifications.Text = clStaff.Qualifications; txt_doctor_phone.Text = clStaff.MedicalPhone; txt_pc.Text = clStaff.PostalCode; cmb_contract.Text = clStaff.ContractType; txt_email.Text = clStaff.Email; txt_mobile.Text = clStaff.Mobile; txt_telephone.Text = clStaff.Phone; cmb_position.Text = clStaff.Position; txt_natinsnumb.Text = clStaff.NatInsNumb; txt_contract_start.Text = Utils.sGetCsharpDateFromMysqlDate(clStaff.SContractStart); txt_contract_finish.Text = Utils.sGetCsharpDateFromMysqlDate(clStaff.SContractFinish); chk_active.Checked = clStaff.IsActive; } }
/** * @desc Executes when the "Save and Open" button is clicked * If the saving is ok, then closes the member form and opens up the member list * @params [none] No input parameter. * @return [none] No directly returned data. */ private void button_saveOpen_Click(object sender, EventArgs e) { if (this.saveClick()) { this.Dispose(); frm_staff_list frmStaffList = new frm_staff_list(); frmStaffList.ShowDialog(); } }
/** * @desc Executes at panel events * It watches the selectedBand and executes the "if" section that it currently belongs to * @params [none] No input parameter. * @return [none] No directly returned data. */ public void PanelEvent(object sender, EventArgs e) { Control ctrl = (Control)sender; PanelIcon panelIcon = ctrl.Tag as PanelIcon; string selectedBand = panelIcon.iconPanel.BandName; foreach (Form childForm in MdiChildren) childForm.Close(); ///////////////////////// MANAGER OPTIONS BAND //////////////////////// // Add Staff if (selectedBand == "manager" && panelIcon.Index.ToString() == "0") { frm_staff frmStaff = new frm_staff(); frmStaff.ShowDialog(); } // Edit Staff if (selectedBand == "manager" && panelIcon.Index.ToString() == "1") { frm_staff_list frmStaffList = new frm_staff_list(); frmStaffList.ShowDialog(); } // Membership fees else if (selectedBand == "manager" && panelIcon.Index.ToString() == "2") { frm_payment_list frmPayments = new frm_payment_list(); frmPayments.ShowDialog(); } //Edit Arranged Class else if (selectedBand == "manager" && panelIcon.Index.ToString() == "3") { frm_class_instance_list frmClassArrangeList = new frm_class_instance_list(); frmClassArrangeList.ShowDialog(); } // Add Class else if (selectedBand == "manager" && panelIcon.Index.ToString() == "4") { frm_class frmClass = new frm_class(); frmClass.ShowDialog(); } // Edit Class else if (selectedBand == "manager" && panelIcon.Index.ToString() == "5") { frm_class_list frmClassList = new frm_class_list(); frmClassList.ShowDialog(); } // Add New Equipment else if (selectedBand == "manager" && panelIcon.Index.ToString() == "6") { frm_equipment frmEquipment = new frm_equipment(); frmEquipment.ShowDialog(); } // Edit Equipment else if (selectedBand == "manager" && panelIcon.Index.ToString() == "7") { frm_equipment_list frmEquipmentList = new frm_equipment_list(); frmEquipmentList.ShowDialog(); } // Edit Room else if (selectedBand == "manager" && panelIcon.Index.ToString() == "8") { frm_room_list frmRoomList = new frm_room_list(); frmRoomList.Show(); } ///////////////////// STAFF OPTIONS BAND ////////////////////// // Add Member else if (selectedBand == "staff" && panelIcon.Index.ToString() == "0") { frm_member frmMember = new frm_member(); frmMember.ShowDialog(); } //Edit Member else if (selectedBand == "staff" && panelIcon.Index.ToString() == "1") { frm_member_list frmMemberList = new frm_member_list(); frmMemberList.ShowDialog(); } //Book Class else if (selectedBand == "staff" && panelIcon.Index.ToString() == "2") { frm_class_instance_arrange frmClassArrange = new frm_class_instance_arrange(); frmClassArrange.ShowDialog(); } //Edit Arranged Class else if (selectedBand == "staff" && panelIcon.Index.ToString() == "3") { frm_class_instance_list frmClassArrangeList = new frm_class_instance_list(); frmClassArrangeList.ShowDialog(); } // Search Eq. Bookings else if (selectedBand == "staff" && panelIcon.Index.ToString() == "4") { frm_equipment_bookings_list frmEqBookingsList = new frm_equipment_bookings_list(); frmEqBookingsList.ShowDialog(); } // Room Search else if (selectedBand == "staff" && panelIcon.Index.ToString() == "5") { frm_room_list frmRoomList = new frm_room_list(); frmRoomList.ShowDialog(); } ///////////////////////// LOGIN OPTIONS BAND /////////////////////// // Login Options else if (selectedBand == "all" && panelIcon.Index.ToString() == "0") { frm_login_options frmLoginOptions = new frm_login_options(this); frmLoginOptions.ShowDialog(); } // Log Out else if (selectedBand == "all" && panelIcon.Index.ToString() == "1") { Controls.Remove(this.outlookBar); frm_login frmLogin = new frm_login(this); frmLogin.ShowDialog(); } }