Esempio n. 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (int.TryParse(Request.QueryString["Id"], out var id))
     {
         var order    = DataUtilityClass.SelectOrderById(id);
         var customer = DataUtilityClass.SelectCustomerById(order.CustId);
         if (customer != null)
         {
             tbxCustId.Text     = customer.Id.ToString();
             tbxName.Text       = customer.First + " " + customer.Last;
             tbxOrder.Text      = "";
             tbxOrder.Text     += order.Prod1Qty > 0 ? order.Prod1Qty + "  Cheese Pizza $11.99 ea\n" : "";
             tbxOrder.Text     += order.Prod2Qty > 0 ? order.Prod2Qty + "  Stromboli $8.99 ea\n" : "";
             tbxOrder.Text     += order.Prod3Qty > 0 ? order.Prod3Qty + "  Hot Chicken Wings (dozen) $9.99 ea\n" : "";
             tbxOrder.Text     += order.Prod4Qty > 0 ? order.Prod4Qty + "  BBQ Chicken Wings (dozen) $9.99 ea\n" : "";
             tbxOrder.Text     += order.Prod5Qty > 0 ? order.Prod5Qty + "  Spaghetti Dinner $11.99 ea\n" : "";
             tbxOrder.Text     += order.Prod6Qty > 0 ? order.Prod6Qty + "  Salad $9.99 ea" : "";
             tbxDate.Text       = order.OrderDate;
             tbxTime.Text       = order.OrderTime;
             tbxSubtotal.Text   = order.SubTotal.ToString("C");
             tbxTax.Text        = order.TaxAmt.ToString("C");
             tbxGrandTotal.Text = order.GrandTotal.ToString("C");
         }
         else
         {
             Response.Redirect("CustomerViewAll.aspx");
         }
     }
     else
     {
         Response.Redirect("CustomerViewAll.aspx");
     }
 }
Esempio n. 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (int.TryParse(Request.QueryString["Id"], out var id))
     {
         var customer = DataUtilityClass.SelectCustomerById(id);
         if (customer != null)
         {
             tbxId.Text            = id.ToString();
             tbxFirstName.Text     = customer.First;
             tbxLastName.Text      = customer.Last;
             tbxStreetAddress.Text = customer.Street;
             tbxCity.Text          = customer.City;
             tbxState.Text         = customer.State;
             tbxZipCode.Text       = customer.Zip;
             tbxPhoneNumber.Text   = customer.Phone;
             tbxPhoneType.Text     = customer.PhoneType;
         }
         else
         {
             Response.Redirect("CustomerViewAll.aspx");
         }
     }
     else
     {
         Response.Redirect("CustomerViewAll.aspx");
     }
 }
Esempio n. 3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (DataUtilityClass.SelectOrderCount() == 0)
     {
         lblTableInformation.Text = "No orders have been added.";
         gvOrders.Visible         = false;
     }
     else
     {
         lblTableInformation.Text = "Order List";
     }
 }
Esempio n. 4
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            var custId    = Convert.ToInt32(DDCustomer.SelectedValue);
            var orderdate = DateTime.Today.ToShortDateString();
            var ordertime = DateTime.Now.ToShortTimeString();

            DataUtilityClass.InsertOrder(
                new Order(Convert.ToInt32(custId), orderdate, ordertime, _prod1Qty, _prod2Qty, _prod3Qty, _prod4Qty, _prod5Qty, _prod6Qty, _subTotal, _taxAmt, _grandTotal));
            lblNotification.Text      = "Order is successfully sumited.";
            lblNotification.ForeColor = Color.Green;
            lblNotification.Visible   = true;
            Reset();
        }
Esempio n. 5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         var customerList = DataUtilityClass.SelectAllCustomers();
         foreach (var customer in customerList)
         {
             DDCustomer.Items.Add(new ListItem(customer.Id + ": " + customer.First + " " + customer.Last,
                                               customer.Id.ToString()));
         }
     }
     Page.MaintainScrollPositionOnPostBack = true;
 }
Esempio n. 6
0
        protected void btnAddCustomer_Click(object sender, EventArgs e)
        {
            ClearError();
            if (!FieldsIsValid())
            {
                return;
            }
            var firstName     = UppercaseFirstLetterPerWord(tbxFirstName.Text);
            var lastName      = UppercaseFirstLetterPerWord(tbxLastName.Text);
            var streetAddress = UppercaseFirstLetterPerWord(tbxStreetAddress.Text);
            var city          = UppercaseFirstLetterPerWord(tbxCity.Text);
            var state         = UppercaseFirstLetterPerWord(tbxState.Text);
            var zipCode       = tbxZipCode.Text;
            var phoneNumber   = tbxPhoneNumber.Text;
            var phoneType     = DDPhoneType.SelectedValue;

            DataUtilityClass.InsertCustomer(
                new Customer(firstName, lastName, streetAddress, city, state, zipCode, phoneNumber, phoneType));
            lblNotification.Visible = true;
            ClearFields();
        }