Пример #1
0
        /// <summary>
        /// 登录验证
        /// </summary>
        public void VerifyLogin()
        {
            UserInfo user     = null;
            string   userName = PressRequest.GetFormString("username");
            string   password = Jqpress.Framework.Utils.EncryptHelper.MD5(PressRequest.GetFormString("password"));
            int      expires  = PressRequest.GetFormString("rememberme") == "forever" ? 43200 : 0;


            user = UserService.GetUser(userName, password);

            if (user != null)
            {
                if (user.Status == 0)
                {
                    Msg.Text = "此用户已停用!";
                    return;
                }
                WriteUserCookie(user.UserId, user.UserName, user.Password, expires);
                Response.Redirect("blog/index.aspx");
            }
            else
            {
                Msg.Text = "用户名或密码错误!";
            }
        }
Пример #2
0
        public ActionResult ProjectVersionDownLoad(string id)
        {
            ProjectModel model     = new ProjectModel();
            const int    pageSize  = 10;
            int          count     = 0;
            int          pageIndex = PressRequest.GetInt("page", 1);

            var where = "";
            if (!string.IsNullOrEmpty(PressRequest.GetFormString("BeginDate")))
            {
                where += " and EndTime >= '" + PressRequest.GetFormString("BeginDate") + "' ";
            }
            if (!string.IsNullOrEmpty(PressRequest.GetFormString("EndDate")))
            {
                where += " and EndTime <= '" + PressRequest.GetFormString("EndDate") + "' ";
            }
            var list = _releaseService.GetReleaseListForDownLoad(id, pageSize, pageIndex, out count, where);

            model.Project     = _projectservice.GetById(id);
            model.ProjectList = _projectservice.GetProInfoList();
            model.PageList.LoadPagedList(list);
            model.ReleaseList = (List <CIRelease>)list;
            model.BeginDate   = PressRequest.GetFormString("BeginDate");
            model.EndDate     = PressRequest.GetFormString("EndDate");
            return(View(model));
        }
Пример #3
0
        /// <summary>
        /// 检验输入的小组编号是否存在
        /// </summary>
        /// <param name="OrgCode"></param>
        /// <returns></returns>
        public ActionResult CheckOrgCode(string OrgCode)
        {
            var orgcode = PressRequest.GetFormString("username");
            var msg     = _userorgService.ExistUserOrgCode(orgcode) ? "1" : "0";

            return(Content(msg));
        }
Пример #4
0
        /// <summary>
        /// 检查用户名是否存在
        /// </summary>
        /// <returns></returns>
        public ActionResult CheckUser()
        {
            var username = PressRequest.GetFormString("username");
            var msg      = _userService.ExistsUserName(username)?"1":"0";

            return(Content(msg));
        }
Пример #5
0
        public ActionResult ExportToExcel(string id)
        {
            ReportModel model = new ReportModel();

            model.Report = _reportService.GetById(id);
            var SQL = model.Report.ReportSQL;

            if (!string.IsNullOrEmpty(PressRequest.GetFormString("BeginDate")))
            {
                SQL             = SQL.Replace("@BeginDate", "'" + PressRequest.GetFormString("BeginDate") + "'");
                model.BeginDate = PressRequest.GetFormString("BeginDate");
            }
            else
            {
                SQL = SQL.Replace("@BeginDate", "''");
            }

            if (!string.IsNullOrEmpty(PressRequest.GetFormString("EndDate")))
            {
                SQL           = SQL.Replace("@EndDate", "'" + PressRequest.GetFormString("EndDate") + "'");
                model.EndDate = PressRequest.GetFormString("EndDate");
            }
            else
            {
                SQL = SQL.Replace("@EndDate", "'" + DateTime.Now + "'");
            }
            model.dtReport = _reportService.GetReportResultBySql(SQL);
            ExcelHelper.ExportByWeb(model.dtReport, model.Report.ReportName, model.Report.ReportName + string.Format("{0:yyyyMMddHHmmssffff}", DateTime.Now) + ".xls");
            SuccessNotification("导出excel成功");
            return(Redirect(Url.Action("reportInfo", "report", new { id = model.Report.ID })));
        }
