Esempio n. 1
0
 /**
  * @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();
 }
Esempio n. 2
0
 /**
  * @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();
 }
Esempio n. 3
0
        /**
         * @desc Constructor for booking an equipment.
         * This can only launch form a member or staff panel as it needs data from them!
         * @params [int] id_equipment: identifies the equipment to book
         * @params [int] id_member: identifies the member who books the equipment
         * @params [int] id_staff: identifies the staff  who books the equipment
         * @params [int] id_class_instance: identifies the class instance to book the equipment for
         * @return [none] No directly returned data.
         */
        public frm_equipment(int id_equipment, int id_member, int id_staff, int id_class_instance)
        {
            frmMessageBox = new frm_message_box();
            // Store the fact on class global level that this is a booking
            IsBooking = true;
            InitializeComponent();
            this.Text = "Borrow Equipment";
            // Set up equipment form for bookings
            label_amounttoborrow.Visible = true;
            counter_amounttoborrow.Visible = true;
            counter_amounttoborrow.Value = 1;
            label_numberofdays.Visible = true;
            counter_numberofdays.Visible = true;
            counter_numberofdays.Value = 7;
            button_save.Text = "Borrow";
            txt_itemname.ReadOnly = true;
            txt_setname.ReadOnly = true;
            txt_equipmentdesc.ReadOnly = true;
            cmb_item1.Enabled = false;
            cmb_item2.Enabled = false;
            cmb_item3.Enabled = false;
            cmb_item4.Enabled = false;
            cmb_item5.Enabled = false;
            counter_item1.Enabled = false;
            counter_item2.Enabled = false;
            counter_item3.Enabled = false;
            counter_item4.Enabled = false;
            counter_item5.Enabled = false;
            // Load in the details of the equipment to book
            clEquipment = new Equipment(id_equipment);
            // Store class global level to whom the equipment is booked for
            Id_member = id_member;
            Id_staff = id_staff;
            Id_class_instance = id_class_instance;

            // If the equipment was not found
            if (clEquipment.Id_equipment < 1)
                MessageBox.Show("The equipment could not be found");
            // If the equipmnet was succesfully loaded in
            else
            {
                // If it is an individual item
                // 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;
                }
                // If it is a set
                // 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;
                }
            }
        }
Esempio n. 4
0
 /**
   * @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;
         }
     }
 }