/** * @desc Executes when "Add Equipment" button is clicked * It loads in an empty frm_equipment form for adding new equipment * @params [none] No input parameter. * @return [none] No directly returned data. */ private void button_addequipment_Click(object sender, EventArgs e) { frm_equipment frmEquipment = new frm_equipment(this); frmEquipment.ShowDialog(); }
/** * @desc Executes when a grid cell is double clicked on the equipment list * It loads in the equipment belonging to the cell * @params [none] No input parameter. * @return [none] No directly returned data. */ private void dg_equipment_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { // If this is a list conjured for an equipment booking, the option for editing the item or set is still provided bool isBooking = false; if (IsBooking) { // Retrive the name of the equipment from grid string equipmentName = dg_equipment.Rows[e.RowIndex].Cells[1].Value.ToString(); // Offer the option for edit/borrow string result = frmMessageBox.ShowBox(Utils.MB_CUST2, "Would you like to Edit the " + equipmentName + " or Borrow it?", "Edit or Borrow?", "Edit", "Borrow"); // Store the result if (result == "Edit") isBooking = false; else isBooking = true; } // If this is really a booking then if (isBooking) { try { // Get equipment id int id_equipment = int.Parse(dg_equipment.Rows[e.RowIndex].Cells[0].Value.ToString()); // Bring up the borrow form for this equipment with the previously stored borrower frm_equipment frm_equipment = new frm_equipment(id_equipment, Id_member, Id_staff, Id_class_instance); frm_equipment.ShowDialog(); } catch (Exception ea) { MessageBox.Show(ea.ToString()); return; } } // Not Booking (regular equipment edit form) else { try { // Get the equipment id int id_equipment = int.Parse(dg_equipment.Rows[e.RowIndex].Cells[0].Value.ToString()); // Bring up the equipment edit form frm_equipment frm_equipment = new frm_equipment(id_equipment, this); frm_equipment.ShowDialog(); } catch (Exception ea) { MessageBox.Show(ea.ToString()); return; } } }
/** * @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(); } }