Пример #6
0
        public ActionResult ReportInfo(string id)
        {
            ReportModel model = new ReportModel();

            model.Report = _reportService.GetById(id);
            var SQL = model.Report.ReportSQL;

            if (!string.IsNullOrEmpty(PressRequest.GetFormString("BeginDate")))
            {
                SQL             = SQL.Replace("@BeginDate", "'" + PressRequest.GetFormString("BeginDate") + "'");
                model.BeginDate = PressRequest.GetFormString("BeginDate");
            }
            else
            {
                SQL = SQL.Replace("@BeginDate", "''");
            }

            if (!string.IsNullOrEmpty(PressRequest.GetFormString("EndDate")))
            {
                SQL           = SQL.Replace("@EndDate", "'" + PressRequest.GetFormString("EndDate") + "'");
                model.EndDate = PressRequest.GetFormString("EndDate");
            }
            else
            {
                SQL = SQL.Replace("@EndDate", "'" + DateTime.Now + "'");
            }
            model.dtReport = _reportService.GetReportResultBySql(SQL);
            return(View(model));
        }
Пример #7
0
        public ActionResult ProjectReleaseInfo(string id)
        {
            ProjectModel model = new ProjectModel();

            model.status      = Request["Status"];
            model.VersionType = Request["VersionType"];
            model.Teststatus  = Request["TestStatus"];
            const int pageSize  = 10;
            int       count     = 0;
            int       pageIndex = PressRequest.GetInt("page", 1);

            var where = "";
            //版本类型
            if (model.VersionType == "1")
            {
                where += " and Type ='正式版本'";
            }
            else if (model.VersionType == "0")
            {
                where += " and Type ='测试版本'";
            }
            //发布状态
            if (model.status == "1")
            {
                where += " and Status ='发布成功'";
            }
            else if (model.status == "0")
            {
                where += " and Status ='发布失败'";
            }
            //测试状态
            if (model.Teststatus == "1")
            {
                where += " and TestStatus ='测试通过'";
            }
            else if (model.Teststatus == "0")
            {
                where += " and TestStatus ='不通过'";
            }
            if (!string.IsNullOrEmpty(PressRequest.GetFormString("BeginDate")))
            {
                where += " and AddTime >= '" + PressRequest.GetFormString("BeginDate") + "' ";
            }
            if (!string.IsNullOrEmpty(PressRequest.GetFormString("EndDate")))
            {
                where += " and AddTime <= '" + PressRequest.GetFormString("EndDate") + "' ";
            }
            var list = _releaseService.GetReleaseList(id, pageSize, pageIndex, out count, where);

            model.Project     = _projectservice.GetById(id);
            model.ProjectList = _projectservice.GetProInfoList();
            model.PageList.LoadPagedList(list);
            model.ReleaseList = (List <CIRelease>)list;
            model.BeginDate   = PressRequest.GetFormString("BeginDate");
            model.EndDate     = PressRequest.GetFormString("EndDate");
            return(View(model));
        }
Пример #8
0
        public ActionResult UserOrgEdit(CIUserOrg userorg)
        {
            //CIUserOrg model = new CIUserOrg();
            //model.OrgName = userorg.OrgName;
            //model.OrgCode = userorg.OrgCode;
            var orgcode = PressRequest.GetFormString("hdOrgCode");

            _userorgService.UpdateUserOrgBystringCode(userorg, orgcode);
            return(Redirect(Url.Action("UserOrgList", "UserOrg")));
        }
