void Add()
        {
            //create an instance of the Inventory Collenction
            clsPaymentCollection AllPayments = new clsPaymentCollection();
            //validate the data on the web form
            string Error = AllPayments.ThisPayment.Valid(txtPayeeName.Text, Convert.ToString(comboBoxMethod.SelectedItem), txtAmount.Text, txtCardNumber.Text, txtDatePurchased.Text, txtEmail.Text);

            //if the data is OK then add it to the object
            if (Error == "")
            {
                //get the data entered by the user
                AllPayments.ThisPayment.PayeeName     = txtPayeeName.Text;
                AllPayments.ThisPayment.Amount        = Convert.ToDecimal(txtAmount.Text);
                AllPayments.ThisPayment.Method        = Convert.ToString(comboBoxMethod.Text);
                AllPayments.ThisPayment.DatePurchased = Convert.ToDateTime(txtDatePurchased.Text);
                AllPayments.ThisPayment.Email         = txtEmail.Text;
                AllPayments.ThisPayment.CardNumber    = Convert.ToString(txtCardNumber.Text);


                //add the record
                AllPayments.Add();
                //all done so redirect back to the main page
                PaymentManageForm PM = new PaymentManageForm();
                this.Hide();
                PM.ShowDialog();
                this.Close();
            }
            else
            {
                //report an error
                lblError.Text = "Following Errors : " + Error;
            }
        }
        private void btnManagePayment_Click(object sender, EventArgs e)
        {
            PaymentManageForm PM = new PaymentManageForm();

            this.Hide();
            PM.ShowDialog();
            this.Close();
        }
Пример #3
0
        private void btnNo_Click(object sender, EventArgs e)
        {
            //Redirect to the Payment Manage Form
            PaymentManageForm PM = new PaymentManageForm();

            this.Hide();
            PM.ShowDialog();
            this.Close();
        }
Пример #4
0
        private void btnYes_Click(object sender, EventArgs e)
        {
            string            message = "The Payment has been deleted successfully.";
            string            caption = "Deletion Confirmation";
            DialogResult      result;
            MessageBoxButtons button = MessageBoxButtons.OK;

            result = MessageBox.Show(message, caption, button);

            if (result == DialogResult.OK)
            {
                //delete the record
                DeleteInventory();
                //All Done so Redirect to the previous Form
                PaymentManageForm PM = new PaymentManageForm();
                this.Hide();
                PM.ShowDialog();
                this.Close();
            }
        }
        public void Update()
        {
            //create an instance of the Inventory Collection
            clsPaymentCollection AllPayments = new clsPaymentCollection();
            //validate the data on the Windows Form
            string Error = AllPayments.ThisPayment.Valid(txtPayeeName.Text, Convert.ToString(comboBoxMethod.SelectedItem), txtAmount.Text, txtCardNumber.Text, txtDatePurchased.Text, txtEmail.Text);

            //if the data is OK then add it to the object
            if (Error == "")
            {
                //find the record to UPDATE
                AllPayments.ThisPayment.Find(mPaymentId);

                //get the data entered by the user
                AllPayments.ThisPayment.PayeeName     = txtPayeeName.Text;
                AllPayments.ThisPayment.Amount        = Convert.ToDecimal(txtAmount.Text);
                AllPayments.ThisPayment.Method        = Convert.ToString(comboBoxMethod.Text);
                AllPayments.ThisPayment.DatePurchased = Convert.ToDateTime(txtDatePurchased.Text);
                AllPayments.ThisPayment.Email         = txtEmail.Text;
                AllPayments.ThisPayment.CardNumber    = Convert.ToString(txtCardNumber.Text);



                //UPDATE the record
                AllPayments.Update();
                //All Done so Redirect to the previous Form
                PaymentManageForm PM = new PaymentManageForm();
                this.Hide();
                PM.ShowDialog();
                this.Close();
            }
            else
            {
                lblError.Text = "There were problems with the data entered: " + Error;
            }
        }
        private void btnOK_Click(object sender, EventArgs e)
        {
            clsPaymentCollection AllPayments = new clsPaymentCollection();
            string            Error          = AllPayments.ThisPayment.Valid(txtPayeeName.Text, Convert.ToString(comboBoxMethod.SelectedItem), txtAmount.Text, txtCardNumber.Text, txtDatePurchased.Text, txtEmail.Text);
            string            message        = "Are you sure to Update the existing Payment details?";
            string            caption        = "User Confirmation!";
            MessageBoxButtons buttons        = MessageBoxButtons.YesNo;
            DialogResult      result;

            //Displays the MessageBox

            //if there are no Errors returned
            if (Error == "")
            {
                //show the Message box
                result = MessageBox.Show(message, caption, buttons);

                //if "Yes" is pressed
                if (result == DialogResult.Yes)
                {
                    //execute the Update method
                    Update();

                    //All Done so Redirect to the previous Form
                    PaymentManageForm PM = new PaymentManageForm();
                    this.Hide();
                    PM.ShowDialog();
                    this.Close();
                }
            }
            else
            {
                //report an error
                lblError.Text = "There were problems with the data entered : " + Error;
            }
        }