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); }