private void QuoteBtn_Click(object sender, EventArgs e)
        {
            if (!(is_tbValidate()))
            {
                // Initializes the variables to pass to the MessageBox.Show method.
                string            message = "Some information is missing. Please check again the form.";
                string            caption = "Error Detected in Input";
                MessageBoxButtons buttons = MessageBoxButtons.OKCancel;
                DialogResult      result;

                // Displays the MessageBox.
                result = MessageBox.Show(message, caption, buttons);
                if (result == System.Windows.Forms.DialogResult.Cancel)
                {
                    // Closes the parent form.
                    this.Close();
                }
            }
            else
            {
                if (!(formatValidate()))
                {
                    string            message = "Some information is in invalid format. Please check again.";
                    string            caption = "Invalid Format";
                    MessageBoxButtons buttons = MessageBoxButtons.OKCancel;
                    DialogResult      result;

                    // Displays the MessageBox.
                    result = MessageBox.Show(message, caption, buttons);
                    if (result == System.Windows.Forms.DialogResult.Cancel)
                    {
                        // Closes the parent form.
                        this.Close();
                    }
                }
                else
                {
                    bool parcelTypeResult;
                    if (rbParcel.Checked)
                    {
                        parcelTypeResult = false;
                    }
                    else
                    {
                        parcelTypeResult = true;
                    }

                    ParcelInfo parcelInfo = new ParcelInfo(false, parcelTypeResult, Convert.ToByte(tbPieces.Text), tbContent.Text, Convert.ToDecimal(tbValueofContent.Text),
                                                           Convert.ToSingle(tbWeight.Text), 0, 0);
                    decimal quoteFee = ParcelController.Quote(cbSenderLocation.Text, tbSenderPosCode.Text, cbReceiverLocation.Text, tbReceiverPosCode.Text, parcelInfo, null);
                    price.Text         = Convert.ToString(quoteFee);
                    ConfirmBtn.Enabled = true;
                }
            }
        }
Beispiel #2
0
        protected void QuoteBtn_Click(object sender, EventArgs e)
        {
            string  senderPostcode   = FromPostCode.Text;
            string  senderLocation   = FromLocation.SelectedValue;
            string  receiverPostcode = ToPostCode.Text;
            string  receiverLocation = ToLocation.SelectedValue;
            float   parcelWeight     = Convert.ToSingle(Weight.Text);
            Decimal quotedPrice      = ParcelController.Quote(senderLocation, senderPostcode, receiverLocation, receiverPostcode,
                                                              new Models.ParcelInfo(false, false, 1, "", 0, parcelWeight, 0, 0), null);

            QuotedPrice.Text    = "RM " + quotedPrice.ToString("N2");
            QuotedPrice.Visible = true;
        }
Beispiel #3
0
        protected void QuoteBtn_Click(object sender, EventArgs e)
        {
            Debug.WriteLine("hello");

            try
            {
                decimal PickupPrice = 0, deliveryfee;
                bool    serviceType = true;
                if (LodgeUpBtn.Checked)
                {
                    serviceType = false;
                    PickupPrice = 0;
                }
                else if (PickUpBtn.Checked)
                {
                    serviceType = true;
                    PickupPrice = 5;
                }


                bool parcelType = true;
                if (TypeofParcel.SelectedItem.ToString() == "Parcel")
                {
                    parcelType = false;
                }
                else
                {
                    parcelType = true;
                }

                ParcelInfo parcelInfo = new ParcelInfo(serviceType, parcelType, Convert.ToByte(Pieces.Text), Content.Text, Convert.ToDecimal(ValueofContent.Text),
                                                       Convert.ToSingle(Weight.Text), 0, PickupPrice);

                if (LodgeUpBtn.Checked)
                {
                    deliveryfee = ParcelController.Quote(SenderLocation.Text, SenderPostal.Text, ReceiverLocation.Text, ReceiverPostal.Text, parcelInfo, null);
                }
                else
                {
                    PickUpInfo pickupInfo = new PickUpInfo(Convert.ToDateTime(dbPickUpDate.Text), Convert.ToDateTime(ParcelRTime.Text), remarksNote.Text, true);
                    deliveryfee = ParcelController.Quote(SenderLocation.Text, SenderPostal.Text, ReceiverLocation.Text, ReceiverPostal.Text, parcelInfo, pickupInfo);
                }


                //Response.Redirect("Checkout.aspx");
                HttpContext.Current.Items.Add("DeliveryFee", deliveryfee);
                HttpContext.Current.Items.Add("PickUpFee", PickupPrice);
                HttpContext.Current.Items.Add("SenderName", SenderName.Text);
                HttpContext.Current.Items.Add("SenderContactNo", SenderContactNo.Text);
                HttpContext.Current.Items.Add("IDType", IDType.Text);
                HttpContext.Current.Items.Add("SenderIDNo", SenderIDNo.Text);
                HttpContext.Current.Items.Add("SenderAddress", SenderAdd.Text);
                HttpContext.Current.Items.Add("SenderPostal", SenderPostal.Text);
                HttpContext.Current.Items.Add("SenderLocation", SenderLocation.Text);
                HttpContext.Current.Items.Add("SenderCity", SenderCity.Text);
                HttpContext.Current.Items.Add("SenderState", SenderState.Text);
                HttpContext.Current.Items.Add("SenderEmail", SenderEmail.Text);

                HttpContext.Current.Items.Add("ServiceType", serviceType);
                if (serviceType == true)
                {
                    HttpContext.Current.Items.Add("PickUpDate", dbPickUpDate.Text);
                    HttpContext.Current.Items.Add("PickUpTime", ParcelRTime.Text);
                    HttpContext.Current.Items.Add("Remarks", remarksNote.Text);
                }

                HttpContext.Current.Items.Add("ReceiverName", ReceiverName.Text);
                HttpContext.Current.Items.Add("ReceiverContactNo", ReceiverContactNo.Text);
                HttpContext.Current.Items.Add("ReceiverAddress", ReceiverAdd.Text);
                HttpContext.Current.Items.Add("ReceiverPostal", ReceiverPostal.Text);
                HttpContext.Current.Items.Add("ReceiverLocation", ReceiverLocation.Text);
                HttpContext.Current.Items.Add("ReceiverCity", ReceiverCity.Text);
                HttpContext.Current.Items.Add("ReceiverState", ReceiverState.Text);
                HttpContext.Current.Items.Add("ReceiverEmail", ReceiverEmail.Text);

                HttpContext.Current.Items.Add("ParcelType", parcelType);
                HttpContext.Current.Items.Add("Pieces", Pieces.Text);
                HttpContext.Current.Items.Add("Content", Content.Text);
                HttpContext.Current.Items.Add("ValueofContent", ValueofContent.Text);
                HttpContext.Current.Items.Add("Weight", Weight.Text);
            }
            catch (NullReferenceException)
            {
            }


            try
            {
                Server.Transfer("Checkout.aspx", true);
            }
            catch (ThreadAbortException)
            {
                // Exception ignored: Thread Abort = discontinue processing on the current page
            }
        }