Esempio n. 1
0
        private void btnAddMember_Click(object sender, EventArgs e)
        {
            try
            {
                if (validate_aerobicMember())
                {
                    Buisness_Logic.AreobicMemberRepository areorep = new Buisness_Logic.AreobicMemberRepository();
                    Buisness_Logic.AreobicMember           areo    = new Buisness_Logic.AreobicMember();


                    areo.name         = txtOS2_memName.Text;
                    areo.addresss     = txtaddress.Text;
                    areo.nic          = txtOS2_nic.Text;
                    areo.phone        = txtOS2_phone.Text;
                    areo.gender       = cmbOS2_gender.SelectedItem.ToString();
                    areo.service_type = cmbOS2_serviceType.SelectedItem.ToString();
                    areo.dob          = string.Format("{0:M/d/yyyy}", dateTime_OS2Mem.Value.ToShortDateString());


                    if (alreadyMember == true)
                    {
                        areo.MemberID = int.Parse(txtOS2_memId.Text);
                        if (areorep.addOtherMembers_Exist(areo))
                        {
                            MessageBox.Show("Success", "Data Insertion", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                        {
                            MessageBox.Show("Failed.", "Data Insertion", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                    else
                    {
                        if (areorep.addOtherMembers_notExist(areo))
                        {
                            MessageBox.Show("Success", "Data Insertion", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                        {
                            MessageBox.Show("Failed.", "Data Insertion", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
            }
            catch (Exception exaeo)
            {
                MessageBox.Show(exaeo.Message, "Data Insertion", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }