Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //Get the logged in user's id
            int client_ID = Convert.ToInt32(Session["LoggedInUser"]);

            //If user is logged in
            if (client_ID > 0)
            {
                //Get the client's invoice/s
                dynamic invoices = SR.GetInvoicebyclient(client_ID);
                //Get the client's delivery detail/s
                dynamic delivery = SR.GetDeliveriesForClient(client_ID);

                string order_date     = "";
                string order_total    = "";
                string order_status   = "";
                string order_tax      = "";
                string order_shipping = "";
                string order_discount = "";
                string order_quantity = "";
                string delivery_name  = "";

                //Get most recent order's details
                foreach (Order_Table i in invoices)
                {
                    order_date     = Convert.ToString(i.Order_date);
                    order_total    = Convert.ToString(i.Order_Total);
                    order_status   = Convert.ToString(i.Order_Status);
                    order_tax      = Convert.ToString(i.Order_Tax);
                    order_shipping = Convert.ToString(i.Order_Shipping);
                    order_discount = Convert.ToString(i.Order_Discount);
                    order_quantity = Convert.ToString(i.Order_Quantity);
                    delivery_name  = delivery.Name;

                    //Display info for most recent order to client.
                    clientOrder_date.Value     = order_date;
                    clientOrder_Status.Value   = order_status;
                    clientOrder_Total.Value    = order_total;
                    clientOrder_Tax.Value      = order_tax;
                    clientOrder_Discount.Value = order_discount;
                    clientOrder_Shipping.Value = order_shipping;
                    clientOrder_Quantity.Value = order_quantity;
                    clientOrder_Delivery.Value = delivery_name;
                }
            }
            //If user is not logged in
            else
            {
                Response.Redirect("Home.aspx");
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            //Get the logged in user's id
            int client_ID = 5 /*Convert.ToInt32(Session["LoggedInUser"])*/;

            //If user is logged in
            if (client_ID > 0)
            {
                //Get the client's invoice/s
                dynamic allInvoices = SR.GetInvoicebyclient(client_ID);
                //Get client's details
                var    user           = SR.GetUser(client_ID);
                string displayInvoice = "";

                //Loop through all the invoices
                foreach (Order_Table i in allInvoices)
                {
                    //Get one invoice based off id
                    Order_Table invoice = SR.GetInvoice(i.Order_Id);

                    displayInvoice += "<tr><td class='name'>" + user.Name + "</td>";
                    displayInvoice += "<td class='date'>" + invoice.Order_date + "</td>";
                    displayInvoice += "<td class='quantity'>" + invoice.Order_Quantity + "</td>";
                    displayInvoice += "<td class='status'>" + invoice.Order_Status + "</td>";
                    displayInvoice += "<td class='total'>R" + Math.Round(invoice.Order_Total, 2) + "</td>";
                    displayInvoice += "<td class='see-more'><div class='seeMore-btn'><div class='row'><div class='col-lg-5 offset-lg-1 text-left text-lg-right'>";
                    displayInvoice += " <a href='Invoice.aspx'?ID=" + invoice.Order_Id + "class='site-btn update-btn'>See more</a></div></div></div></td></tr>";

                    invoice = null;
                }
                AllInvoiceID.InnerHtml = displayInvoice;
            }
            //If user is not logged in
            else
            {
                Response.Redirect("Home.aspx");
            }
        }