protected void Page_Load(object sender, EventArgs e) { ShopEntities dbShop = new ShopEntities(); NavigationMenu.Items[1].ChildItems.Clear(); foreach (var category in dbShop.Categories) { var menuItem = new MenuItem(category.Name, category.id.ToString(), "", category.NavigateUrl); NavigationMenu.Items[1].ChildItems.Add(menuItem); } }
protected void Save_Onclick(object sender, EventArgs e) { User h = new User(); h.First_Name = txtFirstName.Text; h.Last_Name = txtLastName.Text; h.Email = TextEmail.Text; h.Password = TextPassword.Text; ShopEntities dbShop = new ShopEntities(); dbShop.Users.AddObject(h); dbShop.SaveChanges(); }
protected IEnumerable<Product> getCategoryProducts() { ShopEntities dbShop = new ShopEntities(); IEnumerable<Product> products = dbShop.Products; products = products.Where(t => t.CategoryId == categoryID); return (products); }
protected void Page_Load(object sender, EventArgs e) { ShopEntities dbShop = new ShopEntities(); IEnumerable<Product> products = dbShop.Products; foreach (var category in dbShop.Categories) { var menuItem = new MenuItem(category.Name, category.id.ToString(), "", category.NavigateUrl); menuBar.Items.Add(menuItem); } }
protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args) { int counter = 0; ShopEntities dbShop = new ShopEntities(); foreach (var user in dbShop.Users) { if (user.Email == TextEmail.Text) { counter = counter + 1; } } args.IsValid = counter == 0; }
protected void Button1_Click(object sender, EventArgs e) { ShopEntities db = new ShopEntities(); IEnumerable<User> users = db.Users ; foreach (var Pipla in db.Users) { if ((Pipla.Email == txtLogin.Text) && (Pipla.Password == TextParol.Text)) { Response.Write("<script>window.open('Default.aspx')</script>"); } else { Label.Visible = true; } } }
protected void Page_Load(object sender, EventArgs e) { ShopEntities dbShop = new ShopEntities(); IEnumerable<Product> products = dbShop.Products; if (HttpContext.Current.Request.QueryString.AllKeys.Contains("productID")) { int productId = int.Parse(HttpContext.Current.Request.QueryString["productID"].ToString()); products = products.Where(t => t.id == productId); Product One = products.First(); imageBigPicture.ImageUrl = One.PictureBig; labelProdectName.Text = One.Name; labelDescription.Text = One.Price.ToString(); CheckOut.New = One; } }