protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (CurrentContext.IsLogged()) { Customer curCus = CurrentContext.getCustomer(); var list = db.OrderDetails.Where(o => o.Order.CustomerID == curCus.CustomerID) .Select(ord => new { LinkImage = ord.Product.LinkImage, ProductName = ord.Product.ProductName, UnitPrice = ord.Product.UnitPrice, Unit = ord.Product.Unit, Quantity = ord.Quantity, DateBuy = ord.Order.DateBuy, TotalMoney = ord.TotalMoney, Payments = ord.Order.Payments }) .ToList(); lvIHistorytemsCart.DataSource = list; lvIHistorytemsCart.DataBind(); } } }
protected void Page_Load(object sender, EventArgs e) { if (CurrentContext.IsLogged()) { Response.Redirect("~/Default.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { if (CurrentContext.IsLogged() == false) { Response.Redirect("~/Login.aspx?retUrl=Profile.aspx"); } else { if (CurrentContext.getCustomer() != null) { accID = CurrentContext.getCustomer().Account.AccountID; customer = CurrentContext.getCustomer(); if (!IsPostBack) { txtName.Text = customer.FullName; txtBirthDay.Text = String.Format("{0:dd/MM/yyyy}", customer.BirthDay); if (customer.Sex.Equals("Nam")) { cbbSex.SelectedIndex = 1; } else { cbbSex.SelectedIndex = 2; } txtDiaChi.Text = customer.Address; } } if (CurrentContext.getEmployee() != null) { accID = CurrentContext.getEmployee().Account.AccountID; employee = CurrentContext.getEmployee(); if (IsPostBack == false) { txtName.Text = employee.FullName; txtBirthDay.Text = String.Format("{0:dd/MM/yyyy}", employee.BirthDate); if (employee.Sex.Equals("Nam")) { cbbSex.SelectedIndex = 1; } else { cbbSex.SelectedIndex = 2; } txtDiaChi.Text = employee.Address; } } } }
protected void Page_Load(object sender, EventArgs e) { if (!CurrentContext.IsLogged()) { Response.Redirect("~/Login.aspx?retUrl=Cart.aspx"); } if (!IsPostBack) { lvItemsCart.DataSource = CurrentContext.getCart().Items; lvItemsCart.DataBind(); lblTotal.Text = string.Format("{0:N0} {1}", _total, _unit); } }
protected void txtAddToCart_ServerClick(object sender, EventArgs e) { if (CurrentContext.IsLogged()) { int proID = Convert.ToInt32(Request.QueryString["procID"]); cCartItem cartItem = new cCartItem() { ProID = proID, Quantity = Convert.ToInt32(txtQuantity.Value) }; CurrentContext.getCart().Add(cartItem); ((Site)this.Master).updateLinkCart(); } else { string url = "~/Login.aspx?retUrl=Product-details.aspx?procID=" + Request.QueryString["procID"]; Response.Redirect(url); } }
protected void Page_Load(object sender, EventArgs e) { if (CurrentContext.IsLogged()) { pnLogged.Visible = true; pnNotLogged.Visible = false; if (CurrentContext.getCustomer() != null) { lnkUserName.Text = string.Format("<i class='fa fa-user'></i><b>{0}</b>", CurrentContext.getCustomer().FullName); } else if (CurrentContext.getEmployee() != null) { lnkUserName.Text = string.Format("<i class='fa fa-user'></i><b>{0}</b>", CurrentContext.getEmployee().FullName); } else { lnkUserName.Text = string.Format("<i class='fa fa-user'></i><b>{0}</b>", CurrentContext.getAdmin()); } updateLinkCart(); } else { pnLogged.Visible = false; pnNotLogged.Visible = true; } if (!IsPostBack) { cbbChoose.DataSource = db.Suppliers.ToList(); cbbChoose.DataTextField = "CompanyName"; cbbChoose.DataValueField = "SupplierID"; cbbChoose.DataBind(); cbbChoose.Items.Insert(0, new ListItem("- -Nhà sản xuất- -", "0")); } }
protected void Page_Load(object sender, EventArgs e) { if (!CurrentContext.IsLogged()) { if (Request.QueryString["email"] != null && Request.QueryString["pass"] != null) { string email = Request.QueryString["email"]; string pass = Request.QueryString["pass"]; Account account = db.Accounts.SingleOrDefault(acc => acc.UserName.Equals(email)); if (account != null) { string pMD5 = helpers.StringUltils.MD5(pass); account.PassWord = pMD5; db.SaveChanges(); } } else { Response.Redirect("~/Default.aspx"); } } }