public async Task <ActionResult> PlanPointEdit(string planID, int num) { using (PlanRepository planRepo = new PlanRepository()) { PlanPoint model = await planRepo.GetPlanPointAsync(planID, num); if (model == null) { model = new PlanPoint() { StartTime = DateTime.Now, EndTime = DateTime.Now.AddDays(3), NeedID = "0" }; } //项目 var ItemList = new List <SelectListItem>(); var items = await itemsRepo.GetListItemsAsync(); var items2 = new SelectList(items, "ItemID", "NAME"); ItemList.AddRange(items2); ViewBag.ItemList = ItemList; //产品 var ProdList = new List <SelectListItem>(); var prods = await prodRepo.GetListAsync(); var prods2 = new SelectList(prods, "ProID", "NAME"); ProdList.AddRange(prods2); ViewBag.ProdList = ProdList; //任务类型 var TaskTypeList = new List <SelectListItem>(); var tasktypes = await codeRepo.GetTaskTypeListAsync(); var tasktypes2 = new SelectList(tasktypes, "ID", "NAME"); TaskTypeList.AddRange(tasktypes2); ViewBag.TaskTypeList = TaskTypeList; //处理人 var UserList = new List <SelectListItem>(); var userlist = await userRepo.GetUserListAsync(); var userlist2 = new SelectList(userlist, "Uid", "Name"); UserList.AddRange(userlist2); ViewBag.UserList = UserList; return(View(model)); } }
public async Task <ActionResult> NeedEdit(string needID) { using (NeedRepository needRepo = new NeedRepository()) { Need model = await needRepo.GetNeedAsync(needID); //项目 var ItemList = new List <SelectListItem>(); var items = await itemsRepo.GetListItemsAsync(); var items2 = new SelectList(items, "ItemID", "NAME"); ItemList.AddRange(items2); ViewBag.ItemList = ItemList; //产品 var ProdList = new List <SelectListItem>(); var prods = await prodRepo.GetListAsync(); var prods2 = new SelectList(prods, "ProID", "NAME"); ProdList.AddRange(prods2); ViewBag.ProdList = ProdList; //任务类型 var TaskTypeList = new List <SelectListItem>(); var tasktypes = await codeRepo.GetTaskTypeListAsync(); var tasktypes2 = new SelectList(tasktypes, "ID", "NAME"); TaskTypeList.AddRange(tasktypes2); ViewBag.TaskTypeList = TaskTypeList; if (model == null) { model = new Need() { proposeTime = DateTime.Now, deadTime = DateTime.Now.AddDays(3) }; } return(View(model)); } }
public async Task <ActionResult> TaskPublishEdit(string id) { PersonTask task = await pTaskRepo.GetTaskAsync(id); //项目 var ItemList = new List <SelectListItem>(); var items = await itemsRepo.GetListItemsAsync(); var items2 = new SelectList(items, "ItemID", "NAME"); ItemList.AddRange(items2); ViewBag.ItemList = ItemList; //产品 var ProdList = new List <SelectListItem>(); var prods = await prodRepo.GetListAsync(); var prods2 = new SelectList(prods, "ProID", "NAME"); ProdList.AddRange(prods2); ViewBag.ProdList = ProdList; //任务类型 var TaskTypeList = new List <SelectListItem>(); var tasktypes = await codeRepo.GetTaskTypeListAsync(); var tasktypes2 = new SelectList(tasktypes, "ID", "NAME"); TaskTypeList.AddRange(tasktypes2); ViewBag.TaskTypeList = TaskTypeList; //任务状态 var TaskStatusList = new List <SelectListItem>(); var taskstatus = await codeRepo.GetTaskStatusListAsync(); var taskstatus2 = new SelectList(taskstatus, "id", "name"); TaskStatusList.AddRange(taskstatus2); ViewBag.TaskStatusList = TaskStatusList; //人员 var UserList = new List <SelectListItem>(); var userlist = await userRepo.GetUserListAsync(); var userlist2 = new SelectList(userlist, "Uid", "Name"); UserList.AddRange(userlist2); ViewBag.UserList = UserList; //完成程度 var TaskComplDegree = new List <SelectListItem>(); var taskDegree = await codeRepo.GetCodesListAsync(ECodesTypeId.taskComplDegree); var taskDegree2 = new SelectList(taskDegree, "Code", "Text"); TaskComplDegree.AddRange(taskDegree2); ViewBag.TaskComplDegreeV = TaskComplDegree; //服务态度 var ServiceAttri = new List <SelectListItem>(); var serAttri = await codeRepo.GetCodesListAsync(ECodesTypeId.serviceAttri); var serAttri2 = new SelectList(serAttri, "Code", "Text"); ServiceAttri.AddRange(serAttri2); ViewBag.ServiceAttriV = ServiceAttri; //完成速度 var ComplSpeed = new List <SelectListItem>(); var speed = await codeRepo.GetCodesListAsync(ECodesTypeId.complSpeed); var speed2 = new SelectList(speed, "Code", "Text"); ComplSpeed.AddRange(speed2); ViewBag.ComplSpeedV = ComplSpeed; //困难程度 var TaskDiffLevel = new List <SelectListItem>(); var diffLevel = await codeRepo.GetCodesListAsync(ECodesTypeId.taskDiffLevel); var diffLevel2 = new SelectList(diffLevel, "Code", "Text"); TaskDiffLevel.AddRange(diffLevel2); ViewBag.TaskDiffLevelV = TaskDiffLevel; if (id == "0" || string.IsNullOrEmpty(id)) { var session = Session["CurrentUser"] as CurrentUser; task.publisherID = task.handlerID = task.followerID = session.Sys_User.Uid; task.perdStartTime = DateTime.Now; task.predDeadTime = DateTime.Now.AddDays(1); } else { if (task.complTime == null || task.complTime.Value.Year <= 1900) { task.complTime = null; } } return(View(task)); }