protected void Page_Load(object sender, EventArgs e)
        {
            // instantiate object for access to methods //
            clsCustomers c = new clsCustomers();

            // bool placeholder to check if user is registered //
            bool checkCC;

            if (Session["customerID"] == null)
            {
                // redirect if account hasn't been created // 
                Response.Redirect("~/Register.aspx");

            } /* end if{} */
            else
            {
                // grab the ID inside the session and pass it for verification //
                checkCC = c.checkCCInfoAdded(Convert.ToInt32(Session["customerID"]));

                if (checkCC)
                {
                    // if credit card info is registered enable upload button //
                    btnUpload.Visible = true;
                    lnkCCInfo.Visible = false;
                }
                else
                {
                    // disable upload button if credit is not registered
                    btnUpload.Visible = false;
                    lblCCInfo.Visible = true;
                    lnkCCInfo.Visible = true;
                }

            } /* end else{} */
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // instantiate object for access to methods //
            clsCustomers c = new clsCustomers();

            // variable to store the product's ID //
            int itemName = Convert.ToInt32(Request.QueryString["productType"]);

            // pass the product ID to database to get product name //
            string item = c.getDdlProductName(itemName);

            // retrive and set name of product to label //
            lblPoduct.Text = item;

            // get url parameters and assign them to corresponding labels //
            lblQuantity.Text    = Request.QueryString["qty"];
            lblTextDesc.Text    = Request.QueryString["desc"];
            lblCostPerItem.Text = Request.QueryString["itemCost"];

            // convert url parameters to allow for multiplying total cost //
            int     ttlAmtItems = Convert.ToInt32(Request.QueryString["qty"]);
            decimal costPerItem = Convert.ToDecimal(Request.QueryString["itemCost"]);

            // set cost of item * quantity to label //
            lblTotalCost.Text = (ttlAmtItems * costPerItem).ToString();


            //get the file path and name
            //string file = FileUpload1.PostedFile.FileName;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            // instantiate objects for method access //
            clsDataLayer c = new clsDataLayer();
            clsCustomers p = new clsCustomers();

            if (Session["CustomerID"] == null)
            {
                Response.Redirect("~/Customers/CustomerLogin.aspx");
            } /* end if() */

            bool creditCardAdded;

            creditCardAdded = p.checkCCInfoAdded(Convert.ToInt32(Session["CustomerID"]));

            if (!creditCardAdded)
            {
                lblAddCCInfo.Text = "Please click on Account Details below and enter a credit card";
            }

            if (Page.IsPostBack)
            {
                lblAddCCInfo.Visible = false;
            }
        } /* end Page_Load() */
        protected void Page_Load(object sender, EventArgs e)
        {
            // get access to methods from class //
            clsCustomers c = new clsCustomers();

            // get the ID number of the print selection type
            int printType = Convert.ToInt32(Request.QueryString["printType"]);

            // set Selection label to product name //
            string selectionName = c.getDdlProductName(printType);

            lblPaperType.Text = selectionName;

            // set Quantity label to amount ordered //
            lblQty.Text = Request.QueryString["qty"];

            // set Order Total to calculated price //
            decimal pricePage;

            pricePage            = c.getDdlProductCost(printType);
            lblPricePerPage.Text = pricePage.ToString();

            // calculate order total //
            decimal sumTotal;
            int     paperQty = Convert.ToInt32(lblQty.Text);

            sumTotal           = pricePage * paperQty;
            lblOrderTotal.Text = sumTotal.ToString();


            // set Description label to customer text //
            lblDesc.Text = Request.QueryString["desc"];
        } /* end Page_Load() */
Beispiel #5
0
        }     /* end Page_Load() */

        protected void btnUpload_Click(object sender, EventArgs e)
        {
            // instantiate object for access to methods //
            clsCustomers c = new clsCustomers();


            // build url to with parameters set as the customer options //

            Response.Redirect("EngravingConfirmation.aspx?productType=" + ddlProductsList.SelectedValue + "&qty=" + txtQuantity.Text + "&desc=" + TextBox1.Text + "&itemCost=" + lblItemCost.Text);
        }
Beispiel #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            clsCustomers c = new clsCustomers();

            // bool placeholder to check if user is registered //
            bool checkCC;

            if (Session["customerID"] == null)
            {
                // redirect if account hasn't been created //
                Response.Redirect("~/Register.aspx");
            } /* end if{} */
            else
            {
                // grab the ID inside the session and pass it for verification //
                checkCC = c.checkCCInfoAdded(Convert.ToInt32(Session["customerID"]));

                if (checkCC)
                {
                    // if credit card info is registered enable upload button //
                    btnUpload.Visible = true;
                    lnkCCInfo.Visible = false;
                }
                else
                {
                    // disable upload button if credit is not registered
                    btnUpload.Visible = false;
                    lblCCInfo.Visible = true;
                    lnkCCInfo.Visible = true;
                }
            } /* end else{} */



            if (Page.IsPostBack)
            {
                // instantiate object for access to methods //
                //clsCustomers c = new clsCustomers();

                // Update cost of item on selection //
                int ddlPid = Convert.ToInt32(ddlProductsList.SelectedValue);

                //lblPoduct.Text = item;
                lblItemCost.Text = c.getDdlProductCost(ddlPid).ToString();

                //  //
                string urlString = c.getImageUrl(ddlPid);

                string imagePath = urlString;

                Image1.ImageUrl = imagePath;
            } /* end (Page.IsPostBack) */
        }     /* end Page_Load() */
