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(); }
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); }
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; }
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")); }
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(); }
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"); } }
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"); } }
public string getdata() { ProductAdminBLL bll = new ProductAdminBLL(); string str = bll.getdata(); return str; }
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")); }
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"); } }
//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; }
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"); } }
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"); } }
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; }
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"); } }
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"); } }
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"); } }
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"); } }
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"); } }
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"); } }
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"); } }
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"); } }
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"); } }
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"); } }
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"); } }
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"); } }
/*End of Brand*/ public string EnterBrand(string Brand) { ProductAdminBLL bll = new ProductAdminBLL(); string str = bll.EnterBrand(Brand); return str; }
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"); } }
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"); } }
public ActionResult SubClassificationList(string category, string SubCategory) { Session["ControllerName"] = "Sub ClassificationList"; ProductAdminBLL bll = new ProductAdminBLL(); LoadCategoryDDL(); return View( bll.getSubClassificationList(category, SubCategory)); }