public ActionResult Detail(Guid id) { var bo = _Service.GetSingle(id); var boVM = new SystemWorkPlaceVM(bo); var detail = PageComponentRepository<SystemWorkPlaceVM>.DetailDialog(boVM); return Json(detail); }
public ActionResult CreateOrEdit(Guid id) { bool isNew = false; var bo = _Service.GetSingle(id); if (bo == null) { bo = new SystemWorkPlace(); bo.ID= id; isNew = true; } var boVM = new SystemWorkPlaceVM(bo); var editor = PageComponentRepository<SystemWorkPlaceVM>.CreateOrEditDialog(boVM, isNew); return Json(editor); }
public ActionResult List() { var boCollection = _Service.GetAllIncluding(x => x.SystemWorkSections).OrderBy(s => s.SortCode); var boVMCollection = new List<SystemWorkPlaceVM>(); var count = 0; foreach (var bo in boCollection) { var boVM = new SystemWorkPlaceVM(bo); boVM.OrderNumber = (++count).ToString(); boVMCollection.Add(boVM); } var pageModel = PageModelRepository<SystemWorkPlaceVM>.PageUpdate(boVMCollection, null, null); return Json(pageModel); }
public ActionResult Index() { var boCollection = _Service.GetAllIncluding(x => x.SystemWorkSections).OrderBy(s => s.SortCode); var boVMCollection = new List<SystemWorkPlaceVM>(); var count = 0; foreach (var bo in boCollection) { var boVM = new SystemWorkPlaceVM(bo); boVM.OrderNumber = (++count).ToString(); boVMCollection.Add(boVM); } var pageModel = PageModelRepository<SystemWorkPlaceVM>.GetPageMode(boVMCollection, null, null); return View("../../Views/Admin/Common/Index", pageModel); }
public ActionResult Save(SystemWorkPlaceVM boVM) { if (ModelState.IsValid) { var bo = _Service.GetSingle(boVM.ID); if (bo == null) { bo = new SystemWorkPlace(); bo.ID = boVM.ID; } var appID = Assembly.GetExecutingAssembly().ManifestModule.ModuleVersionId; var appInfo = _Service.GetSingleRelevance<ApplicationInformation>(appID); if(appInfo==null) { appInfo = new ApplicationInformation(); appInfo.ID = appID; appInfo.AppID = appID; appInfo.Name = ""; appInfo.Description = ""; appInfo.SortCode = "001"; _Service.AddRelevance<ApplicationInformation>(appInfo); _Service.Save(); } boVM.MapToBo(bo, appInfo); _Service.AddOrEditAndSave(bo); return Json(PageComponentRepository<SystemWorkPlaceVM>.SaveOK(true, "1", "")); } else { var vItems = new List<ValidatorResult>(); foreach (var item in ModelState) { if (item.Value.Errors != null) { foreach (var vItem in item.Value.Errors) { var errItem = new ValidatorResult(); errItem.Name = item.Key; errItem.ErrorMessage = vItem.ErrorMessage; vItems.Add(errItem); } } } var editor = PageComponentRepository<SystemWorkPlaceVM>.UpdateCreateOrEditDialog(boVM, false, vItems).InnerHtmlContent; return Json(editor); } }