Exemplo n.º 1
0
        public ActionResult SubClassification(FormCollection FC)
        {
            Session["ControllerName"] = "Sub Classification";
            string category = FC["Category"].ToString();
            string SubCategory = FC["subCategory"].ToString();
            string subClassification = FC["txtBoxSubClassification"].ToString();

            if (category != null && category != string.Empty && SubCategory != null && SubCategory != string.Empty && subClassification != null && subClassification != string.Empty)
            {
                ProductAdminBLL bll = new ProductAdminBLL();
                int res = bll.InsertSubClassification(subClassification, SubCategory);

                if (res > 0)
                {
                    LoadCategoryDDL();
                }


            }
            else
            {
                LoadCategoryDDL();
            }
            return View();
        }
Exemplo n.º 2
0
        public string abc()
        {
            dt.Clear();
            ProductAdminBLL bll = new ProductAdminBLL();
            dt = bll.Categories();

            System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();

            List<Dictionary<string, object>> rows = new List<Dictionary<string, object>>();

            Dictionary<string, object> row;

            foreach (DataRow dr in dt.Rows)
            {

                row = new Dictionary<string, object>();

                foreach (DataColumn col in dt.Columns)
                {

                    row.Add(col.ColumnName, dr[col]);

                }

                rows.Add(row);

            }

            return serializer.Serialize(rows);
        }
Exemplo n.º 3
0
        private void LoadCategoryDDL()
        {
            List<SelectListItem> li = new List<SelectListItem>();
            ProductAdminBLL bll = new ProductAdminBLL();
            Dictionary<string, string> list = bll.GetCategory();

            foreach (var item in list)
            {
                li.Add(new SelectListItem { Text = item.Value, Value = item.Key });
            }

            ViewData["Category"] = li;
        }
Exemplo n.º 4
0
        public JsonResult GetSubClassification(string id)
        {
            List<SelectListItem> SubClassification = new List<SelectListItem>();
            ProductAdminBLL bll = new ProductAdminBLL();

            Dictionary<string, string> list = bll.GetSUBClassificationBasedOnID(id);

            foreach (var item in list)
            {
                SubClassification.Add(new SelectListItem { Text = item.Value, Value = item.Key });
            }

            return Json(new SelectList(SubClassification, "Value", "Text"));
        }
Exemplo n.º 5
0
        public void GetSubCategoryDDL()
        {
            
                ProductAdminBLL bll = new ProductAdminBLL();
                Dictionary<string, string> lst = bll.GetCategory();
                List<string> str = new List<string>();
                List<SelectListItem> lstitm = new List<SelectListItem>();
                foreach (var item in lst)
                {
                    lstitm.Add(new SelectListItem { Text = item.Value, Value = item.Key });
                    str.Add(item.Value);
                }

                //ViewBag.ddlSubCategory = new SelectList(lstitm, "Value", "Text");
                ViewBag.SubCategory = new SelectList(lstitm, "Value", "Text").ToList();
           
        }
Exemplo n.º 6
0
        public ActionResult DeleteCategory_Post(int id)
        {
            Session["ControllerName"] = "Delete Category";
             if (Session["loginDetails"] != null)
            {
                    ProductAdminBLL bll = new ProductAdminBLL();

                    int res = bll.DeleteCategory(id);
                    if (res > 0)
                    {
                        return RedirectToAction("Category");
                    }
                    else
                    {
                        return RedirectToAction("Category");
                    }

            }
             else
             {

                 return RedirectToAction("Error");
             }
        }
Exemplo n.º 7
0
        public ActionResult SubCategory(int page = 1)
        {
            Session["ControllerName"] = "Sub Category";
             if (Session["loginDetails"] != null)
            {

                int pageSize = 10;
                int totalPage = 0;
                int totalRecord = 0;

                List<SubCategoryDetails> sub = new List<BLL.SubCategoryDetails>();
                ProductAdminBLL bll = new ProductAdminBLL();
                totalRecord = bll.getAllSubCategory().Count();
                totalPage = (totalRecord / pageSize) + ((totalRecord % pageSize) > 0 ? 1 : 0);
                sub = bll.getAllSubCategory().OrderBy(a => a.Sub_Cat_Name).Skip(((page - 1) * pageSize)).Take(pageSize).ToList();
                ViewBag.TotalRows = totalRecord;
                ViewBag.PageSize = pageSize;
                 
                return View(sub);
             }
             else
             {

                 return RedirectToAction("Error");
             }
        }
Exemplo n.º 8
0
 public string getdata()
 {
     ProductAdminBLL bll = new ProductAdminBLL();
     string str = bll.getdata();
     return str;
 }
Exemplo n.º 9
0
        public JsonResult GetSubCategory(string id)
        {
            List<SelectListItem> subCategory = new List<SelectListItem>();
            ProductAdminBLL bll = new ProductAdminBLL();

            Dictionary<string, string> list = bll.GetSUBCategoryBasedOnID(id);

            foreach (var item in list)
            {
                subCategory.Add(new SelectListItem { Text = item.Value, Value = item.Key });
            }

            return Json(new SelectList(subCategory, "Value", "Text"));
        }
Exemplo n.º 10
0
        public ActionResult ProdEdit(string id)
        {

            Session["ControllerName"] = "Prod Edit";
            if (Session["loginDetails"] != null)
            {
                getDdlsForProduct();
                LoadCategoryDDL();
                ViewBag.DDLBrand = new SelectList(ddlbrand, "Value", "Text").ToList();
                //ViewBag.SubCategory = new SelectList(ddlSubCategory, "Value", "Text").ToList();

                ProductAdminBLL bll = new ProductAdminBLL();
                ProductDetails productdetails = bll.Get_product_list().Single(b => b.Prod_Id == id);

                return View(productdetails);
            }
            else
            {

                return RedirectToAction("Error");
            }
        }
Exemplo n.º 11
0
        //public string EnterSubCat(int catID, string subCategoryName)
        //{
        //    ProductAdminBLL bll = new ProductAdminBLL();
        //    string str = bll.EnterSubCat(catID, subCategoryName);
        //    return str;
        //}


       


        public string GetBrand()
        {
            ProductAdminBLL bll = new ProductAdminBLL();
            string str = bll.GetBrand();
            return str;

        }
Exemplo n.º 12
0
        public ActionResult Brand(int page = 1)
        {
            Session["ControllerName"] = "Brand";
            if (Session["loginDetails"] != null)
            {
                int pageSize = 10;
                int totalPage = 0;
                int totalRecord = 0;
                List<Brand> lst = new List<BLL.Brand>();

                ProductAdminBLL bll = new ProductAdminBLL();
                totalRecord = bll.GetBrands().Count();
                totalPage = (totalRecord / pageSize) + ((totalRecord % pageSize) > 0 ? 1 : 0);
                lst = bll.GetBrands().OrderBy(a => a.Brand_Name).Skip(((page - 1) * pageSize)).Take(pageSize).ToList();
                //List<Brand> lst = bll.GetBrands();
                ViewBag.TotalRows = totalRecord;
                ViewBag.PageSize = pageSize;
                return View(lst);

            }
            else
            {
                return RedirectToAction("Error");
            }
        }
Exemplo n.º 13
0
        public ActionResult EditBrand_Post(Brand brand)
        {
            Session["ControllerName"] = "Edit Brand";
            if (Session["loginDetails"] != null)
            {
                ProductAdminBLL bll = new ProductAdminBLL();

                if (ModelState.IsValid)
                {
                    int res = bll.UpdateBrand(brand);
                    if (res > 0)
                    {
                        return RedirectToAction("Brand");
                    }
                    else
                    {
                        return View();
                    }


                }
                else
                {
                    return View();
                }

            }
            else
            {
                return RedirectToAction("Error");
            }

        }
Exemplo n.º 14
0
        public void getDdlsForProduct()
        {
            ProductAdminBLL bll = new ProductAdminBLL();
           // Dictionary<string, string> lst = bll.GetSubcategory();
           // List<string> str = new List<string>();
            List<SelectListItem> lstitm = new List<SelectListItem>();
           // foreach (var item in lst)
           // {
           //     lstitm.Add(new SelectListItem { Text = item.Value, Value = item.Key });
           //     str.Add(item.Value);
           // }

           // ddlSubCategory = lstitm;
           // //ViewBag.ddlSubCategory = new SelectList(lstitm, "Value", "Text");
           //// ViewBag.SubCategory = new SelectList(lstitm, "Value", "Text").ToList();

            lstitm = new List<SelectListItem>();
           
            List<Brand> lstbrand = bll.GetBrands();
            Dictionary<string, string> lstbrands = new Dictionary<string, string>();
            foreach (Brand item in lstbrand)
            {
                lstitm.Add(new SelectListItem { Text = item.Brand_Name, Value =Convert.ToString(item.Brand_Id) });
            }

            ddlbrand = lstitm;
            ViewBag.DDLBrand = lstbrand;

        }
Exemplo n.º 15
0
        public ActionResult Category(int page = 1)
        {
            Session["ControllerName"] = "Category";
            if (Session["loginDetails"] != null)
            {
                int pageSize = 10;
                int totalPage = 0;
                int totalRecord = 0;

                List<Category> category = new List<BLL.Category>();
                ProductAdminBLL bll = new ProductAdminBLL();
                totalRecord = bll.GetCategoryForPagination().Count();
                totalPage = (totalRecord / pageSize) + ((totalRecord % pageSize) > 0 ? 1 : 0);
                category = bll.GetCategoryForPagination().OrderBy(a => a.Cat_Name).Skip(((page - 1) * pageSize)).Take(pageSize).ToList();
                ViewBag.TotalRows = totalRecord;
                ViewBag.PageSize = pageSize;

                

                return View(category);
            }
            else
            {

                return RedirectToAction("Error");
            }

        }
Exemplo n.º 16
0
        public ActionResult ProdDelete_post(string id)
        {

            Session["ControllerName"] = "Delete Product";
            if (Session["loginDetails"] != null)
            {
                ProductAdminBLL bll = new ProductAdminBLL();
                int res = bll.deleteProduct(id);
                if (res > 0)
                {

                    RedirectToAction("ProductList");
                }
                return View();
            }
            else
            {

                return RedirectToAction("Error");
            }
        }
Exemplo n.º 17
0
        public ActionResult ProdDelete(string id)
        {

            Session["ControllerName"] = "Delete Product";
            if (Session["loginDetails"] != null)
            {
                ProductAdminBLL bll = new ProductAdminBLL();
                ProductDetails productdetails = bll.Get_product_list().Single(b => b.Prod_Id == id);

                return View(productdetails);
            }
            else
            {

                return RedirectToAction("Error");
            }
        }
Exemplo n.º 18
0
        public ActionResult ProdEdit_post(ProductDetails productdetails)
        {

            Session["ControllerName"] = "Prod Edit";
            if (Session["loginDetails"] != null)
            {
                getDdlsForProduct();
                ViewBag.DDLBrand = new SelectList(ddlbrand, "Value", "Text").ToList();
                //ViewBag.SubCategory = new SelectList(ddlSubCategory, "Value", "Text").ToList();

                ProductAdminBLL bll = new ProductAdminBLL();
                int res = bll.updateProduct(productdetails);
                if (res > 0)
                {

                   return RedirectToAction("ProductList");
                }

                return View();
            }
            else
            {

                return RedirectToAction("Error");
            }
        }
Exemplo n.º 19
0
        public ActionResult SubCategory(FormCollection frm)
        {

            Session["ControllerName"] = "Sub Category";
            //string str = EnterSubCat(Convert.ToInt32(frm[0]), frm[1]);
            if (Session["loginDetails"] != null)
            {
                ProductAdminBLL bll = new ProductAdminBLL();
                int str = bll.EnterSubCat(Convert.ToInt32(frm[0]), frm[1]);
                //return str;
                if (str > 0)
                {

                    return RedirectToAction("SubCategory");
                }
                else
                {
                    ViewBag.CatSuccess = "Fail to Insert";
                    GetSubCategoryDDL();
                    return View();

                }

            }
            else
            {
                return RedirectToAction("Error");
            }
          
        }
Exemplo n.º 20
0
        public ActionResult DeleteBrand_Post(int Brand_Id)
        {
            Session["ControllerName"] = "Delete Brand";
            if (Session["loginDetails"] != null)
            {
              
            ProductAdminBLL bll = new ProductAdminBLL();

            int res = bll.DeleteBrand(Brand_Id);
            if (res > 0)
            {
                return RedirectToAction("Brand");
            }
            else
            {
                return View();
            }

            }
            else
            {
                return RedirectToAction("Error");
            }
        }
Exemplo n.º 21
0
        public ActionResult EditSubCategory(int id)
        {


            Session["ControllerName"] = "Edit SubCategory";
            if (Session["loginDetails"] != null)
            {
                ProductAdminBLL bll = new ProductAdminBLL();
                List<SubCategoryDetails> list = bll.getAllSubCategory();

                //Dictionary<string, string> dict = bll.GetCategory();
                //List<Category> category = new List<Category>();
                //foreach (var item in dict)
                //{
                //    Category cat = new Category();
                //    cat.Cat_Id = Convert.ToInt32(item.Key);
                //    cat.Cat_Name = item.Value;
                //    category.Add(cat);

                //}
                GetSubCategoryDDL();
                SubCategoryDetails cate = list.Single(b => b.Sub_Cat_Id == id);
                return View(cate);
            }
            else
            {
                return RedirectToAction("Error");
            }
        }
