// // GET: /OrgChart/Details/5 public ViewResult Details(int id) { OrgChartService service = new OrgChartService(); OrgChart model = service.GetOrgChartByID(new OrgChart() { Id = id }); model.ActionOperationType = EActionOperationType.Details; return View("Create",model); }
public ActionResult DeleteConfirmed(int id) { OrgChartService service = new OrgChartService(); OrgChart model = service.GetOrgChartByID(new OrgChart() { Id = id }); service.Remove(model); return RedirectToAction("Index"); }
// // GET: /OrgChart/Edit/5 public ActionResult Edit(int id) { OrgChartService service = new OrgChartService(); OrgChart model = service.GetOrgChartByID(new OrgChart() { Id = id }); model.ActionOperationType = EActionOperationType.Edit; this.LoadEditViewBag(model); return View("Create",model); }
public ActionResult Create(OrgChart model) { model.ActionOperationType = EActionOperationType.Create; if (ModelState.IsValid) { OrgChartService service = new OrgChartService(); service.Add(model); return RedirectToAction("Index"); } this.LoadEditViewBag(model); return View("Create",model); }
private void LoadSearchViewBag(DepartmentSearch searchModel) { #region sort ViewBag.IsAsc = !searchModel.IsAsc; ViewBag.SortBy = searchModel.SortBy; #endregion var orgchartService = new OrgChartService(); if (!searchModel.OrgChartId.HasValue) { ViewBag.OrgChartId = new SelectList(orgchartService.Query(p => p.IsActive=="1"), "Id", "Name"); } else { ViewBag.OrgChartId = new SelectList(orgchartService.Query(p => p.IsActive=="1"), "Id", "Name", searchModel.OrgChartId); } }
private void LoadEditViewBag(Department model) { OrgChartService orgchartService = new OrgChartService(); ViewBag.OrgChartId = new SelectList(orgchartService.Query(p => p.IsActive=="1"), "Id", "Name",model.OrgChartId); }
private void LoadCreateViewBag() { OrgChartService orgchartService = new OrgChartService(); ViewBag.OrgChartId = new SelectList(orgchartService.Query(p => p.IsActive=="1"), "Id", "Name"); }
private PagedList<OrgChart> QueryListData(OrgChartSearch searchModel) { int recordCount = 0; int pageSize = ConstantManager.PageSize; OrgChartService service = new OrgChartService(); string Group = searchModel.IsAsc ? searchModel.SortBy : searchModel.SortBy + " Descending"; IList<OrgChart> allEntities = service.QueryByPage(this.GetSearchFilter(searchModel), Group, pageSize, searchModel.PageIndex + 1, out recordCount); var formCondition = "var condition=" + JsonConvert.SerializeObject(searchModel); return new PagedList<OrgChart>(allEntities, searchModel.PageIndex, pageSize, recordCount, "Id", "Id", formCondition); }
private void LoadSearchViewBag(ProjectPlanCollectionSearch searchModel) { #region sort ViewBag.IsAsc = !searchModel.IsAsc; ViewBag.SortBy = searchModel.SortBy; #endregion var projectplanService = new ProjectPlanService(); if (!searchModel.ProjectPlanId.HasValue) { ViewBag.ProjectPlanId = new SelectList(projectplanService.Query(p => p.IsActive=="1"), "Id", "Name"); } else { ViewBag.ProjectPlanId = new SelectList(projectplanService.Query(p => p.IsActive=="1"), "Id", "Name", searchModel.ProjectPlanId); } var contractService = new ContractService(); if (!searchModel.ContractId.HasValue) { ViewBag.ContractId = new SelectList(contractService.Query(p => p.IsActive=="1"), "Id", "Name"); } else { ViewBag.ContractId = new SelectList(contractService.Query(p => p.IsActive=="1"), "Id", "Name", searchModel.ContractId); } var orgchartService = new OrgChartService(); if (!searchModel.OrgChartId.HasValue) { ViewBag.OrgChartId = new SelectList(orgchartService.Query(p => p.IsActive=="1"), "Id", "Name"); } else { ViewBag.OrgChartId = new SelectList(orgchartService.Query(p => p.IsActive=="1"), "Id", "Name", searchModel.OrgChartId); } var datadictionaryService = new DataDictionaryService(); if (!searchModel.BidTypeId.HasValue) { ViewBag.BidTypeId = new SelectList(datadictionaryService.Query(p => p.IsActive=="1"), "Id", "Name"); } else { ViewBag.BidTypeId = new SelectList(datadictionaryService.Query(p => p.IsActive=="1"), "Id", "Name", searchModel.BidTypeId); } var departmentService = new DepartmentService(); if (!searchModel.DepartmentId.HasValue) { ViewBag.DepartmentId = new SelectList(departmentService.Query(p => p.IsActive=="1"), "Id", "Name"); } else { ViewBag.DepartmentId = new SelectList(departmentService.Query(p => p.IsActive=="1"), "Id", "Name", searchModel.DepartmentId); } var employeeService = new EmployeeService(); if (!searchModel.ResearchOwnerEmployeeId.HasValue) { ViewBag.ResearchOwnerEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name"); } else { ViewBag.ResearchOwnerEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name", searchModel.ResearchOwnerEmployeeId); } if (!searchModel.EngeerEmployeeId.HasValue) { ViewBag.EngeerEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name"); } else { ViewBag.EngeerEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name", searchModel.EngeerEmployeeId); } if (!searchModel.CostOwnerEmployeeId.HasValue) { ViewBag.CostOwnerEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name"); } else { ViewBag.CostOwnerEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name", searchModel.CostOwnerEmployeeId); } if (!searchModel.AuthorEmployeeId.HasValue) { ViewBag.AuthorEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name"); } else { ViewBag.AuthorEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name", searchModel.AuthorEmployeeId); } if (!searchModel.OrganizerEmployeeId.HasValue) { ViewBag.OrganizerEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name"); } else { ViewBag.OrganizerEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name", searchModel.OrganizerEmployeeId); } }
private void LoadEditViewBag(ProjectPlanCollection model) { ProjectPlanService projectplanService = new ProjectPlanService(); ViewBag.ProjectPlanId = new SelectList(projectplanService.Query(p => p.IsActive=="1"), "Id", "Name",model.ProjectPlanId); ContractService contractService = new ContractService(); ViewBag.ContractId = new SelectList(contractService.Query(p => p.IsActive=="1"), "Id", "Name",model.ContractId); OrgChartService orgchartService = new OrgChartService(); ViewBag.OrgChartId = new SelectList(orgchartService.Query(p => p.IsActive=="1"), "Id", "Name",model.OrgChartId); DataDictionaryService datadictionaryService = new DataDictionaryService(); ViewBag.BidTypeId = new SelectList(datadictionaryService.Query(p => p.IsActive=="1"), "Id", "Name",model.BidTypeId); DepartmentService departmentService = new DepartmentService(); ViewBag.DepartmentId = new SelectList(departmentService.Query(p => p.IsActive=="1"), "Id", "Name",model.DepartmentId); EmployeeService employeeService = new EmployeeService(); ViewBag.ResearchOwnerEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name",model.ResearchOwnerEmployeeId); ViewBag.EngeerEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name",model.EngeerEmployeeId); ViewBag.CostOwnerEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name",model.CostOwnerEmployeeId); ViewBag.AuthorEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name",model.AuthorEmployeeId); ViewBag.OrganizerEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name",model.OrganizerEmployeeId); }