public ActionResult CreateOrEdit(Guid id) { bool isNew = false; var bo = _Service.GetSingle(id); if (bo == null) { bo = new Person(); bo.ID = id; isNew = true; } var boVM = new PersonVM(bo); boVM.ParentItemColection = BusinessCollectionFactory <Department> .GetSelfReferentialItemCollection(true); boVM.CredentialsTypeCollection = BusinessCollectionFactory <CredentialsType> .GetPlainFacadeItemCollection(); boVM.JobLevelCollection = BusinessCollectionFactory <JobLevel> .GetPlainFacadeItemCollection(); boVM.JobTitleCollection = BusinessCollectionFactory <JobTitle> .GetPlainFacadeItemCollection(); var editor = PageComponentRepository <PersonVM> .CreateOrEditDialog(boVM, isNew); return(Json(editor)); }
public ActionResult Detail(Guid id) { var bo = _Service.GetSingle(id); var boVM = new JobLevelVM(bo); var detail = PageComponentRepository <JobLevelVM> .DetailDialog(boVM); return(Json(detail)); }
public ActionResult Detail(string id) { var bo = _RoleManager.FindById(id); var boVM = new ApplicationRoleVM(bo); var detail = PageComponentRepository <ApplicationRoleVM> .DetailDialog(boVM); return(Json(detail)); }
public ActionResult Detail(Guid id) { var bo = _Service.GetSingle(id); var boVM = new ApplicationBusinessTypeVM(bo); var detail = PageComponentRepository <ApplicationBusinessTypeVM> .DetailDialog(boVM); return(Json(detail)); }
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)); } }
public ActionResult Save(DepartmentVM boVM) { if (ModelState.IsValid) { var bo = _Service.GetSingle(boVM.ID); if (bo == null) { bo = new Department(); bo.ID = boVM.ID; } var parentBo = bo; // 对于具有层次结构关系的实体类,如果没有选择上级层次对象,缺省处理为自身,即为根节点对象。 if (!String.IsNullOrEmpty(boVM.ParentItemID)) { parentBo = _Service.GetSingle(Guid.Parse(boVM.ParentItemID)); } boVM.MapToBo(bo, parentBo); _Service.AddOrEditAndSave(bo); var typeID = bo.ParentDapartment.ID.ToString(); var extessionFunction = "RefreshTreeView"; // 约定数据持久化之后,除了执行返回列表的方法外,还需要执行的刷新导航树的另外的方法 return(Json(PageComponentRepository <DepartmentVM> .SaveOK(true, "1", typeID, extessionFunction))); } 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); } } } boVM.ParentItemColection = BusinessCollectionFactory <Department> .GetSelfReferentialItemCollection(true); var editor = PageComponentRepository <DepartmentVM> .UpdateCreateOrEditDialog(boVM, false, vItems).InnerHtmlContent; return(Json(editor)); } }
public ActionResult Save(ApplicationRoleVM boVM) { if (ModelState.IsValid) { var bo = _RoleManager.FindById(boVM.ID.ToString()); var isNew = false; if (bo == null) { bo = new ApplicationRole(); bo.Id = boVM.ID.ToString(); isNew = true; } boVM.MapToBo(bo); if (isNew) { _RoleManager.Create(bo); } else { _RoleManager.Update(bo); } return(Json(PageComponentRepository <ApplicationRoleVM> .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 <ApplicationRoleVM> .UpdateCreateOrEditDialog(boVM, false, vItems).InnerHtmlContent; return(Json(editor)); } }
public ActionResult CreateOrEdit(Guid id) { bool isNew = false; var bo = _Service.GetSingle(id); if (bo == null) { bo = new JobLevel(); bo.ID = id; isNew = true; } var boVM = new JobLevelVM(bo); var editor = PageComponentRepository <JobLevelVM> .CreateOrEditDialog(boVM, isNew); return(Json(editor)); }
public ActionResult CreateOrEdit(string id) { bool isNew = false; var bo = _RoleManager.FindById(id); if (bo == null) { bo = new ApplicationRole(); bo.Id = id; isNew = true; } var boVM = new ApplicationRoleVM(bo); var editor = PageComponentRepository <ApplicationRoleVM> .CreateOrEditDialog(boVM, isNew); return(Json(editor)); }
public ActionResult CreateOrEdit(Guid id) { bool isNew = false; var bo = _Service.GetSingle(id); if (bo == null) { bo = new DepartmentType(); bo.ID = id; isNew = true; } var boVM = new DepartmentTypeVM(bo); //! 使用调转的方式包括对话框和页面方式 //var editor = PageComponentRepository<DepartmentTypeVM>.CreateOrEditDialog(boVM, isNew); var editor = PageComponentRepository <DepartmentTypeVM> .CreateOrEditPage(boVM, isNew); return(Json(editor)); }
public ActionResult Save(DepartmentTypeVM boVM) { if (ModelState.IsValid) { var bo = _Service.GetSingle(boVM.ID); if (bo == null) { bo = new DepartmentType(); bo.ID = boVM.ID; } boVM.MapToBo(bo); _Service.AddOrEditAndSave(bo); // 这里采用直接跳转的方式,避开 AjaxForm 回转处理,跳转的时候,在本框架中,一般跳回Index, // 如果需要定位页码,类型等,请考虑 Index 中配置好参数,在下面的跳转调用中对应配置好参数即可。 return(JavaScript("window.location.href ='../DepartmentType/Index';")); } 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<DepartmentTypeVM>.UpdateCreateOrEditDialog(boVM, false, vItems).InnerHtmlContent; var editor = PageComponentRepository <DepartmentTypeVM> .UpdateCreateOrEditPage(boVM, false, vItems).InnerHtmlContent; return(Json(editor)); } }
public ActionResult Save(JobLevelVM boVM) { if (ModelState.IsValid) { var bo = _Service.GetSingle(boVM.ID); if (bo == null) { bo = new JobLevel(); bo.ID = boVM.ID; } boVM.MapToBo(bo); _Service.AddOrEditAndSave(bo); return(Json(PageComponentRepository <JobLevelVM> .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 <JobLevelVM> .UpdateCreateOrEditDialog(boVM, false, vItems).InnerHtmlContent; return(Json(editor)); } }
public ActionResult Save(PersonVM boVM) { if (ModelState.IsValid) { var bo = _Service.GetSingle(boVM.ID); if (bo == null) { bo = new Person(); bo.ID = boVM.ID; } boVM.MapToBo(bo); var creID = Guid.Parse(boVM.CredentialsTypeID); var credentialType = _Service.GetSingleRelevance <CredentialsType>(creID); var jlID = Guid.Parse(boVM.JobLevelID); var jobLevel = _Service.GetSingleRelevance <JobLevel>(jlID); var jtID = Guid.Parse(boVM.JobTitleID); var jobTitle = _Service.GetSingleRelevance <JobTitle>(jtID); var dID = Guid.Parse(boVM.ParentItemID); var dept = _Service.GetSingleRelevance <Department>(dID); bo.Name = bo.FirstName + bo.LastName; if (String.IsNullOrEmpty(bo.SortCode)) { bo.SortCode = BusinessEntityComponentsFactory.SortCodeByDefaultDateTime <Person>(); } bo.CredentialsType = credentialType; bo.JobLevel = jobLevel; bo.JobTitle = jobTitle; bo.Department = dept; bo.UpdateTime = DateTime.Now; bo.IsActivePerson = true; _Service.AddOrEditAndSave(bo); //var personInDepartment = _Service.GetSingleRelevanceBy<PersonsInDepartment>(p => p.Person.ID == bo.ID && p.Department.ID == dID); //if (personInDepartment == null) //{ // personInDepartment = new PersonsInDepartment() { Department = dept, Person = bo }; // _Service.AddAndSaveRelevance<PersonsInDepartment>(personInDepartment); //} var typeID = boVM.ParentItemID; return(Json(PageComponentRepository <PersonVM> .SaveOK(true, "1", typeID))); } 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); } } } boVM.ParentItemColection = BusinessCollectionFactory <Department> .GetSelfReferentialItemCollection(true); boVM.CredentialsTypeCollection = BusinessCollectionFactory <CredentialsType> .GetPlainFacadeItemCollection(); boVM.JobLevelCollection = BusinessCollectionFactory <JobLevel> .GetPlainFacadeItemCollection(); boVM.JobTitleCollection = BusinessCollectionFactory <JobTitle> .GetPlainFacadeItemCollection(); var editor = PageComponentRepository <PersonVM> .UpdateCreateOrEditDialog(boVM, false, vItems).InnerHtmlContent; return(Json(editor)); } }