Ejemplo n.º 1
0
        protected void btnOrder_Click(object sender, EventArgs e)
        {
            if (IsValid)
            {//Convert.ToInt32(lstProducts.SelectedValue), Convert.ToInt32(txtPrice.Text), 1)
                sessionCust = (Customer)Session["CustObj"];
                newProduct  = new StandardProduct(Convert.ToInt32(lstProducts.SelectedValue), Convert.ToDouble(txtPrice.Text), lstProducts.SelectedItem.Text, 1);
                ProductDiscount pd = new ProductDiscount(newProduct);
                if (sessionCust != null)
                {
                    Response.Write("Calculating Individual Product DIscount - " + pd.applyDiscount() + "/" + newProduct.Price + " Pid = " + newProduct.ProductID + "\n");
                    newOrder = new Order(
                        sessionCust.CustomerID,
                        newProduct,
                        1,
                        txtAddress.Text,
                        pd.applyDiscount() * Convert.ToInt32(txtQuantity.Text),
                        DateTime.Now);
                    newOrder.CreateOrder();

                    Response.Write("Order processed!!\n\n\n\n");
                    btnOrder.Enabled     = false;
                    btnAddOrder.Enabled  = true;
                    btnViewOrder.Enabled = true;
                    Response.Write("Calculating Customer Discount - " + newOrder.Amount +
                                   "/" + (Convert.ToDouble(txtPrice.Text) * Convert.ToInt32(txtQuantity.Text)) + "\n");
                    Session["OrderObj"] = newOrder;
                }
                else
                {
                    Response.Write("No customer is in session, please log in");
                }
            }
        }
Ejemplo n.º 2
0
        protected void btnAddProduct_Click(object sender, EventArgs e)
        {
            //Customer cust = (Customer) Session["CustomerOBJ"];
            if (newOrder != null)
            {
                newProduct = new StandardProduct(Convert.ToInt32(lstProducts.SelectedValue), Convert.ToDouble(txtPrice.Text), lstProducts.SelectedItem.Text, 1);
                ProductDiscount pd = new ProductDiscount(newProduct);
                Response.Write("Calculating Individual Product DIscount - " + pd.applyDiscount() + "/" + newProduct.Price + " Pid = " + newProduct.ProductID + "\n");

                newOrder.AddProduct(
                    newProduct.ProductID,
                    pd.applyDiscount() * Convert.ToInt32(txtQuantity.Text));
                Response.Write("Product processed!!\n \n ");
                Response.Write("Calculating Customer Discount - " + newOrder.Amount +
                    "/" + (Convert.ToDouble(txtPrice.Text) * Convert.ToInt32(txtQuantity.Text)) + "\n");
            }
            else
                Response.Write("new order is null????");
        }
Ejemplo n.º 3
0
        protected void btnAddProduct_Click(object sender, EventArgs e)
        {
            //Customer cust = (Customer) Session["CustomerOBJ"];
            if (newOrder != null)
            {
                newProduct = new StandardProduct(Convert.ToInt32(lstProducts.SelectedValue), Convert.ToDouble(txtPrice.Text), lstProducts.SelectedItem.Text, 1);
                ProductDiscount pd = new ProductDiscount(newProduct);
                Response.Write("Calculating Individual Product DIscount - " + pd.applyDiscount() + "/" + newProduct.Price + " Pid = " + newProduct.ProductID + "\n");

                newOrder.AddProduct(
                    newProduct.ProductID,
                    pd.applyDiscount() * Convert.ToInt32(txtQuantity.Text));
                Response.Write("Product processed!!\n \n ");
                Response.Write("Calculating Customer Discount - " + newOrder.Amount +
                               "/" + (Convert.ToDouble(txtPrice.Text) * Convert.ToInt32(txtQuantity.Text)) + "\n");
            }
            else
            {
                Response.Write("new order is null????");
            }
        }
Ejemplo n.º 4
0
        protected void btnOrder_Click(object sender, EventArgs e)
        {
            if (IsValid)
            {//Convert.ToInt32(lstProducts.SelectedValue), Convert.ToInt32(txtPrice.Text), 1)
                sessionCust = (Customer)Session["CustObj"];
                newProduct = new StandardProduct(Convert.ToInt32(lstProducts.SelectedValue), Convert.ToDouble(txtPrice.Text), lstProducts.SelectedItem.Text, 1);
                ProductDiscount pd = new ProductDiscount(newProduct);
                if (sessionCust != null)
                {
                    Response.Write("Calculating Individual Product DIscount - " + pd.applyDiscount() + "/" + newProduct.Price + " Pid = " + newProduct.ProductID + "\n");
                    newOrder = new Order(
                    sessionCust.CustomerID,
                    newProduct,
                    1,
                    txtAddress.Text,
                    pd.applyDiscount() * Convert.ToInt32(txtQuantity.Text),
                    DateTime.Now);
                    newOrder.CreateOrder();

                    Response.Write("Order processed!!\n\n\n\n");
                    btnOrder.Enabled = false;
                    btnAddOrder.Enabled = true;
                    btnViewOrder.Enabled = true;
                    Response.Write("Calculating Customer Discount - " + newOrder.Amount +
                        "/" + (Convert.ToDouble(txtPrice.Text) * Convert.ToInt32(txtQuantity.Text)) + "\n");
                    Session["OrderObj"] = newOrder;
                }
                else
                    Response.Write("No customer is in session, please log in");

            }
        }