예제 #1
0
        /**
          * @desc Constructor for editing an existing member.
          * (To be able to refresh member list after saving the edited member)
          * @params [int] id_member: identifies the member to modify
          * @params [frm_member_list] frmMemberList: by taking this parameter there will be a reference
          * to the member list so it can be refreshed after saving the edited member
          * @return [none] No directly returned data.
          */
        public frm_member(int id_member, frm_member_list frmMemberList)
        {
            InitializeComponent();
            // Create reference to the parent form
            this.frmMemberList = frmMemberList;
            // Load in member details for specified member
            clMember = new Member(id_member);

            button_equipmentbooking.Show();
            button_payments.Show();
            button_remove.Show();
            button_saveOpen.Hide();

            if (clMember.Id_member < 1)
                MessageBox.Show("The member could not be found");
            else
            {
                // If the member was found, load in all member details into member object from database
                vLoadBookedList();
                 txt_firstName.Text = clMember.FirstName;
                 txt_lastName.Text = clMember.LastName;
                 chk_active.Checked = clMember.IsActive;
                 txt_dob.Text = Utils.sGetCsharpDateFromMysqlDate(clMember.Birthdate);
                 txt_address1.Text = clMember.Address_1;
                 txt_address2.Text = clMember.Address_2;
                 txt_city.Text = clMember.City;
                 txt_county.Text = clMember.County;
                 txt_emerg_mobile.Text = clMember.EmergContactMobile;
                 txt_emerg_name.Text = clMember.EmergContactName;
                 txt_emerg_telephone.Text = clMember.EmergContactPhone;
                 txt_emerg_relation.Text = clMember.EmergContactRelation;
                 txt_allergies.Text = clMember.MedicalAllergies;
                 txt_doctor_name.Text = clMember.MedicalDoctorName;
                 txt_medical_notes.Text = clMember.MedicalNotes;
                 txt_doctor_phone.Text = clMember.MedicalPhone;
                 txt_membernum.Text = clMember.Id_member.ToString();
                 txt_pc.Text = clMember.PostalCode;
                 cmb_type.Text = clMember.Type;
                 txt_email.Text = clMember.Email;
                 txt_mobile.Text = clMember.Mobile;
                 txt_telephone.Text = clMember.Phone;
                 txt_sid.Text = clMember.Sid;
                 txt_stcardnumber.Text = clMember.StudCardNumber;

                 // Create mysql connection
                mySqlConn conn = new mySqlConn();
                 conn.connect();
                // If there is a corresponing picture for this member, then load it in,
                // else show default image, depending on gender
                 if (clMember.Gender == "male")
                 {
                     rd_male.Checked = true;
                     if (clMember.Id_file == "")
                     {
                         this.pictureBox1.BackgroundImage = global::Gym_administration.Properties.Resources.member_male_128;
                     }
                     else
                     {

                         pictureBox1.Image = conn.loadImageFromDB(clMember.Id_file);
                     }
                 }
                 else
                 {
                     rd_female.Checked = true;
                     if (clMember.Id_file == "")
                     {
                         this.pictureBox1.BackgroundImage = global::Gym_administration.Properties.Resources.member_female_128;
                     }
                     else
                     {
                         pictureBox1.Image = conn.loadImageFromDB(clMember.Id_file);
                     }
                 }

            }
        }