Exemplo n.º 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            string operation = "Points Redeemed";

            rb.ReceiptNo      = "NONE";
            rb.BillAmount     = 0.00;
            rb.PointsAdded    = 0.00;
            rb.Operation      = operation;
            rb.PointsRedeemed = double.Parse(txtRedeemAmount.Text.Trim());
            rb.CustomerID     = txtCustomerID.Text.Trim();
            rb.date           = DateTime.Now.ToString();

            string balance = cd.CustomerIDandPointsAvailable(txtCustomerID.Text.Trim(), cb.PointsAvailable.ToString());

            if (rb.PointsRedeemed > double.Parse(balance))
            {
                MessageBox.Show("ERROR!! Insufficient Points Balance");
                return;
            }

            else
            {
                bool success = rd.RedeemPoints(rb);

                if (success == true)
                {
                    MessageBox.Show("Point Successfully Redeemed");
                }
                else
                {
                    MessageBox.Show("Failed to Redeem Points. Something went Wrong");
                }
            }
        }