コード例 #1
0
        private void btnOS3_update_Click(object sender, EventArgs e)
        {
            if (validate_aerobicMemberUpdate())
            {
                Buisness_Logic.AreobicMember           areo     = new Buisness_Logic.AreobicMember();
                Buisness_Logic.AreobicMemberRepository areoRepo = new Buisness_Logic.AreobicMemberRepository();

                areo.MemberID = int.Parse(txteditmem_memid.Text);
                areo.name     = txteditmem_name.Text;
                areo.nic      = txteditmem_nic.Text;
                areo.addresss = txteditmem_address.Text;
                areo.phone    = txteditmem_phone.Text;
                //areo.dob = string.Format("{0:M/d/yyyy}", datetimeeditmem.Value.ToShortDateString());
                areo.dob          = datetimeeditmem.Value.ToShortDateString();
                areo.gender       = cmdeditmemGender.SelectedItem.ToString();
                areo.service_type = cmbeditmemserve.SelectedItem.ToString();

                if (areoRepo.updateOtherMembers(areo))
                {
                    MessageBox.Show("Record updated succesfully.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("Record update failed.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
コード例 #2
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);
            }
        }
コード例 #3
0
        private void btnOS3_searchMem_Click(object sender, EventArgs e)
        {
            if (validate_search_areo_tab2())
            {
                try
                {
                    Buisness_Logic.AreobicMemberRepository aerorep = new Buisness_Logic.AreobicMemberRepository();

                    Buisness_Logic.AreobicMember arm = new Buisness_Logic.AreobicMember();

                    int memID = string.IsNullOrWhiteSpace(txteditmem_memid.Text) ? 0 : int.Parse(txteditmem_memid.Text);


                    if (aerorep.searchAerobicMemOnly(memID, txteditmem_name.Text, txteditmem_nic.Text, arm))
                    {
                        if (arm.MemberID == 0)
                        {
                            // clear_Tab2Areaobic();
                        }
                        else
                        {
                            MessageBox.Show("Record found.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            txteditmem_memid.Text         = arm.MemberID.ToString();
                            txteditmem_nic.Text           = arm.nic;
                            datetimeeditmem.Value         = DateTime.Parse(arm.dob);
                            txteditmem_address.Text       = arm.addresss;
                            cmdeditmemGender.SelectedItem = arm.gender;
                            txteditmem_phone.Text         = arm.phone.ToString();
                            cmbeditmemserve.SelectedItem  = arm.service_type;
                            txteditmem_name.Text          = arm.name;
                        }
                    }
                    else
                    {
                        MessageBox.Show("No record found.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                catch (Exception sere)
                {
                    MessageBox.Show(sere.Message, "Data Insertion", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
コード例 #4
0
        private void btnOS3_delete_Click(object sender, EventArgs e)
        {
            try
            {
                int meberID = int.Parse(txteditmem_memid.Text);
                Buisness_Logic.AreobicMemberRepository areRepo = new Buisness_Logic.AreobicMemberRepository();

                if (areRepo.deleteAreobicMem(meberID))
                {
                    MessageBox.Show("Record deleted successfull.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("Record delete failed.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception te)
            {
                MessageBox.Show(te.Message, "Information", MessageBoxButtons.OK, MessageBoxIcon.Error);
                throw;
            }
        }
コード例 #5
0
        private void OtherServices_Load(object sender, EventArgs e)
        {
            Buisness_Logic.AreobicMemberRepository ar = new Buisness_Logic.AreobicMemberRepository();


            dataGrid_osMember.DataSource = ar.searchAerobicMemOnly_for_datagrid();


            //check box


            lblHint1.Visible            = false;
            lblHint2.Visible            = false;
            lbl_hint_nic.Visible        = false;
            btnOS2_searchMember.Visible = false;



            lblHint1.Refresh();
            lblHint2.Refresh();
            btnOS2_searchMember.Refresh();
        }
コード例 #6
0
        private void btn_tab1search_Click(object sender, EventArgs e)
        {
            try
            {
                int memberID;
                string nic, name;

                memberID = string.IsNullOrWhiteSpace(txtM_memID.Text) ? 0 : int.Parse(txtM_memID.Text);
                nic = txtM_nic.Text;
                name = txtM_name.Text;
                Buisness_Logic.AreobicMemberRepository areo = new Buisness_Logic.AreobicMemberRepository();
                Buisness_Logic.AreobicMember arm = new Buisness_Logic.AreobicMember();

                if (areo.searchAerobicMemOnly(memberID, name, nic, arm))
                {
                    MessageBox.Show("The member is already registerd aerobic member.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    // set values to gymMember class
                    txtM_name.Text = arm.name;
                    dateTimePickerMem.Value = DateTime.Parse(arm.dob);
                    cmbM_gender.SelectedItem = arm.gender;
                    txtM_phone.Text = arm.phone;
                    txtM_address.Text = arm.addresss;
                    txtM_nic.Text = arm.nic;
                    

                }
                else
                {
                    MessageBox.Show("No record found.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }

            }
            catch (Exception sd)
            {

                throw;
            }
        }
コード例 #7
0
        private void btnOS2_searchMember_Click(object sender, EventArgs e)
        {
            if (validate_search_areo_tab1())
            {
                try
                {
                    Buisness_Logic.AreobicMemberRepository aerorep = new Buisness_Logic.AreobicMemberRepository();

                    Buisness_Logic.AreobicMember arm = new Buisness_Logic.AreobicMember();
                    int memID = string.IsNullOrWhiteSpace(txtOS2_memId.Text) ? 0 : int.Parse(txtOS2_memId.Text);



                    aerorep.searchAerobicMem(memID, txtOS2_memName.Text, txtOS2_nic.Text, arm);

                    if (arm.MemberID == 0)
                    {
                        clear_add_areoic();
                    }
                    else
                    {
                        txtOS2_memId.Text               = arm.MemberID.ToString();
                        txtOS2_nic.Text                 = arm.nic;
                        dateTime_OS2Mem.Value           = DateTime.Parse(arm.dob);
                        txtaddress.Text                 = arm.addresss;
                        cmbOS2_gender.SelectedItem      = arm.gender;
                        txtOS2_phone.Text               = arm.phone.ToString();
                        cmbOS2_serviceType.SelectedItem = arm.service_type;
                        txtOS2_memName.Text             = arm.name;
                    }
                }
                catch (Exception sere)
                {
                    MessageBox.Show(sere.Message, "Data Insertion", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }