Пример #1
0
        private void Submit(OrderArgs or)
        {
            IUser        UserServices  = new UserServices();
            int          performanceID = or.PerformanceID;
            UserOrderDTO NewOrder      = new UserOrderDTO();

            NewOrder.PerformanceID = performanceID;
            Guid UserID = UserServices.GetUserID(or.UserName);

            NewOrder.UserID        = UserID;
            NewOrder.NumberOfSeats = or.NumberOfSeats;
            NewOrder.TotalPrice    = or.TotalPrice;
            UserOrderDTO OrderOut = new UserOrderDTO();

            OrderOut = UserServices.CreateOrder(NewOrder);
            if (OrderOut.isValid)
            {
                this.PaymentView.Model.ValidOrder = string.Format("The order was processed correctely, your order number: {0}, Enjoy the movie.",
                                                                  OrderOut.OrderID.ToString());
                this.PaymentView.Model.IsValidOrder = true;
            }
            else
            {
                this.PaymentView.Model.ValidOrder   = string.Format("The order was not saved, please try again or contact cutomer service.");
                this.PaymentView.Model.IsValidOrder = false;
            }
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                if (txbCreditCardNumber.Text.Length < 16 || ddlMonth.SelectedValue.Equals("0") || ddlYear.SelectedValue.Equals("0"))
                {
                    ValidatorEmptyText.IsValid = false;
                    throw new Exception();
                }
                else
                {
                    if (this.Submit != null)
                    {
                        OrderArgs or = new OrderArgs();
                        or.NumberOfSeats = int.Parse(txtTicketsAmount.Text);
                        or.PerformanceID = int.Parse(this.PerformanceID);
                        or.TotalPrice = decimal.Parse(txtTotal.Text);
                        or.UserName = System.Web.HttpContext.Current.User.Identity.Name;

                        Submit(or);

                        if (this.Model.IsValidOrder)
                        {
                            lblOrderDetails.Text = this.Model.ValidOrder;
                            lblOrderDetails.BackColor = Color.LightGreen;
                            lblOrderDetails.Focus();
                            btnSubmit.Enabled = false;
                        }
                        else
                        {
                            lblOrderDetails.Text = this.Model.ValidOrder;
                            lblOrderDetails.BackColor = Color.OrangeRed;
                            lblOrderDetails.Focus();
                        }

                    }

                }

            }
            catch { }
        }
Пример #3
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                if (txbCreditCardNumber.Text.Length < 16 || ddlMonth.SelectedValue.Equals("0") || ddlYear.SelectedValue.Equals("0"))
                {
                    ValidatorEmptyText.IsValid = false;
                    throw new Exception();
                }
                else
                {
                    if (this.Submit != null)
                    {
                        OrderArgs or = new OrderArgs();
                        or.NumberOfSeats = int.Parse(txtTicketsAmount.Text);
                        or.PerformanceID = int.Parse(this.PerformanceID);
                        or.TotalPrice    = decimal.Parse(txtTotal.Text);
                        or.UserName      = System.Web.HttpContext.Current.User.Identity.Name;

                        Submit(or);

                        if (this.Model.IsValidOrder)
                        {
                            lblOrderDetails.Text      = this.Model.ValidOrder;
                            lblOrderDetails.BackColor = Color.LightGreen;
                            lblOrderDetails.Focus();
                            btnSubmit.Enabled = false;
                        }
                        else
                        {
                            lblOrderDetails.Text      = this.Model.ValidOrder;
                            lblOrderDetails.BackColor = Color.OrangeRed;
                            lblOrderDetails.Focus();
                        }
                    }
                }
            }
            catch { }
        }
Пример #4
0
 private void Submit(OrderArgs or)
 {
     IUser UserServices = new UserServices();
     int performanceID = or.PerformanceID;
     UserOrderDTO NewOrder = new UserOrderDTO();
     NewOrder.PerformanceID = performanceID;
     Guid UserID = UserServices.GetUserID(or.UserName);
     NewOrder.UserID = UserID;
     NewOrder.NumberOfSeats = or.NumberOfSeats;
     NewOrder.TotalPrice = or.TotalPrice;
     UserOrderDTO OrderOut = new UserOrderDTO();
     OrderOut = UserServices.CreateOrder(NewOrder);
     if (OrderOut.isValid)
     {
         this.PaymentView.Model.ValidOrder = string.Format("The order was processed correctely, your order number: {0}, Enjoy the movie.",
             OrderOut.OrderID.ToString());
         this.PaymentView.Model.IsValidOrder = true;
     }
     else
     {
         this.PaymentView.Model.ValidOrder = string.Format("The order was not saved, please try again or contact cutomer service.");
         this.PaymentView.Model.IsValidOrder = false;
     }
 }