예제 #1
0
 /**
  * @desc constructor for listing equipments for booking for a member
  * @params [int] id_member: this identifies the member to book for
  * @params [frm_member] frmMember: this identifies this specific constructor to call
  * and passes the refernce to the parent form to be able to refresh the booking list when this
  * form is closed
  * @return [none] No directly returned data.
  */
 public frm_equipment_list(int id_member, frm_member frmMember)
 {
     IsBooking = true;
     Id_staff = -1;
     Id_class_instance = -1;
     Id_member = id_member;
     this.frmMember = frmMember;
     InitializeComponent();
     rd_item.Checked = true;
     vLoadEqList("item");
 }
예제 #2
0
 /**
  * @desc constructor for listing equipments for booking for a member
  * @params [int] id_member: this identifies the member to book for
  * @params [frm_member] frmMember: this identifies this specific constructor to call
  * and passes the refernce to the parent form to be able to refresh the booking list when this
  * form is closed
  * @return [none] No directly returned data.
  */
 public frm_equipment_list(int id_member, frm_member frmMember)
 {
     IsBooking = true;
     Id_staff = -1;
     Id_class_instance = -1;
     Id_member = id_member;
     this.frmMember = frmMember;
     InitializeComponent();
     this.Text = "Equipment List - Double Click on a Row to Edit or Borrow an Item/Set";
     rd_item.Checked = true;
     vLoadEqList("item");
 }
예제 #3
0
 /**
  * @desc Default constructor for listing equipments
  * This is for loading from main menu,
  * @params [none] No input parameter.
  * @return [none] No directly returned data.
  */
 public frm_equipment_list()
 {
     Id_member = -1;
     Id_staff = -1;
     Id_class_instance = -1;
     InitializeComponent();
     this.frmMember = null;
     this.frmStaff = null;
     this.frmClassInstanceArrange = null;
     rd_item.Checked = true;
     vLoadEqList("item");
 }
예제 #4
0
 /**
  * @desc Default constructor for listing equipments
  * This is for loading from main menu,
  * @params [none] No input parameter.
  * @return [none] No directly returned data.
  */
 public frm_equipment_list()
 {
     Id_member = -1;
     Id_staff = -1;
     Id_class_instance = -1;
     InitializeComponent();
     this.Text = "Equipment List - Double Click on a Row to Edit Item/Set";
     this.frmMember = null;
     this.frmStaff = null;
     this.frmClassInstanceArrange = null;
     rd_item.Checked = true;
     vLoadEqList("item");
 }
예제 #5
0
        /**
          * @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();
            }
        }
예제 #6
0
        /**
          * @desc Executes when a grid cell is double clicked on the member list
          * It loads in the member belonging to the cell for editing
          * @params [none] No input parameter.
          * @return [none] No directly returned data.
          */
        private void dg_members_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                // Get the member id at current cell
                int id_member = int.Parse(dg_members.Rows[e.RowIndex].Cells[0].Value.ToString());
                // Create mysql connection
                mySqlConn conn = new mySqlConn();
                conn.connect();
                // If this member list was launched from the payment list panel
                if (this.frmPayments != null)
                {
                    // Launch Add Payment panel for the selected member
                    frm_add_payment frmAddPayment = new frm_add_payment(id_member);
                    frmAddPayment.ShowDialog();
                    // As this member list was launched from the payment list, refresh the payment list when this finishes
                    this.frmPayments.vloadDgPayments();
                    this.Close();
                    return;
                }
                // If this member list was launched from class instance list for adding new members
                if (this.clClassInstance.Id_class_instance != -1 && this.viewAttendants == false)
                {
                    // Confirm enrollment
                    DialogResult dialogResult = MessageBox.Show("Enroll this member to the class?", "Enroll member?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (dialogResult == DialogResult.Yes)
                    {
                        // Check the room size
                        string query = "SELECT COUNT(*) q FROM gym.class_bookings WHERE id_class_instance = '" + this.clClassInstance.Id_class_instance + "'";
                        List<Hashtable> lhRes = conn.lhSqlQuery(query);
                        int currMembers = int.Parse(lhRes[0]["q"].ToString());
                        query = "SELECT r.size FROM gym.class_instance ci, gym.rooms r WHERE ci.id_room = r.id_room AND ci.id_class_instance = '" + this.clClassInstance.Id_class_instance + "'";
                        lhRes = conn.lhSqlQuery(query);
                        int maxMembers = int.Parse(lhRes[0]["size"].ToString());
                        if (maxMembers < currMembers + 1)
                        {
                            MessageBox.Show("Sorry! This room does not allow more bookings!");
                            return;
                        }

                        Member clMember = new Member(id_member);
                        this.clClassInstance.LclAttendants.Add(clMember);
                        this.clClassInstance.SaveClassInstance();
                    }
                }
                // If this member list was launched from class instance list for viewing attending members
                if (this.clClassInstance.Id_class_instance != -1 && this.viewAttendants == true)
                {
                    // Confirm removal
                    DialogResult dialogResult = MessageBox.Show("Remove this member from the class?", "Delete entry?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (dialogResult == DialogResult.Yes)
                    {
                        // Create delete query
                        string deleteClassBookingQuery = "delete from class_bookings WHERE id_member = '" + id_member + "'" + " AND id_class_instance = '" + this.clClassInstance.Id_class_instance + "'";
                        // Launch delete query
                        int result = conn.DeleteOrUpdate(deleteClassBookingQuery);
                        // Check delete result
                        if (result > 0)
                        {
                            MessageBox.Show("The attendant has been removed from this class instance!");
                            vLoadMemberList();
                        }
                        else
                        {
                            MessageBox.Show("There was a problem updating the class booking information, please check your data!");
                            return;
                        }
                    }
                }
                // If this member list was launched from main menu just create an edit member form
                else
                {
                    frm_member frmMember = new frm_member(id_member, this);
                    frmMember.ShowDialog();
                }
            }catch(Exception)
            {
                return;
            }
        }
예제 #7
0
 /**
   * @desc Executes when the Add Member button is clicked
   * It invokes the frm_member panel for adding a new member
   * @params [none] No input parameter.
   * @return [none] No directly returned data.
   */
 private void button_addNewMember_Click(object sender, EventArgs e)
 {
     frm_member frmMember = new frm_member(this);
     frmMember.ShowDialog();
 }