Esempio n. 1
0
        /// <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));
        }
Esempio n. 2
0
 /// <summary>
 /// 获取筛选条件
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public string GetWhere(CheckItemListModel model)
 {
     var where = "";
     //版本状态
     if (model.VersionState == "1")
     {
         where += " and versionnum is not null";
     }
     else if (model.VersionState == "0")
     {
         where += " and versionnum is  null";
     }
     //测试状态
     if (model.TestState == "1")
     {
         where += " and demandstate='测试通过'";
     }
     if (model.TestState == "0")
     {
         where += " and demandstate='测试未通过'";
     }
     //需求bug编号
     if (!string.IsNullOrEmpty(model.DemandCode) && Utils.IsSafeSqlString(model.DemandCode))
     {
         where += " and 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 PlanId='" + model.PlanId + "'";
     }
     return(where);
 }
Esempio n. 3
0
        public ActionResult ExportToExcel(CheckItemListModel model)
        {
            const int pageSize  = 10;
            int       count     = 0;
            int       pageIndex = PressRequest.GetInt("page", 1);

            var where = GetWhere(model);

            var itemlist = _checkItemService.GetCheckItemPageList(pageSize, pageIndex, out count, where);

            var fitemlist = (List <CICheckItem>)itemlist;

            //代码重复
            if (model.CodeState == "1")
            {
                fitemlist = fitemlist.Where(i => i.CodeList.Contains("(重复)")).ToList();;
            }
            if (model.CodeState == "0")
            {
                fitemlist = fitemlist.Where(i => !i.CodeList.Contains("(重复)")).ToList();;
            }
            //是否新增代码
            if (model.IsNewCode == "1")
            {
                fitemlist = fitemlist.Where(i => i.CodeList.Contains("(新增)")).ToList();
            }
            if (model.IsNewCode == "0")
            {
                fitemlist = fitemlist.Where(i => !i.CodeList.Contains("(新增)")).ToList();
            }

            DataTable dt = new DataTable();

            ExcelHelper.ExportByWeb(ConvertToDatatable(fitemlist), "提交物清单:", "提交物清单" + string.Format("{0:yyyyMMddHHmmssffff}", DateTime.Now) + ".xls");



            SuccessNotification("导出excel成功");
            return(Redirect(Url.Action("deploylist", "checkitem")));
        }
Esempio n. 4
0
        /// <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));
        }