Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int client_id = 7;

            clientId   = client_id;
            deliveries = SR.GetAllDeliveries();
            user       = SR.GetUser(SR.GetClient(client_id).User_Id);
            quant      = SR.CalculateTotalQuantity(client_id);
            total      = SR.CalculateTotalPrice(client_id);
            shipping   = quant >= 10000 ? 0 : Math.Round(total * (decimal)0.02, 2);
            discount   = quant > 5000 ? Math.Round(total * (decimal)0.05) : 0;
            absTot     = total + shipping - discount;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["LoggedInUserID"] != null)
            {
                int ID   = Convert.ToInt32(Session["LoggedInUserID"]);
                var user = sr.GetUser(ID);

                if (!IsPostBack)
                {
                    Username.Value = user.Username;
                    Name.Value     = user.Name;
                    Email.Value    = user.Email;
                    Contact.Value  = user.Contact_Number;
                    Address.Value  = user.Address;

                    if (user.Usertype.Equals("client"))
                    {
                        var c = sr.GetClient(ID);
                        BusinessT.Value = c.Business_Type;
                    }
                    else if (user.Usertype.Equals("admin"))
                    {
                        var a = sr.GetAdmin(ID);
                        BusinessT.Value = a.Surname;
                    }
                    else
                    {
                        error.Text = "User not found";
                    }
                }
            }
            else
            {
                Response.Redirect("Home.aspx");
            }
        }