public ActionResult CreateCategory() { var model = new Category(); ViewData["AvailableWBS"] = _wbsTaskRepository.FindAll(); ViewData["StateGridCategories"] = _stateCategoryRepostitory.FindAll(); ViewData["ParentCategories"] = _categoryRepostitory.FindAll(); return PartialView("_CategoryForm", model); }
public ActionResult CreateCategory() { var model = new Category(); ViewData["AvailableWBS"] = _wbsTaskRepository.FindAll(); ViewData["StateGridCategories"] = _stateCategoryRepostitory.FindAll(); ViewData["ParentCategories"] = _categoryRepostitory.FindAll(); ViewData["Pms"] = _userRepository.FindAll().ToList().Where(x => x.IsInRole("分配项目主任")); return PartialView("_CategoryForm", model); }
public ActionResult ProjectTaskLogReport(string statcategoryid) { var title = ""; var defaultcat = new Category {CategoryId = 0, Name = "所有子类"}; var tempCategories = _categoryRepostitory.FindAll() .Where(x => x.StateGridCategoryCode.StartsWith(statcategoryid) && x.ParentId.HasValue) .ToList(); tempCategories.Insert(0,defaultcat); ViewBag.Categories = tempCategories; if (statcategoryid.StartsWith("1")) title = "基建类项目"; if (statcategoryid.StartsWith("2")) title = "技改类项目"; if (statcategoryid.StartsWith("6")) title = "营销类项目"; ViewBag.TypeTitle = title; ViewBag.StateGridCategory = statcategoryid; ViewBag.StartDate = DateTime.Now.FirstDayOfYear().Date.ToShortDateString(); ViewBag.EndDate = DateTime.Now.LastDayOfYear().Date.ToShortDateString(); return View(); }
public ActionResult EditCategory(Category input) { if (ModelState.IsValid) { Category category; if (input.CategoryId == 0) { category = new Category(); TryUpdateModel(category); _categoryRepostitory.Add(category); } else { category = _categoryRepostitory.Find(Convert.ToInt32(input.CategoryId)); TryUpdateModel(category); } UnitOfWork.Commit(); return Json(new JsonResponse { Success = true, Message = category.Name +"已保存" }); } return Json(new JsonResponse { Success = false, Message = "不能保存,请检查输入是否正确,或者联系管理员" }); }