/// <summary> /// 需求及缺陷列表 /// </summary> /// <returns></returns> public ActionResult CheckList(CheckItemListModel model) { var planlist = new VersionPlanService().GetPlanList(); model.PlanList = planlist; model.PlanSelectItem = planlist.ConvertAll(c => new SelectListItem { Text = c.PlanCode, Value = c.ID }); model.PlanSelectItem.Add(new SelectListItem { Text = "计划编号(全部)", Value = "", Selected = true }); const int pageSize = 10; int count = 0; int pageIndex = PressRequest.GetInt("page", 1); var where = ""; //如果角色为分组后的开发人员 if (CurrentUser.Role != "管理员" && !String.IsNullOrEmpty(CurrentUser.OrgCode)) { where += " and u.orgcode= '" + CurrentUser.OrgCode + "'"; } //如果角色为没有分组后的开发人员 if (CurrentUser.Role != "管理员" && String.IsNullOrEmpty(CurrentUser.OrgCode)) { where += " and c.username= '******'"; } //需求bug编号 if (!string.IsNullOrEmpty(model.DemandCode) && Utils.IsSafeSqlString(model.DemandCode)) { where += " and c.DemandCode like '%" + model.DemandCode + "%' "; } //时间选择 if (!string.IsNullOrEmpty(model.datefrom)) { where += " and c.updatetime>='" + model.datefrom + "' "; } if (!string.IsNullOrEmpty(model.dateto)) { where += " and c.updatetime<='" + model.dateto + "' "; } //计划编号 if (!string.IsNullOrEmpty(model.PlanId)) { where += " and c.PlanId='" + model.PlanId + "'"; } var list = _checkItemService.GetCheckItemPageList(pageSize, pageIndex, out count, where); model.PageList.LoadPagedList(list); model.ItemList = (List <CICheckItem>)list; return(View(model)); }
/// <summary> /// 添加需求到计划 /// </summary> /// <returns></returns> public ActionResult AddItemToPlan() { var model = new CheckItemModel(); var planlist = new VersionPlanService().GetPlanList(); var openplan = from plan in planlist where plan.OpenDate == DateTime.Now.ToString("yyyy-MM-dd") select plan; if (openplan != null && openplan.Count() > 0) { planlist = openplan.ToList <CIVersionPlan>(); model.PlanSelectItem = planlist.ConvertAll(c => new SelectListItem { Text = c.PlanCode, Value = c.ID }); } else { model.PlanSelectItem.Add(new SelectListItem { Text = "暂无开放计划", Value = "" }); } return(View(model)); }
/// <summary> /// 发布列表 /// </summary> /// <returns></returns> public ActionResult DeployList(CheckItemListModel model) { model.VersionState = Request["VersionState"]; model.TestState = Request["TestState"]; model.CodeState = Request["CodeState"]; model.IsNewCode = Request["IsNewCode"]; const int pageSize = 10; int count = 0; int pageIndex = PressRequest.GetInt("page", 1); var where = GetWhere(model); var planlist = new VersionPlanService().GetPlanList(); model.PlanSelectItem = planlist.ConvertAll(c => new SelectListItem { Text = c.PlanCode, Value = c.ID }); model.PlanSelectItem.Add(new SelectListItem { Text = "计划编号(全部)", Value = "", Selected = true }); var itemlist = _checkItemService.GetCheckItemPageList(pageSize, pageIndex, out count, where); //检查代码重复 List <string> allcode = new List <string>(); //所有代码 List <string> repcode = new List <string>(); //重复的代码 foreach (var item in itemlist) { var codelist = TypeConverter.ObjectToString(item.CodeList); var codefile = codelist.Replace("(", "").Replace(")", "").Replace("(", "").Replace(")", "").Replace("新增", "").Replace("修改", ""); string[] files = codefile.Split('\n'); foreach (var file in files) { var vfile = file.Replace("\r", "").Replace(" ", "").Trim(); if (allcode.Contains(vfile)) { repcode.Add(vfile); } allcode.Add(vfile); } } #region 判断当前页是否有重复代码 var fitemlist = new List <CICheckItem>(); /*foreach (var item in itemlist) * { * foreach (var code in repcode) * { * if (item.CodeList != null) * { * if (item.CodeList.Contains(code)) * { * if (code.IndexOf("重复") <= 0) * { * item.CodeList = item.CodeList.Replace(code + "(", code + "(重复)("); * } * } * } * } * fitemlist.Add(item); * } * //代码重复 * if (model.CodeState == "1") * { * fitemlist = fitemlist.Where(i => i.CodeList.Contains("(重复)")).ToList(); ; * } * if (model.CodeState == "0") * { * fitemlist = fitemlist.Where(i => !i.CodeList.Contains("(重复)")).ToList(); ; * }*/ #endregion //是否新增代码 if (model.IsNewCode == "1") { fitemlist = fitemlist.Where(i => i.CodeList.Contains("(新增)")).ToList(); } if (model.IsNewCode == "0") { fitemlist = fitemlist.Where(i => !i.CodeList.Contains("(新增)")).ToList(); } model.PageList.LoadPagedList(itemlist); model.ItemList = itemlist.ToList(); return(View(model)); }