Пример #9
0
        /// <summary>
        /// 项目详情tab页评审列表
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult ProjectReviewInfo(string id, ProjectModel model)
        {
            //ProjectModel model = new ProjectModel();
            model.StatusSelectItem.Add(new SelectListItem {
                Text = "--选择状态--", Value = "", Selected = true
            });
            model.StatusSelectItem.Add(new SelectListItem {
                Text = "已评审", Value = "已评审"
            });
            model.StatusSelectItem.Add(new SelectListItem {
                Text = "未通过", Value = "未通过"
            });
            model.StatusSelectItem.Add(new SelectListItem {
                Text = "延期", Value = "延期"
            });
            model.StatusSelectItem.Add(new SelectListItem {
                Text = "不评审", Value = "不评审"
            });

            const int pageSize  = 10;
            int       count     = 0;
            int       pageIndex = PressRequest.GetInt("page", 1);

            var where = "";
            if (!string.IsNullOrEmpty(PressRequest.GetFormString("Status")))
            {
                where += " and r.Status ='" + PressRequest.GetFormString("Status") + "' ";
            }
            if (!string.IsNullOrEmpty(model.ProjectName) && Utils.IsSafeSqlString(model.ProjectName))
            {
                where += " and p.ProjectName like '%" + model.ProjectName + "%' ";
            }
            if (!string.IsNullOrEmpty(model.DemandCode) && Utils.IsSafeSqlString(model.DemandCode))
            {
                where += " and rp.DemandCode like '%" + model.DemandCode + "%' ";
            }
            if (!string.IsNullOrEmpty(model.BeginDate))
            {
                where += " and r.BeginDate >= '" + model.BeginDate + "' ";
            }
            if (!string.IsNullOrEmpty(model.EndDate))
            {
                where += " and r.BeginDate <= '" + model.EndDate + "' ";
            }

            var list = _reviewService.GetReviewListByProjectId(id, pageSize, pageIndex, out count, where);

            model.Project     = _projectservice.GetById(id);
            model.ProjectList = _projectservice.GetProInfoList();
            model.PageList.LoadPagedList(list);
            model.reviewlist = (List <CIReview>)list;
            return(View(model));
        }
Пример #10
0
 public ActionResult UserEdit(CIUser user)
 {
     if (string.IsNullOrEmpty(user.PassWord))
     {
         user.PassWord = PressRequest.GetFormString("hidPwd");
     }
     else
     {
         user.PassWord = EncryptHelper.MD5(user.PassWord);
     }
     _userService.UpdateUserOrg(user);
     return(Redirect(Url.Action("Userslist", "Users")));
 }
Пример #11
0
        public ActionResult CreateUser()
        {
            var model = new CIUser();

            model.UserName = PressRequest.GetFormString("username");
            model.PassWord = EncryptHelper.MD5(PressRequest.GetFormString("password"));
            model.FullName = PressRequest.GetFormString("fullname");
            model.RegTime  = DateTime.Now;
            model.Role     = PressRequest.GetFormString("role");

            _userService.InsertUser(model);

            return(Redirect(Url.Action("login", "home")));
        }
Пример #12
0
        public ActionResult ReviewAdd(CIReview review)
        {
            try
            {
                review.ID     = PressRequest.GetFormString("hidID");
                review.Member = PressRequest.GetFormString("hidUsername");

                var beginTime = PressRequest.GetFormString("BeginTime").Replace("/", "-");
                var endTime   = PressRequest.GetFormString("EndTime").Replace("/", "-");

                review.BeginDate = string.IsNullOrEmpty(beginTime) ? DateTime.Now : TypeConverter.ObjectToTime(beginTime);

                review.EndDate = string.IsNullOrEmpty(endTime) ? DateTime.Now : TypeConverter.ObjectToTime(endTime);

                if (PressRequest.GetFormString("hidIfAdd") == "1")
                {
                    review.UpdateTime = DateTime.Now;
                    _reviewService.UpdatePro(review);
                }
                else
                {
                    review.AddTime    = DateTime.Now;
                    review.UpdateTime = DateTime.Now;
                    _reviewService.InsertPro(review);
                }
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                ErrorNotification("保存出错:" + ex.Message);
                return(View());
            }


            if (PressRequest.GetFormString("hidIfPro") == "1")
            {
                return(Redirect(Url.Action("projectinfo", "project", new { id = PressRequest.GetFormString("hidProID") })));
            }
            else
            {
                return(Redirect(Url.Action("ReviewList", "Review")));
            }
        }
