//
 // GET: /ProjectPlanCollection/Create
 public ActionResult Create()
 {
     ProjectPlanCollection model =new ProjectPlanCollection();
     model.ActionOperationType = EActionOperationType.Create;
     this.LoadCreateViewBag();
     return View("Create",model);
 }
 public ActionResult Edit(ProjectPlanCollection model)
 {
     model.ActionOperationType = EActionOperationType.Edit;
     if (ModelState.IsValid)
     {
         ProjectPlanCollectionService service = new ProjectPlanCollectionService();
         service.Update(model);
         return RedirectToAction("Index");
     }
     this.LoadEditViewBag(model);
     return View("Create",model);
 }
Пример #3
0
 private IList<ProjectPlan> GetProjectPlans()
 {
     IList<ProjectPlan> projectPlans = new List<ProjectPlan>()
     {
         new ProjectPlan(){ ProjectName = "道义A2地块1组团", Id = 1},
         new ProjectPlan(){ ProjectName = "新项目1组团", Id = 2}
     };
     IList<Contract> allContracts = GetContracts();
     foreach (ProjectPlan pp in projectPlans)
     {
         pp.ProjectPlanCollectionList = new List<ProjectPlanCollection>();
         foreach (Contract c in allContracts)
         {
             var ppc = new ProjectPlanCollection();
             ppc.ContractId = c.Id;
             ppc.Contract = c;
             ppc.Year = DateTime.Now.Year + 1;
             pp.ProjectPlanCollectionList.Add(ppc);
         }
     }
     return projectPlans;
 }
        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);
        }
Пример #5
0
        private void LoadViewBag(ProjectPlan model)
        {
            List<Contract> lstContract = new List<Contract>();
            lstContract.Add(new Contract() { Name = "场地平整、土方及地基处理", Id = 1 });
            lstContract.Add(new Contract() { Name = "总承包工程", Id = 2 });
            lstContract.Add(new Contract() { Name = "钢材供应合同", Id = 3});
            lstContract.Add(new Contract() { Name = "保温分包工程合同", Id = 4 });
            lstContract.Add(new Contract() { Name = "造价咨询合同", Id = 5 });
            if (model.ProjectPlanCollectionList == null || model.ProjectPlanCollectionList.Count == 0)
            {
                IList<ProjectPlanCollection> lstPPC = new List<ProjectPlanCollection>();
                model.ProjectPlanCollectionList = lstPPC;
                foreach (var item in lstContract)
                {
                    var ppc = new ProjectPlanCollection();
                    ppc.ContractId = item.Id;
                    ppc.Year = DateTime.Now.Year + 1;
                    model.ProjectPlanCollectionList.Add(ppc);
                }
            }
            ViewBag.ContractId = new SelectList(lstContract,"Id","Name");

            List<DataDictionary> lstBidType = new List<DataDictionary>();
            lstBidType.Add(new DataDictionary() { Name = "邀请招标", Id = 1 });
            lstBidType.Add(new DataDictionary() { Name = "简易招标", Id = 2 });
            lstBidType.Add(new DataDictionary() { Name = "邀请报价", Id = 3 });
            lstBidType.Add(new DataDictionary() { Name = "直接委托", Id = 4 });
            ViewBag.BidTypeId = new SelectList(lstBidType, "Id", "Name");

            List<Item> lstYears = new List<Item>();
            var currentYear = DateTime.Now.Year;
            lstYears.Add(new Item() { Id = currentYear, Text = currentYear.ToString() });
            for (int i = 1; i < 10; i++)
            {
                currentYear += 1;
                lstYears.Add(new Item() { Id = currentYear, Text = currentYear.ToString() });
            }
            ViewBag.Years = new SelectList(lstYears,"Id","Text");

            List<DataDictionary> lstContractCategory = new List<DataDictionary>();
            lstContractCategory.Add(new DataDictionary() { Name = "工程", Id = 1 });
            lstContractCategory.Add(new DataDictionary() { Name = "工程材料", Id = 2 });
            lstContractCategory.Add(new DataDictionary() { Name = "设备", Id = 3 });
            ViewBag.ContractCategoryId = new SelectList(lstContractCategory, "Id", "Name");

            List<DataDictionary> lstContractType = new List<DataDictionary>();
            lstContractType.Add(new DataDictionary() { Name = "独立承包", Id = 1 });
            lstContractType.Add(new DataDictionary() { Name = "指定分包", Id = 2 });
            ViewBag.ContractTypeId = new SelectList(lstContractType, "Id", "Name");

            List<DataDictionary> lstContractRelation = new List<DataDictionary>();
            lstContractRelation.Add(new DataDictionary() { Name = "甲方", Id = 1 });
            lstContractRelation.Add(new DataDictionary() { Name = "承包商", Id = 2 });
            ViewBag.ContractRelationId = new SelectList(lstContractRelation, "Id", "Name");

            List<Department> lstDepartment = new List<Department>();
            lstDepartment.Add(new Department() { Name = "项目成本组", Id = 1 });
            lstDepartment.Add(new Department() { Name = "招标及合同管理组", Id = 2 });
            ViewBag.DepartmentId = new SelectList(lstDepartment, "Id", "Name");

            List<Employee> lstEmployee = new List<Employee>();
            lstEmployee.Add(new Employee() { UserName = "******", Id = 1 });
            lstEmployee.Add(new Employee() { UserName = "******", Id = 2 });
            lstEmployee.Add(new Employee() { UserName = "******", Id = 3 });
            ViewBag.EmployeeId = new SelectList(lstEmployee, "Id", "UserName");
        }