private void Fill()
        {
            ProductBLL pb = new ProductBLL();

            rptProducts.DataSource = pb.Get(x => x.IsActive == true).ToList();
            rptProducts.DataBind();
        }
Example #2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            Order o = new Order();
            o.OrderNo = CreateOrderNo();// rastgele oluştur
            o.UserId = new Guid(Membership.GetUser().ProviderUserKey.ToString());
            o.Date = DateTime.Now;

            OrderBLL ob = new OrderBLL();

            ob.Add(o);

            ProductBLL pb = new ProductBLL();
            foreach (var p in Helper.Sepet)
            {
                OrderDetail od = new OrderDetail();
                od.OrderId = o.Id;
                od.ProductId = p.Id;
                od.Quantity = p.Quantity;

                OrderDetailBLL obll = new OrderDetailBLL();
                obll.Add(od);

                Product pr = pb.Get(x => x.Id == p.Id).FirstOrDefault();

                pr.Stock -= p.Quantity;
                pb.Update(pr);

                Helper.Sepet = new List<ProductDTO>();

            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Helper.Sayfalar = new List<string>() { "Ürünler", "Tüm Ürünler" };
            ProductBLL pb = new ProductBLL();

            rptProducts.DataSource = pb.Get(x => x.IsActive == true).ToList();
            rptProducts.DataBind();
        }
        protected void rptProducts_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            int id = Convert.ToInt32(e.CommandArgument);

            ProductBLL pb = new ProductBLL();
            Product p = pb.Get(x => x.Id == id).FirstOrDefault();

            p.IsActive = false;
            pb.Update(p);

            Fill();
        }
Example #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["productId"] == null)
            {
                Response.Redirect("default.aspx");
            }

            int id = Convert.ToInt32(Request.QueryString["productId"]);

            ProductBLL pb = new ProductBLL();

            product = pb.Get(x => x.Id == id).FirstOrDefault();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["logout"] == "true")
            {
                FormsAuthentication.SignOut();
                Session.Abandon();
                Response.Redirect("default.aspx");

            }

            ProductBLL pb = new ProductBLL();

            rptProducts.DataSource = pb.Get(x => x.IsActive == true).OrderByDescending(x => x.Date).Take(2).ToArray();
            rptProducts.DataBind();
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            int catId =Convert.ToInt32(ddlCategories.SelectedValue);
            if (Request.QueryString["productId"]==null)
            {
                ProductBLL pb = new ProductBLL();
                Product p = new Product();
                p.CategoryId = catId;
                p.Name = txtName.Text;
                p.Price = Convert.ToDecimal(txtPrice.Text);
                p.Stock = Convert.ToByte(txtStock.Text);
                p.Date = DateTime.Now;
                p.IsActive = true;
                p.Detail = txtDetail.Text;

                string fileName = Guid.NewGuid().ToString().Replace("-", "");
                string ext = Path.GetExtension(fl.FileName);
                fileName += ext;
                fl.SaveAs(MapPath("~/ProductImages/" + fileName));

                p.Image = fileName;

                pb.Add(p);
            }
            else
            {
                int id = Convert.ToInt32(Request.QueryString["productId"]);
                ProductBLL pb = new ProductBLL();
                Product p = pb.Get(x => x.Id == id).FirstOrDefault();

                p.Name = txtName.Text;
                p.Price = Convert.ToDecimal(txtPrice.Text);
                p.Stock = Convert.ToByte(txtStock.Text);
                p.Date = DateTime.Now;
                p.IsActive = true;
                p.Detail = txtDetail.Text;

                string fileName = Guid.NewGuid().ToString().Replace("-", "");
                string ext = Path.GetExtension(fl.FileName);
                fileName += ext;
                fl.SaveAs(MapPath("~/ProductImages/" + fileName));

                p.Image = fileName;

                pb.Update(p);
            }
            Response.Redirect("Products.aspx");
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            //Product p = new Product();
            //p.Name = txtProductName.Text;
            //p.Price =Convert.ToDecimal(txtPrice.Text);
            //p.Stock =Convert.ToInt16(txtStock.Text);
            //p.CategoryId =Convert.ToInt32(ddlCategories.SelectedValue);
            //string fileName = Guid.NewGuid().ToString().Replace("-","");
            //string ext = Path.GetExtension(fl.FileName);

            //fileName += ext;

            //fl.SaveAs(MapPath("~/ProductImages/")+fileName);

            //p.IsActive = true;
            //p.Date = DateTime.Now;

            //ProductBLL pb = new ProductBLL();
            //pb.Add(p);

            //Response.Redirect("Products.aspx");
            Product p = new Product();
            p.Name = txtProductName.Text;
            p.CategoryId = Convert.ToInt32(ddlCategories.SelectedValue);
            p.Stock = Convert.ToInt16(txtStock.Text);
            p.Price = Convert.ToDecimal(txtPrice.Text);

            string fileName = Guid.NewGuid().ToString().Replace("-", "");

            string ext = Path.GetExtension(fl.FileName);

            fileName += ext;

            fl.SaveAs(MapPath("~/ProductImages/") + fileName);

            p.Image = fileName;
            p.IsActive = true;
            p.Date = DateTime.Now;

            ProductBLL pb = new ProductBLL();

            pb.Add(p);

            Response.Redirect("Products.aspx");
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            ProductBLL pb = new ProductBLL();

            if (Request.QueryString["categoryId"] == null)
            {

                rptProducts.DataSource = pb.Get(x => x.IsActive == true).ToArray();
                rptProducts.DataBind();
            }

            else if (Request.QueryString["categoryId"] != null)
            {
                int id = Convert.ToInt32(Request.QueryString["categoryId"]);
                rptProducts.DataSource = pb.Get(x => x.CategoryId == id & x.IsActive == true).ToArray();
                rptProducts.DataBind();

            }
        }
