示例#1
3
        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);
            }
        }
示例#2
2
        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();
        }
示例#3
1
        protected IEnumerable<Product> getCategoryProducts()
        {
            ShopEntities dbShop = new ShopEntities();

            IEnumerable<Product> products = dbShop.Products;
            products = products.Where(t => t.CategoryId == categoryID);
            return (products);
        }
示例#4
0
        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);
            }
        }
示例#5
0
 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;
 }
示例#6
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;
                }
            }
        }
示例#7
0
        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;
            }
        }