Beispiel #7
0
        protected void btnSubmitOrder_Click(object sender, EventArgs e)
        {
            // instantiate object for access to methods //
            clsCustomers c = new clsCustomers();

            try
            {
                // First enter into orders table //
                // get customerID
                int custID = Convert.ToInt32(Session["customerID"]);

                // set order status to pending for order //
                string status = "pending";

                // submit order to Orders table //
                c.submitOrder(custID, status);

                // 2. get order ID and submit order details
                // variable to store current order ID of order
                int orderNumber;

                // method to access customer's newly placed order //
                orderNumber = c.getOrderedID(custID);

                // convert product ID to int //
                //int itemID = Convert.ToInt32(lblPoduct.Text);

                // variable to store the product's ID //
                int proID = Convert.ToInt32(Request.QueryString["productType"]);

                // get product name by its ID //
                string proName = c.getDdlProductName(proID);

                // get customer quantity //
                int custQty = Convert.ToInt32(lblQuantity.Text);

                // calculate grand total //
                decimal gTotal;
                int     ttlAmtItems = Convert.ToInt32(lblQuantity.Text);
                decimal costPerItem = Convert.ToDecimal(lblCostPerItem.Text);
                gTotal = ttlAmtItems * costPerItem;

                // get/set customer text //
                string description = lblTextDesc.Text;

                string fileUploadNm = " ";


                c.submitOrderDetails(orderNumber, custID, proID, proName, custQty, costPerItem, gTotal, description, fileUploadNm);

                // inform customer that order was submitted and return confirmation and confirmation number (order number) //
                lblOrderSuccess.Text = "Order successfully submitted, confirmation number: " + orderNumber.ToString();

                //
                btnSubmitOrder.Visible = false;
                lnkGoBack.Visible      = false;
                lnkPlaceOrder.Visible  = true;

                // 3.
            }
            catch (Exception ex)
            {
                string error = "Error occurred please try again later.. " + ex.ToString();
                lblError.Text = error;
                //error + ex.ToString();
            }
        } /* btnSubmitOrder_Click() */
        } /* end Page_Load() */

        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            if (FileUpload1.HasFile)
            {
                try
                {
                    // get access to methods from class //
                    clsCustomers c = new clsCustomers();

                    // get customer ID and convert to INT //
                    int custID = Convert.ToInt32(Session["customerID"]);

                    // get the file name in to filename variable and get file extension //
                    string filename  = Path.GetFileName(FileUpload1.FileName);
                    string extension = Path.GetExtension(filename);

                    // get current date/time/second //
                    string getCurrentDate = DateTime.Now.ToString("_yyy-MM-dd-h-mm-tt");

                    // set order status to pending for order //
                    string status = "pending";

                    // submit order to Orders table //
                    c.submitOrder(custID, status);

                    int orderNumber;

                    // method to access customer's newly placed order //
                    orderNumber = c.getOrderedID(custID);

                    // variable to store the product's ID //
                    int proID = Convert.ToInt32(Request.QueryString["printType"]);

                    // get product name by its ID //
                    string proName = c.getDdlProductName(proID);

                    // calculate the grand total //
                    int     ttlAmtItems = Convert.ToInt32(Request.QueryString["qty"]);
                    decimal gTotal;
                    decimal costPerItem = Convert.ToDecimal(lblPricePerPage.Text);
                    gTotal = ttlAmtItems * costPerItem;

                    // get customer quantity //
                    int custQty = ttlAmtItems;

                    // get the customer input text //
                    string description = lblDesc.Text;

                    string fullFileNameAndDate = filename + getCurrentDate + extension;

                    // save the selected file to the specified folder //
                    FileUpload1.SaveAs(Server.MapPath("PrintJobUploads/") + fullFileNameAndDate);


                    // insert order to orderDetails table //
                    c.submitOrderDetails(orderNumber, custID, proID, proName, ttlAmtItems, costPerItem, gTotal, description, fullFileNameAndDate);


                    // get file name for input to database //
                    lblUploadSuccess.Text = "File has been successfully uploaded to: " + filename + getCurrentDate + extension;


                    // inform customer that order was submitted and return confirmation and confirmation number (order number) //
                    lblUploadSuccess.Text = "Order successfully submitted, confirmation number: " + orderNumber.ToString();

                    btnSubmit.Visible     = false;
                    lnkGoBack.Visible     = false;
                    lnkPlaceOrder.Visible = true;
                    FileUpload1.Visible   = false;
                } /* end try{} */

                catch (Exception ex)
                {
                    lblUploadSuccess.Text = "Error occurred: " + ex.ToString();
                } /* end catch{} */
            }     /* end if statement */
        }