Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // creates object for Business Layer
            BusinessLayer objBAL = new BusinessLayer();

            try
            {
                if (!this.IsPostBack)
                {
                    // Creates list of customers past orders
                    List <Order> objOrders = null;
                    objOrders = objBAL.GetOrdersByCustomerId(Convert.ToInt32(Session["CustomerId"]));

                    if (objOrders != null)
                    {
                        // adds customer orders to the gridview
                        ManageOrdersGridView.DataSource = objOrders;
                        ManageOrdersGridView.DataBind();
                    }
                    else
                    {
                        lblNoOrders.Visible = true;
                    }

                    // edits the values of the status field
                    foreach (GridViewRow row in ManageOrdersGridView.Rows)
                    {
                        // Status
                        if (row.Cells[3].Text == "4")
                        {
                            row.Cells[3].Text = "Cancelled";
                        }
                        else if (row.Cells[3].Text == "3")
                        {
                            row.Cells[3].Text = "Complete";
                        }
                        else if (row.Cells[3].Text == "2")
                        {
                            row.Cells[3].Text = "Validated";
                        }
                        else
                        {
                            row.Cells[3].Text = "Processing";
                        }
                    }
                }
            }
            catch (Exception)
            {
                lblError.Visible = true;
            }
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["SecurityLevel"] == "M" || Session["SecurityLevel"] == "S")
            {
                try
                {
                    // creates object for use
                    BusinessLayer objBAL = new BusinessLayer();

                    if (!this.IsPostBack)
                    {
                        // Binds the GridView
                        List <Order> objOrders = null;
                        objOrders = objBAL.GetAllOpenOrders();

                        ManageOrdersGridView.DataSource = objOrders;
                        ManageOrdersGridView.DataBind();
                    }

                    // edits the values of the status field
                    foreach (GridViewRow row in ManageOrdersGridView.Rows)
                    {
                        // Status
                        if (row.Cells[3].Text == "4")
                        {
                            row.Cells[3].Text = "Cancelled";
                        }
                        else if (row.Cells[3].Text == "3")
                        {
                            row.Cells[3].Text = "Complete";
                        }
                        else if (row.Cells[3].Text == "2")
                        {
                            row.Cells[3].Text = "Validated";
                        }
                        else
                        {
                            row.Cells[3].Text = "Processing";
                        }
                    }
                }
                catch (Exception)
                {
                    lblError.Visible = true;
                }
            }
            else
            {
                Response.Redirect("~/NoAccess.aspx");
            }
        }