Example #10
0
 public bool OrderProduct(string username, int productid, int schemeid)
 {
     try
     {
         p = new ProductBLL();
         int rows = p.PlaceOrder(username, productid, schemeid);
         if (rows == 4)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack) return;
            CategoryBLL cb = new CategoryBLL();
            ddlCategories.DataTextField = "Name";
            ddlCategories.DataValueField = "Id";
            ddlCategories.DataSource = cb.Get(x => x.IsActive == true).ToList();
            ddlCategories.DataBind();

            if (Request.QueryString["productId"]!=null)
            {
                int id = Convert.ToInt32(Request.QueryString["productId"]);
                ProductBLL pb = new ProductBLL();
                Product p = pb.Get(x => x.Id == id).FirstOrDefault();

                txtName.Text = p.Name;
                txtPrice.Text = p.Price.ToString();
                txtStock.Text = p.Stock.ToString();
                txtDetail.Text = p.Detail;
            }
        }
        private void SayfaKaydiniGetir()
        {
            ProductBLL pb = new ProductBLL();
            if (Request.QueryString["catId"] == null)
            {
                SayfadakiVeri = new PagedDataSource()
                {
                    DataSource = pb.Get(x => x.IsActive == true).ToList(),
                    AllowPaging = true,
                    PageSize = 4,
                    CurrentPageIndex = SayfaNumarasi
                };
            }
            else
            {
                int id = Convert.ToInt32(Request.QueryString["catId"]);
                SayfadakiVeri = new PagedDataSource()
                {
                    DataSource = pb.Get(x => x.IsActive == true & x.Id == id).ToList(),
                    AllowPaging = true,
                    PageSize = 4,
                    CurrentPageIndex = SayfaNumarasi
                };
            }
            //
            rptProducts.DataSource = SayfadakiVeri;
            rptProducts.DataBind();

            SayfaAdedi = SayfadakiVeri.PageCount - 1;
            //
            lbSayfaBilgi.Text = "Sayfa " + (SayfadakiVeri.CurrentPageIndex + 1) + "/" + SayfadakiVeri.PageCount + " - Kayıt Sayısı " + (SayfadakiVeri.DataSourceCount);
            //
            btnGeri.Enabled = !SayfadakiVeri.IsFirstPage;
            btnIleri.Enabled = !SayfadakiVeri.IsLastPage;
        }
Example #13
0
 public AdminController()
 {
     productTypeBLL = new ProductTypeBLL();
     productBLL = new ProductBLL();
 }
Example #14
0
 public ProductCategoryBLL(int lid)
 {
     lidValue = lid;
     pBLL     = new ProductBLL(lid);
 }