public JsonResult LoadCarPartCategory() { var dao = new CarPartCategoryDAO(); var data = dao.LoadCarPartCategory(); return(Json(new { data = data }, JsonRequestBehavior.AllowGet)); }
public JsonResult GetDisplayOrder(int parentId, int display, string cal) { var dao = new CarPartCategoryDAO(); int res = dao.GetDisplayOrder(parentId, display, cal); return(Json(new { res = res }, JsonRequestBehavior.AllowGet)); }
public JsonResult GetListMainMenu(int Id) { var dao = new CarPartCategoryDAO(); var mainMenu = dao.GetListMainMenu(Id); return(Json(new { data = mainMenu }, JsonRequestBehavior.AllowGet)); }
public JsonResult LoadCarPartCategoryDetail(int Id) { var dao = new CarPartCategoryDAO(); CarPartCategory entity = dao.GetDetailByID(Id); return(Json(new { data = entity }, JsonRequestBehavior.AllowGet)); }
public ActionResult ViewListCarPart(int id, int page = 1, int pageSize = 8, int nsx = 0, int xuatxu = 0) { ViewBag.CarPartCategory = new CarPartCategoryDAO().LoadCarPartCategory(); ViewBag.ManufacturerCarPart = new ManufacturerDAO().LoadListManufacturer().Where(x => x.Status == true); ViewBag.OriginCarPart = new OriginDAO().LoadListOrigin().Where(x => x.Status == true && x.Type == 0); ViewBag.ManuID = nsx; ViewBag.OriginID = xuatxu; var entity = new CarPartCategoryDAO().GetDetailByID(id); ViewBag.Title = entity.SeoTitle; ViewBag.MetaKeywords = entity.MetaKeywords; ViewBag.MetaDescription = entity.MetaDescriptions; ViewBag.CategoryCurrent = entity; IEnumerable <CarPart> carpart = new CarPartDAO().LoadCarPart(); int totalRecord = new CarPartDAO().LoadCarPart().Count(); if (id != 20) { carpart = new CarPartDAO().GetCarPartByCategoryID(carpart, id); totalRecord = carpart.Count(); } if (xuatxu != 0) { carpart = carpart.Where(x => x.OriginID == xuatxu); totalRecord = carpart.Count(); } if (nsx != 0) { carpart = carpart.Where(x => x.ManufacturerID == nsx); totalRecord = carpart.Count(); } carpart = carpart.Skip((page - 1) * pageSize).Take(pageSize); ViewBag.totalRecord = totalRecord; ViewBag.Page = page; int maxPage = 5; int totalPage = (int)Math.Ceiling((double)(totalRecord / pageSize)) + 1; ViewBag.TotalPage = totalPage; ViewBag.MaxPage = maxPage; ViewBag.First = 1; ViewBag.Next = page + 1; ViewBag.Last = totalPage; ViewBag.Prev = page - 1 > 0 ? page - 1 : 1; return(View(carpart)); }
public JsonResult CreateEditCarPartCategory(string strCarPartCategory) { var dao = new CarPartCategoryDAO(); JavaScriptSerializer seriliazer = new JavaScriptSerializer(); CarPartCategory entity = seriliazer.Deserialize <CarPartCategory>(strCarPartCategory); entity.MetaTitle = Common.convertToUnSign.convert(entity.Name); string username = (string)Session[Common.CommonConstants.USER_NAME]; int res = dao.CreateEditCarPartCategory(entity, username); return(Json(new { result = res }, JsonRequestBehavior.AllowGet)); }
public JsonResult ChangeStatus(int Id) { var dao = new CarPartCategoryDAO(); bool check = dao.CheckUsed(Id); if (check == false) { bool?res = dao.ChangeStatus(Id); return(Json(new { res = res, used = check, })); } else { return(Json(new { used = check, })); } }
public JsonResult DeleteCarPartCategory(int Id) { var dao = new CarPartCategoryDAO(); bool check = dao.CheckUsed(Id); int result = 2; if (check == false) { result = dao.DeleteCarPartCategory(Id); return(Json(new { res = result })); } else { return(Json(new { res = result })); } }