Пример #13
0
        /// <summary>
        /// 登录验证
        /// </summary>
        public bool VerifyLogin()
        {
            CIUser user     = null;
            string userName = PressRequest.GetFormString("username");
            string password = EncryptHelper.MD5(PressRequest.GetFormString("password"));
            int    expires  = PressRequest.GetFormString("rememberme") == "forever" ? 43200 : 0;

            user = _userService.GetUser(userName, password);

            if (user != null)
            {
                _userService.WriteUserCookie(user.UserName, user.PassWord, expires);
                ViewBag.Role    = user.Role;
                ViewBag.OrgCode = user.OrgCode;
                return(true);
            }
            else
            {
                ModelState.AddModelError("", "用户名或密码错误!");
            }
            return(false);
        }
Пример #14
0
        /// <summary>
        /// 登录验证
        /// </summary>
        public bool VerifyLogin()
        {
            UserInfo user     = null;
            string   userName = PressRequest.GetFormString("username");
            string   password = Jqpress.Framework.Utils.EncryptHelper.MD5(PressRequest.GetFormString("password"));
            int      expires  = PressRequest.GetFormString("rememberme") == "forever" ? 43200 : 0;

            user = _userService.GetUser(userName, password);

            if (user != null)
            {
                if (user.Status == 0)
                {
                    ModelState.AddModelError("", "此用户已停用");
                }
                _userService.WriteUserCookie(user.UserId, user.UserName, user.Password, expires);
                return(true);
            }
            else
            {
                ModelState.AddModelError("", "用户名或密码错误!");
            }
            return(false);
        }
