protected void BtnUpdateCategory_Click(object sender, EventArgs e)
        {
            int id = Convert.ToInt32(Request.QueryString["Id"]);
            var n  = category.Category.Find(id);

            n.CategoryName = TxtName.Text;
            category.SaveChanges();
            Response.Redirect("AdminCategories.aspx");
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            int id = Convert.ToInt32(Request.QueryString["Id"]);
            var n  = product.Product.Find(id);

            n.Active = false;
            product.SaveChanges();
            Response.Redirect("~/AdminProducts.aspx");
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            OnlineSiparisEntities category = new OnlineSiparisEntities();
            int id  = Convert.ToInt32(Request.QueryString["Id"]);
            var ctg = category.Category.Find(id);

            ctg.Active = false;
            category.SaveChanges();
            Response.Redirect("AdminCategories.aspx");
        }
Example #4
0
        protected void BtnAddCategory_Click(object sender, EventArgs e)
        {
            OnlineSiparisEntities category = new OnlineSiparisEntities();
            Category c = new Category();

            c.CategoryName = TextBox1.Text;
            c.CreateDate   = DateTime.Now;
            c.Active       = true;
            category.Category.Add(c);
            category.SaveChanges();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            OnlineSiparisEntities cart = new OnlineSiparisEntities();
            int id = Convert.ToInt32(Request.QueryString["Id"]);
            var p  = cart.Cart.Find(id);
            var s  = p.Product.CategoryId;

            cart.Cart.Remove(p);
            cart.SaveChanges();
            Response.Redirect("~/DefaultFilterProduct.aspx?Id=" + s);
        }
        public void Page_Load(object sender, EventArgs e)
        {
            OnlineSiparisEntities status = new OnlineSiparisEntities();
            int id   = Convert.ToInt32(Request.QueryString["Id"]);
            var ordr = status.Orders.Find(id);

            if (ordr.StatusId < 3)
            {
                ordr.StatusId = ordr.StatusId + 1;
            }

            status.SaveChanges();
            Response.Redirect("AdminOrders.aspx");
        }
        protected void BtnUpdateProduct_Click(object sender, EventArgs e)
        {
            int id = Convert.ToInt32(Request.QueryString["Id"]);
            var p  = product.Product.Find(id);

            p.ProductName = TxtName.Text;
            p.Code        = TxtCode.Text;
            p.Explanation = TxtExplanation.Text;
            p.Price       = decimal.Parse(TxtPrice.Text);


            if (FileUpload1.HasFile)
            {
                try
                {
                    if (FileUpload1.PostedFile.ContentType == "image/jpeg")
                    {
                        if (FileUpload1.PostedFile.ContentLength < 10240000)
                        {
                            FileUpload1.SaveAs(Server.MapPath("~/template/img/") + FileUpload1.FileName);
                            Label1.Text = "Dosya Adı: " + FileUpload1.PostedFile.FileName;
                            p.Photo     = FileUpload1.PostedFile.FileName.ToString();
                        }
                        else
                        {
                            Label1.Text = "Maksimum Boyut 10MB Olmalı.";
                        }
                    }
                    else
                    {
                        Label1.Text = "Resim Dosyası Seçin.";
                    }
                }
                catch (Exception ex)
                {
                    Label1.Text = "Hata oluştu: " + ex.Message.ToString();
                }
            }
            else
            {
                Label1.Text = "Dosya Seçin ve GÖNDER Butonuna Tıklayın.";
            }


            p.CategoryId = Convert.ToInt32(DropDownList1.SelectedValue);
            product.SaveChanges();
            Response.Redirect("AdminProducts.aspx");
        }
        public void Page_Load(object sender, EventArgs e)
        {
            Cart c = new Cart();
            OnlineSiparisEntities order = new OnlineSiparisEntities();
            int id = Convert.ToInt32(Request.QueryString["Id"]);
            var n  = order.Product.Find(id);

            c.ProductId = n.Id;
            c.TableId   = Convert.ToInt32(Session["tn"]);
            c.Count     = 1;
            order.Cart.Add(c);
            order.SaveChanges();


            Response.Redirect("~/DefaultFilterProduct.aspx?Id=" + n.CategoryId);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            var k = Convert.ToInt32(Session["tn"]);


            ordr.StatusId = 1;
            var z = (from x in order.Cart
                     where x.TableId == k
                     select new
            {
                x.Id,
                x.TableId,
                x.ProductId,
                x.Product.Price,
                x.Count
            }).ToList();

            for (int i = 0; i < z.Count; i++)
            {
                var p = z[i];
                ordr.ProductId  = Convert.ToInt32(p.ProductId);
                ordr.Price      = Convert.ToDecimal(p.Price);
                ordr.Count      = Convert.ToInt32(p.Count);
                ordr.TableId    = Convert.ToInt32(p.TableId);
                ordr.Active     = true;
                ordr.CreateDate = DateTime.Now;
                order.Orders.Add(ordr);
                cart.Id = Convert.ToInt32(p.Id);
                var a = order.Cart.Find(cart.Id);
                order.Cart.Remove(a);
            }

            order.SaveChanges();


            var table = (from x in order.Tables
                         where x.Id == k
                         select new
            {
                x.Id
            }).ToList();

            Repeater1.DataSource = table;
            Repeater1.DataBind();
        }
 protected void BtnAddProduct_Click(object sender, EventArgs e)
 {
     if (FileUpload1.HasFile)
     {
         try
         {
             if (FileUpload1.PostedFile.ContentType == "image/jpeg")
             {
                 if (FileUpload1.PostedFile.ContentLength < 10240000)
                 {
                     FileUpload1.SaveAs(Server.MapPath("~/template/img/") + FileUpload1.FileName);
                     Label1.Text = "Dosya Adı: " + FileUpload1.PostedFile.FileName;
                     Product newproduct = new Product();
                     newproduct.ProductName = TxtName.Text;
                     newproduct.CategoryId  = Convert.ToInt32(DropDownList1.SelectedValue.ToString());
                     newproduct.Explanation = TxtExplanation.Text;
                     newproduct.Price       = decimal.Parse(TxtPrice.Text);
                     newproduct.Code        = TxtCode.Text;
                     newproduct.CreateDate  = DateTime.Now;
                     newproduct.Active      = true;
                     newproduct.Photo       = "~/template/img/" + FileUpload1.PostedFile.FileName.ToString();
                     product.Product.Add(newproduct);
                     product.SaveChanges();
                     Response.Redirect("AdminProducts.aspx");
                 }
                 else
                 {
                     Label1.Text = "Maksimum Boyut 10MB Olmalı.";
                 }
             }
             else
             {
                 Label1.Text = "Resim Dosyası Seçin.";
             }
         }
         catch (Exception ex)
         {
             Label1.Text = "Hata oluştu: " + ex.Message.ToString();
         }
     }
     else
     {
         Label1.Text = "Dosya Seçin ve GÖNDER Butonuna Tıklayın.";
     }
 }