Esempio n. 1
0
        // [Member Form - Create Button codes]
        private void buttonCreateMembers_Click(object sender, EventArgs e)
        {
            // Form Obj initialisation
            DataChecker datacheck = new DataChecker();

            //Form vairables initialisation
            labelWarningMemberForm.Visible = false;
            string NUSID      = this.textBoxInfoNusIDMembers.Text.Trim().ToUpper();
            string MemberType = MemberTypeCheck();
            string Name       = this.textBoxNameMembers.Text.Trim();
            int    Mobile     = MobileNumCheck(datacheck, this.textBoxPhoneMembers.Text.Trim());
            string Email      = this.textBoxEmailMembers.Text.Trim();

            NUSIDCheck(datacheck, NUSID);

            // Member creation - using warning label as bool flag decider
            if (labelWarningMemberForm.Visible == false)
            {
                Member NewMember = new Member
                {
                    NUSID = NUSID, MemberType = MemberType, Name = Name, Mobile = Mobile, Email = Email
                };
                CreateMember(NewMember);
            }
        }
Esempio n. 2
0
        // [Member Form - Update Button codes]

        private void buttonConfirmChangesMembers_Click(object sender, EventArgs e)
        {
            DataChecker datacheck = new DataChecker();

            labelWarningMemberForm.Visible = false;
            string NUSID      = this.textBoxInfoNusIDMembers.Text.Trim().ToUpper();
            string MemberType = MemberTypeCheck();
            string Name       = this.textBoxNameMembers.Text.Trim();
            int    Mobile     = MobileNumCheck(datacheck, this.textBoxPhoneMembers.Text.Trim());
            string Email      = this.textBoxEmailMembers.Text.Trim();

            NUSIDCheck(datacheck, NUSID);

            // using warning label as bool flag decider
            if (labelWarningMemberForm.Visible == false)
            {
                Member NewMember = new Member
                {
                    NUSID = NUSID, MemberType = MemberType, Name = Name, Mobile = Mobile, Email = Email
                };
                bool flag = DeleteMember(NUSID);
                if (flag == true)
                {
                    CreateMember(NewMember);
                }
                ((MAIN)MdiParent).UpdateStatusLabel("Member record successfully updated");
            }
        }
Esempio n. 3
0
 private void NUSIDCheck(DataChecker datacheck, string NUSID)
 {
     if (datacheck.NUSIDVerification(NUSID) == false)
     {
         labelInfoNusIDMembers.ForeColor = System.Drawing.Color.Red;
         labelInfoNusIDMembers.Text      = "*NUS ID:";
         textBoxInfoNusIDMembers.Text    = "Enter in the format of A123456B";
         labelWarningMemberForm.Visible  = true;
     }
     else
     {
         labelInfoNusIDMembers.ForeColor = System.Drawing.Color.Black;
         labelInfoNusIDMembers.Text      = "NUS ID:";
     }
 }
Esempio n. 4
0
        // [Member Form - Delete Button codes]
        private void buttonDeleteMembers_Click(object sender, EventArgs e)
        {
            // Form Obj initialisation
            DataChecker datacheck = new DataChecker();

            labelWarningMemberForm.Visible = false;
            string NUSID = this.textBoxInfoNusIDMembers.Text.Trim().ToUpper();

            NUSIDCheck(datacheck, NUSID);

            if (labelWarningMemberForm.Visible == false)
            {
                DeleteMember(NUSID);
            }
        }
Esempio n. 5
0
        // Button will activate search base on NUSID / TransID
        private void buttonSearchDeleteBooking_Click(object sender, EventArgs e)
        {
            this.labelWarning.Visible = false;
            this.labelNusIDDeleteBooking.ForeColor = System.Drawing.Color.Black;
            DataChecker datacheck = new DataChecker();

            if (this.radioButtonNUSIDDeleteBooking.Checked == true)
            {
                SearchByNUSID(datacheck);
            }
            else
            {
                SearchByTransID(datacheck);
            }
        }
Esempio n. 6
0
        // [Member Form - Data Integrity Checking codes]

        private int MobileNumCheck(DataChecker datacheck, string Mobile)
        {
            if (datacheck.PositiveIntCheck(Mobile) == false)
            {
                labelInfoPhoneMembers.ForeColor = System.Drawing.Color.Red;
                labelInfoPhoneMembers.Text      = "*Phone Number:";
                textBoxPhoneMembers.Text        = "Only local phone number w/o +";
                labelWarningMemberForm.Visible  = true;
                return(0);
            }
            else
            {
                labelInfoPhoneMembers.ForeColor = System.Drawing.Color.Black;
                labelInfoPhoneMembers.Text      = "Phone Number:";
                return(Convert.ToInt32(Mobile));
            }
        }
Esempio n. 7
0
        // Query based on NUSID
        private void SearchByNUSID(DataChecker datacheck)
        {
            string searchinput = this.textBoxNusIDDeleteBooking.Text.Trim().ToUpper();

            try
            {
                SA46Team09BEntities context = new SA46Team09BEntities();
                var querySearchByNUSID      = from x in context.Transactions where x.NUSID.Contains(searchinput) && x.CancelRef == 0 select x;
                List <Transaction> ViewTransactionByNUSID = querySearchByNUSID.ToList <Transaction>();
                dataGridViewDeleteBooking.DataSource = ViewTransactionByNUSID;
            }
            catch
            {
                MessageBox.Show("Connection fail. Please try again.");
                ((MAIN)MdiParent).UpdateStatusLabel("Error encounter in last transaction...");
            }
        }
Esempio n. 8
0
        /* Button triggers the booking. Button can only be enable when a time slot element is CLICKED.
         * Otherwise, it is disabled (disabled at load of screen and after a booking)
         */
        private void buttonConfirmBooking_Click(object sender, EventArgs e)
        {
            string NUSID = this.textBoxNUSIDBooking.Text;

            this.labelWarning.Visible        = false;
            this.labelNUSIDBooking.ForeColor = System.Drawing.Color.Black;
            this.labelNUSIDBooking.Text      = "NUSID";
            DataChecker datacheck = new DataChecker();

            if (datacheck.NUSIDVerification(NUSID) == false)
            {
                this.labelWarning.Visible        = true;
                this.labelNUSIDBooking.ForeColor = System.Drawing.Color.Red;
                this.labelNUSIDBooking.Text      = "*NUSID";
            }
            else
            {
                BookingCreation(NUSID);
            }
            resetscreen();
        }
Esempio n. 9
0
        // Query based on Transaction ID
        private void SearchByTransID(DataChecker datacheck)
        {
            string searchinput = this.textBoxNusIDDeleteBooking.Text.Trim();

            if (datacheck.PositiveIntCheck(searchinput) == true)
            {
                SA46Team09BEntities context = new SA46Team09BEntities();
                int searchinputint          = Convert.ToInt32(searchinput);
                var querySearchByTransID    = from x in context.Transactions where x.TransactionID == searchinputint && x.CancelRef == 0 select x;
                List <Transaction> ViewTransactionByTransID = querySearchByTransID.ToList <Transaction>();
                dataGridViewDeleteBooking.DataSource = ViewTransactionByTransID;
                ((MAIN)MdiParent).UpdateStatusLabel("Query Completed");
            }
            else
            {
                this.labelWarning.Visible = true;
                this.labelNusIDDeleteBooking.ForeColor = System.Drawing.Color.Red;
                this.labelWarning.Text = "Please enter only positive integers for Transaction ID";
                ((MAIN)MdiParent).UpdateStatusLabel("Error encounter in last transaction...");
            }
        }