Пример #15
0
        public ActionResult GetCheckListCode()
        {
            var         version     = PressRequest.GetQueryInt("v");
            VSSDatabase vssDatabase = new VSSDatabaseClass();
            var         VSSini      = GetValue("VSSini");
            var         VSSuser     = GetValue("VSSuser");
            var         VSSpwd      = GetValue("VSSpwd");
            var         CCMS_PRJ    = GetValue("CCMS_PRJ");
            var         CCMS_Local  = GetValue("CCMS_Local");
            var         ccmsversion = "";
            var         ids         = PressRequest.GetFormString("ItemId");
            bool        success     = true;

            try
            {
                vssDatabase.Open(@VSSini, VSSuser, VSSpwd);
                VSSItem vssitem = vssDatabase.get_VSSItem(CCMS_PRJ, false);
            }
            catch (COMException ex)
            {
                ErrorNotification("VSS连接失败");
                success = false;
            }

            if (ids != "")
            {
                var idarr = ids.TrimEnd(',').Split(',');

                foreach (var id in idarr)
                {
                    var checkitem = _checkItemService.GetCheckItem(id);
                    var codelist  = TypeConverter.ObjectToString(checkitem.CodeList);

                    if (version == 7)
                    {
                        codelist    = codelist.Replace("CCMS_V6", "CCMS_V7");
                        ccmsversion = "CCMS_V7";
                    }
                    if (version == 6)
                    {
                        codelist    = codelist.Replace("CCMS_V7", "CCMS_V6");
                        ccmsversion = "CCMS_V6";
                    }

                    var      codefile = codelist.Replace("(", "").Replace(")", "").Replace("(", "").Replace(")", "").Replace("新增", "").Replace("修改", "");
                    string[] files    = codefile.Split('\n');
                    foreach (string file in files)
                    {
                        var    vfile     = file.Replace("\r", "").Replace(" ", "").Trim();
                        var    localfile = vfile.Replace("/", "\\");
                        string vssfile   = CCMS_PRJ + vfile;
                        string localFile = CCMS_Local + localfile;

                        try
                        {
                            VSSItem vssFolder = vssDatabase.get_VSSItem(vssfile, false);
                            //更新之前先删除文件
                            if (System.IO.File.Exists(localFile))
                            {
                                System.IO.FileInfo f = new System.IO.FileInfo(localFile);
                                f.Attributes = FileAttributes.Normal;//解除只读权限
                                f.Delete();
                            }
                            vssFolder.Get(localFile, 0);//获取到本地文件夹

                            #region 自动添加到工程文件
                            var vbproj      = "";
                            var projectName = "";

                            if (localfile.EndsWith(".aspx"))
                            {
                                vbproj      = "SCH.vbproj";
                                projectName = CCMS_Local + ccmsversion + @"\web\" + vbproj;
                            }
                            if (localfile.EndsWith(".vb") && localfile.IndexOf(".aspx") < 0)
                            {
                                var t1       = localfile.Substring(ccmsversion.Length, localfile.Length - ccmsversion.Length);
                                var foldname = t1.Substring(1, t1.LastIndexOf(@"\") - 1);
                                vbproj      = foldname + ".vbproj";
                                projectName = CCMS_Local + ccmsversion + @"\" + foldname + @"\" + vbproj;
                            }

                            if (!string.IsNullOrEmpty(projectName))
                            {
                                Project project = new Project();
                                project.Load(projectName);

                                var foldname = localfile.Substring(0, localfile.LastIndexOf(@"\"));
                                var include  = localfile.Substring(foldname.LastIndexOf(@"\") + 1, localfile.Length - foldname.LastIndexOf(@"\") - 1);

                                var isnew = true;
                                foreach (BuildItemGroup itemGroup in project.ItemGroups)
                                {
                                    foreach (BuildItem item in itemGroup)
                                    {
                                        if ((item.Include.ToLower() == include.ToLower()) || (include.ToLower().LastIndexOf(item.Include.ToLower()) > 0))
                                        {
                                            isnew = false;
                                            break;
                                        }
                                    }
                                }
                                if (isnew && localfile.EndsWith(".aspx"))
                                {
                                    var includedesigner = include + ".designer.vb";
                                    var includevb       = include + ".vb";

                                    var itemGroup = project.AddNewItemGroup();
                                    var buildItem = itemGroup.AddNewItem("Content", include);

                                    var buildItemdesigner = itemGroup.AddNewItem("Compile", includedesigner);
                                    var filename          = include.Substring(include.LastIndexOf(@"\") + 1, include.Length - include.IndexOf(@"\") - 1);
                                    buildItemdesigner.SetMetadata("DependentUpon", filename);

                                    var buildItemvb = itemGroup.AddNewItem("Compile", includevb);
                                    buildItemvb.SetMetadata("DependentUpon", filename);
                                    buildItemvb.SetMetadata("SubType", "ASPXCodebehind");
                                    project.Save(projectName);
                                }
                                else if (isnew && localfile.EndsWith(".vb") && vbproj != "SCH.vbproj") //非web工程
                                {
                                    var itemGroup = project.AddNewItemGroup();
                                    var buildItem = itemGroup.AddNewItem("Compile", include.Substring(include.IndexOf(@"\") + 1));
                                    project.Save(projectName);
                                }
                            }

                            #endregion
                        }
                        catch (COMException ex)
                        {
                            ErrorNotification("代码不存在:" + file);
                            success = false;
                        }
                    }

                    checkitem.GetVssCnt += 1;//增加获取次数
                    _checkItemService.UpdateCheckItem(checkitem, null);
                }
                if (success)
                {
                    SuccessNotification("获取代码成功");
                }
            }
            else
            {
                ErrorNotification("获取代码失败");
            }
            // return Redirect(Url.Action("deploylist", "checkitem"));
            var url = PressRequest.GetUrlReferrer();
            return(Redirect(url));
        }