Exemplo n.º 22
0
        public ActionResult ProductAdminHome(Product product, FormCollection FC)
        {
            Session["ControllerName"] = "Product";
            string subClassification = FC["SubClassification"].ToString();
            string SubCategory = FC["SubCategory"].ToString();
            Session["ControllerName"] = "ProductAdminHome";
            // getDdlsForProduct();
            if (Session["loginDetails"] != null)
            {
                ProductAdminBLL bll = new ProductAdminBLL();
                LoadCategoryDDL();
                getDdlsForProduct();
                product.SubClassification = subClassification;
                product.SubCategory = SubCategory;
                ViewBag.DDLBrand = new SelectList(ddlbrand, "Value", "Text").ToList();
                //ViewBag.SubCategory = new SelectList(ddlSubCategory, "Value", "Text").ToList();

                if (ModelState.IsValid)
                {
                    int res = bll.insertProduct(product);
                    if (res > 0)
                    {

                        return RedirectToAction("ProductAdminHome");
                    }
                }
                return View();
            }

            else
            {
                return RedirectToAction("Error");
            }
        }
Exemplo n.º 23
0
        public ActionResult CreateBrand_Post()
        {
            Session["ControllerName"] = "Create Brand";
            if (Session["loginDetails"] != null)
            {
                if (ModelState.IsValid)
                {
                    Brand brand = new Brand();
                    TryUpdateModel<Brand>(brand);

                    ProductAdminBLL bll = new ProductAdminBLL();
                    int res = bll.InsertBrand(brand);
                    if (res > 0)
                    {
                       return RedirectToAction("Brand");
                    }

                }

                return View();

                
            }
            else
            {
                return RedirectToAction("Error");
            }
        }
Exemplo n.º 24
0
        public ActionResult EditSubCategory(SubCategoryDetails details)
        {
            Session["ControllerName"] = "Edit SubCategory";
             if (Session["loginDetails"] != null)
            {

            ProductAdminBLL bll = new ProductAdminBLL();
            GetSubCategoryDDL();
            int res = bll.updateSubCategory(details);
            if (res > 0)
            {
                return RedirectToAction("SubCategory", "ProdAdmin");
            }
           
            return View();
            }
             else
             {
                 return RedirectToAction("Error");
             }
        }
Exemplo n.º 25
0
        public ActionResult DeleteBrand(int id)
        {
            Session["ControllerName"] = "Delete Brand";
           if (Session["loginDetails"] != null)
            {
              
            ProductAdminBLL bll = new ProductAdminBLL();
            Brand brand = bll.GetBrands().ToList().Single(b => b.Brand_Id == id);
            //bll.Employees.Single(emp => emp.ID == id);

            return View(brand);
            }
           else
           {
               return RedirectToAction("Error");
           }
        }
Exemplo n.º 26
0
        public ActionResult DeleteSubCategory(int  id)
        {

            Session["ControllerName"] = "Delete SubCategory";
            if (Session["loginDetails"] != null)
            {
                ProductAdminBLL bll = new ProductAdminBLL();
                //bll.GetSubcategory().ToList().Single(b => b.Brand_Id == id);
                SubCategoryDetails det = bll.getAllSubCategory().ToList().Single(b => b.Sub_Cat_Id == id);

                return View(det);
            }
            else
            {

                return RedirectToAction("Error");
            }
        }
Exemplo n.º 27
0
        /*End of Brand*/
        
        public string EnterBrand(string Brand)
        {

            ProductAdminBLL bll = new ProductAdminBLL();
            string str = bll.EnterBrand(Brand);
            return str;


        }
Exemplo n.º 28
0
        public ActionResult EditCategory(Category cat)
        {
            Session["ControllerName"] = "Edit Category";
            if (Session["loginDetails"] != null)
            {


                if (ModelState.IsValid)
                {
                    ProductAdminBLL bll = new ProductAdminBLL();
                    int res = bll.UpdateCategory(cat);
                    if (res > 0)
                    {
                        return RedirectToAction("Category");
                    }
                }
                return View();
            }
            else
            {

                return RedirectToAction("Error");
            }
        }
Exemplo n.º 29
0
        public ActionResult DeleteCategory(int id)
        {
            Session["ControllerName"] = "Delete Category";
            if (Session["loginDetails"] != null)
            {

                ProductAdminBLL bll = new ProductAdminBLL();
                Dictionary<string, string> dict = bll.GetCategory();
                List<Category> category = new List<Category>();
                foreach (var item in dict)
                {
                    Category cat = new Category();
                    cat.Cat_Id = Convert.ToInt32(item.Key);
                    cat.Cat_Name = item.Value;
                    category.Add(cat);

                }

                Category cate = category.Single(b => b.Cat_Id == id);
                return View(cate);
            }
            else
            {

                return RedirectToAction("Error");
            }

        }
Exemplo n.º 30
0
 public ActionResult SubClassificationList(string category, string SubCategory)
 {
     Session["ControllerName"] = "Sub ClassificationList";
     ProductAdminBLL bll = new ProductAdminBLL();
     LoadCategoryDDL();
     return View( bll.getSubClassificationList(category, SubCategory));
 }