/** * @desc Default constructor for creating new equipment from main menu. * This is for loading from main menu, * the equipment list reference is not necessary so it will be set to null * @params [none] No input parameter. * @return [none] No directly returned data. */ public frm_equipment() { InitializeComponent(); this.Text = "Add New Equipment"; clEquipment = new Equipment(); this.frmEqList = null; // Set default state of form button_remove.Enabled = false; rd_item.Checked = true; rd_item_Checked(); }
/** * @desc Executes when the "Equipment Booking" button is clicked * It displays the equipment list for borrowing form instantiated for this specific staff * @params [none] No input parameter. * @return [none] No directly returned data. */ private void button_equipmentbooking_Click(object sender, EventArgs e) { frm_equipment_list frmEquipmentList = new frm_equipment_list(clStaff.Id_staff,this); frmEquipmentList.ShowDialog(); }
/** * @desc Constructor for creating new equipment from equipment list. * (to be able to refresh eq list after saving added new equipment to equipment list) * @params [frm_equipment_list] frmEqList: by taking this parameter there will be a reference * to the equipment list so it can be refreshed after saving the new equipment * @return [none] No directly returned data. */ public frm_equipment(frm_equipment_list frmEqList) { InitializeComponent(); this.Text = "Add New Equipment"; clEquipment = new Equipment(); this.frmEqList = frmEqList; button_remove.Enabled = false; rd_item.Checked = true; rd_item_Checked(); }
/** * @desc Constructor for editing an existing equipment. * (To be able to refresh equipment list after saving the edited equipment) * @params [int] id_equipment: identifies the equipment to modify * @params [frm_equipment_list] frmEqList: by taking this parameter there will be a reference * to the equipment list so it can be refreshed after saving the new equipment * @return [none] No directly returned data. */ public frm_equipment(int id_equipment, frm_equipment_list frmEqList) { InitializeComponent(); this.Text = "Edit Equipment"; // Load in equipment details for specified equipment clEquipment = new Equipment(id_equipment); // Create reference to the parent form (frm_equipment_list) this.frmEqList = frmEqList; // Check if there was such an equipment in the database if (clEquipment.Id_equipment < 1) MessageBox.Show("The equipment could not be found"); // If the equipment was found else { // Display table field contents on form in case of item if (clEquipment.Type == "item") { rd_item.Checked = true; rd_item_Checked(); rd_set.Hide(); txt_itemname.Text = clEquipment.Name; txt_equipmentdesc.Text = clEquipment.Description; } // Display table field contents on form in case of set else if (clEquipment.Type == "set") { rd_set.Checked = true; rd_set_Checked(); rd_item.Hide(); txt_setname.Text = clEquipment.Name; txt_equipmentdesc.Text = clEquipment.Description; } } }
/** * @desc Executes when the "Equipment" button is clicked * It opens up an equipment list for borrowing * @params [none] No input parameter. * @return [none] No directly returned data. */ private void btn_equipment_Click(object sender, EventArgs e) { frm_equipment_list frmEquipmentList = new frm_equipment_list(this.clClassInstance.Id_class_instance, this); frmEquipmentList.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(); } }