public ActionResult GetProjectPhaseList(int projectId) { try { var queryParams = new NameValueCollection(); if (!ParamHelper.CheckParaQ(ref queryParams)) { return(Json(new ResponseEntity <int>(RegularFunction.RegularSqlRegexText), JsonRequestBehavior.AllowGet)); } var query = new ProjectPhaseQuery(queryParams); var sqlCondition = new StringBuilder(); sqlCondition.Append("ISNULL(IsDelete,0)!=1"); if (projectId != 0) { sqlCondition.Append(string.Format(" and projectId={0}", projectId)); } PageRequest preq = new PageRequest { TableName = " [ProjectPhase] ", Where = sqlCondition.ToString(), Order = " Id ASC ", IsSelect = true, IsReturnRecord = true, PageSize = query.PageSize, PageIndex = query.PageIndex, FieldStr = "*" }; var result = new ProjectPhaseBLL().GetDataByPage(preq); if (result != null) { result.ForEach(pp => { pp.StartTimeStr = pp.StartTime.HasValue ? pp.StartTime.Value.ToString("yyyy-MM-dd") : string.Empty; pp.PlannedStartTimeStr = pp.PlannedStartTime.HasValue ? pp.PlannedStartTime.Value.ToString("yyyy-MM-dd") : string.Empty; pp.EndTimeStr = pp.EndTime.HasValue ? pp.EndTime.Value.ToString("yyyy-MM-dd") : string.Empty; pp.PlannedEndTimeStr = pp.PlannedEndTime.HasValue ? pp.PlannedEndTime.Value.ToString("yyyy-MM-dd") : string.Empty; }); } var response = new ResponseEntity <object>(true, string.Empty, new DataGridResultEntity <ProjectPhase> { TotalRecords = preq.Out_AllRecordCount, DisplayRecords = preq.Out_PageCount, ResultData = result }); return(Json(response, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(new ResponseEntity <object>(-999, string.Empty, ""), JsonRequestBehavior.AllowGet)); } }
public ActionResult GetFormLibraryList() { try { var queryParams = new NameValueCollection(); if (!ParamHelper.CheckParaQ(ref queryParams)) { return(Json(new ResponseEntity <int>(RegularFunction.RegularSqlRegexText), JsonRequestBehavior.AllowGet)); } var query = new FormLibraryQuery(queryParams); var sqlCondition = new StringBuilder(); sqlCondition.Append("ISNULL(IsDelete,0)!=1"); if (!string.IsNullOrEmpty(query.DepartId)) { sqlCondition.Append($" and DepartId = {query.DepartId}"); } if (!string.IsNullOrEmpty(query.ProjectType)) { sqlCondition.Append($" and ProjectType = {query.ProjectType}"); } if (!string.IsNullOrEmpty(query.Name)) { sqlCondition.Append($" and Name like '%{query.Name}%'"); } PageRequest preq = new PageRequest { TableName = " [View_FormLibrary] ", Where = sqlCondition.ToString(), Order = " Id DESC ", IsSelect = true, IsReturnRecord = true, PageSize = query.PageSize, PageIndex = query.PageIndex, FieldStr = "*" }; var result = new FormLibraryBLL().GetView_FormLibraryByPage(preq); var response = new ResponseEntity <object>(true, string.Empty, new DataGridResultEntity <View_FormLibrary> { TotalRecords = preq.Out_AllRecordCount, DisplayRecords = preq.Out_PageCount, ResultData = result }); return(Json(response, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(new ResponseEntity <object>(-999, string.Empty, ""), JsonRequestBehavior.AllowGet)); } }
public ActionResult GetLogList() { try { var queryParams = new NameValueCollection(); if (!ParamHelper.CheckParaQ(ref queryParams)) { return(Json(new ResponseEntity <int>(RegularFunction.RegularSqlRegexText), JsonRequestBehavior.AllowGet)); } var query = new LogQuery(queryParams); var sqlCondition = new StringBuilder(); sqlCondition.Append("ISNULL(IsDelete,0)!=1"); if (!string.IsNullOrEmpty(query.OperationModule)) { sqlCondition.Append($" and OperationModule = '{query.OperationModule}' "); } PageRequest preq = new PageRequest { TableName = " [Log] ", Where = sqlCondition.ToString(), Order = " Id DESC ", IsSelect = true, IsReturnRecord = true, PageSize = query.PageSize, PageIndex = query.PageIndex, FieldStr = "*" }; var result = new LogBLL().GetDataByPage(preq); var response = new ResponseEntity <object>(true, string.Empty, new DataGridResultEntity <Log> { TotalRecords = preq.Out_AllRecordCount, DisplayRecords = preq.Out_PageCount, ResultData = result }); return(Json(response, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(new ResponseEntity <object>(-999, string.Empty, ""), JsonRequestBehavior.AllowGet)); } }
public ActionResult GetBackUserInfoList() { if (CurrenUserInfo == null) { return(Json(new ResponseEntity <dynamic>(-2, "无权限", null), JsonRequestBehavior.AllowGet)); } var queryParams = new NameValueCollection(); if (!ParamHelper.CheckParaQ(ref queryParams)) { return(Json(new ResponseEntity <int>(RegularFunction.RegularSqlRegexText), JsonRequestBehavior.AllowGet)); } var query = new UserInfoQuery(queryParams); var sqlCondition = new StringBuilder(); sqlCondition.Append("ISNULL(IsDelete,0)!=1"); PageRequest preq = new PageRequest { TableName = " [BackUserInfo] ", Where = sqlCondition.ToString(), Order = " Id DESC ", IsSelect = true, IsReturnRecord = true, PageSize = query.PageSize, PageIndex = query.PageIndex, FieldStr = "*" }; var result = new BackUserInfoBLL().GetDataByPage(preq); var response = new ResponseEntity <object>(true, string.Empty, new DataGridResultEntity <BackUserInfo> { TotalRecords = preq.Out_AllRecordCount, DisplayRecords = preq.Out_PageCount, ResultData = result }); return(Json(response, JsonRequestBehavior.AllowGet)); }
public ActionResult GetProjectList() { try { var queryParams = new NameValueCollection(); if (!ParamHelper.CheckParaQ(ref queryParams)) { return(Json(new ResponseEntity <int>(RegularFunction.RegularSqlRegexText), JsonRequestBehavior.AllowGet)); } int userType = CurrenUserInfo.UserType; string loginName = CurrenUserInfo.LoginName; var query = new ProjectQuery(queryParams); var sqlCondition = new StringBuilder(); sqlCondition.Append("ISNULL(IsDelete,0)!=1 and CurrentStatus=1"); //CurrentStatus审批状态为1(同意) if (userType == GDS.Entity.Constant.ConstantDefine.ProjectManager) // { sqlCondition.Append($" and (createby = '{loginName}' or charindex('{loginName}', projectmanager) > 0 or charindex('{loginName}', TeamMembers) > 0) "); } else if (userType == GDS.Entity.Constant.ConstantDefine.User) // { sqlCondition.Append($"and charindex('{loginName}', TeamMembers) > 0"); } if (!string.IsNullOrEmpty(query.DepartId) && query.DepartId != "0") { sqlCondition.Append($" and BusinessDept = {query.DepartId}"); } if (!string.IsNullOrEmpty(query.Status)) { sqlCondition.Append($" and Status = {query.Status}"); } if (!string.IsNullOrEmpty(query.ProjectType)) { sqlCondition.Append($" and ProjectType = {query.ProjectType}"); } if (!string.IsNullOrEmpty(query.Name)) { sqlCondition.Append($" and Name like '%{query.Name}%'"); } if (!string.IsNullOrEmpty(query.ProjectManager)) { sqlCondition.Append($" and ProjectManager like '%{query.ProjectManager}%'"); } if (!string.IsNullOrEmpty(query.No)) { sqlCondition.Append($" and No like '%{query.No}%'"); } PageRequest preq = new PageRequest { TableName = " [View_Project] ", Where = sqlCondition.ToString(), Order = " Id DESC ", IsSelect = true, IsReturnRecord = true, PageSize = query.PageSize, PageIndex = query.PageIndex, FieldStr = "*" }; var result = new ProjectBLL().GetView_ProjectByPage(preq); result.ForEach(project => { project.CreateTimeStr = project.CreateTime.HasValue? project.CreateTime.Value.ToString("yyyy-MM-dd") : string.Empty; }); result = result.OrderByDescending(r => r.CreateTime).ToList(); var response = new ResponseEntity <object>(true, string.Empty, new DataGridResultEntity <View_Project> { TotalRecords = preq.Out_AllRecordCount, DisplayRecords = preq.Out_PageCount, ResultData = result }); return(Json(response, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(new ResponseEntity <object>(-999, string.Empty, ""), JsonRequestBehavior.AllowGet)); } }
public ActionResult GetApprovalList() { try { var queryParams = new NameValueCollection(); if (!ParamHelper.CheckParaQ(ref queryParams)) { return(Json(new ResponseEntity <int>(RegularFunction.RegularSqlRegexText), JsonRequestBehavior.AllowGet)); } int userType = CurrenUserInfo.UserType; string loginName = CurrenUserInfo.LoginName; var query = new ProjectQuery(queryParams); var sqlCondition = new StringBuilder(); sqlCondition.Append("ISNULL(IsDelete,0)!=1 and CurrentStatus=0"); //CurrentStatus审批状态为0(草稿) if (userType != GDS.Entity.Constant.ConstantDefine.Admin) //验证审批权限 { var departmentList = new DepartmentBLL().GetDepartmentByAuditor(loginName); if (departmentList != null && departmentList.Count > 0) { sqlCondition.Append($" and DepartId in ({string.Join(",", departmentList.Select(x => x.Id))}) "); } else { return(Json(new ResponseEntity <dynamic>(10, "权限不足", null), JsonRequestBehavior.AllowGet)); } } //if (userType == GDS.Entity.Constant.ConstantDefine.ProjectManager) // //{ // sqlCondition.Append($" and (createby = '{loginName}' or projectmanager = '{loginName}' or charindex(';{loginName};', ';' + TeamMembers + ';') > 0) "); //} //else if (userType == GDS.Entity.Constant.ConstantDefine.User) // //{ // sqlCondition.Append($"and charindex(';{loginName};', ';' + TeamMembers + ';') > 0"); //} if (userType == GDS.Entity.Constant.ConstantDefine.ProjectManager) // { sqlCondition.Append($" and (createby = '{loginName}' or charindex('{loginName}', projectmanager) > 0 or charindex('{loginName}', TeamMembers) > 0) "); } //else if (userType == GDS.Entity.Constant.ConstantDefine.User) // //{ // sqlCondition.Append($"and charindex(';{loginName};', TeamMembers) > 0"); //} if (!string.IsNullOrEmpty(query.DepartId) && query.DepartId != "0") { sqlCondition.Append($" and BusinessDept = {query.DepartId}"); } if (!string.IsNullOrEmpty(query.ProjectType)) { sqlCondition.Append($" and ProjectType = {query.ProjectType}"); } if (!string.IsNullOrEmpty(query.Name)) { sqlCondition.Append($" and Name like '%{query.Name}%'"); } if (!string.IsNullOrEmpty(query.CreateBy)) { sqlCondition.Append($" and CreateBy like '%{query.CreateBy}%'"); } PageRequest preq = new PageRequest { TableName = " [View_Project] ", Where = sqlCondition.ToString(), Order = " Id DESC ", IsSelect = true, IsReturnRecord = true, PageSize = query.PageSize, PageIndex = query.PageIndex, FieldStr = "*" }; var result = new ProjectBLL().GetView_ProjectByPage(preq); result.ForEach(project => { project.CreateTimeStr = project.CreateTime.HasValue ? project.CreateTime.Value.ToString("yyyy-MM-dd") : string.Empty; }); var response = new ResponseEntity <object>(true, string.Empty, new DataGridResultEntity <View_Project> { TotalRecords = preq.Out_AllRecordCount, DisplayRecords = preq.Out_PageCount, ResultData = result }); return(Json(response, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(new ResponseEntity <object>(-999, string.Empty, ""), JsonRequestBehavior.AllowGet)); } }
public ActionResult GetAuditorList() { try { var queryParams = new NameValueCollection(); if (!ParamHelper.CheckParaQ(ref queryParams)) { return(Json(new ResponseEntity <int>(RegularFunction.RegularSqlRegexText), JsonRequestBehavior.AllowGet)); } var query = new AuditorQuery(queryParams); int userType = CurrenUserInfo.UserType; string loginName = CurrenUserInfo.LoginName; var sqlCondition = new StringBuilder(); sqlCondition.Append("ISNULL(IsDelete,0)!=1"); if (userType != GDS.Entity.Constant.ConstantDefine.Admin) { var departmentList = new DepartmentBLL().GetDepartmentByAuditor(loginName); if (departmentList != null && departmentList.Count > 0) { sqlCondition.Append($" and DepartId in ({string.Join(",", departmentList.Select(x=>x.Id))}"); } else { return(Json(new ResponseEntity <dynamic>(10, "权限不足", null), JsonRequestBehavior.AllowGet)); } } if (!string.IsNullOrEmpty(query.DepartId)) { sqlCondition.Append($" and DepartId = {query.DepartId}"); } if (!string.IsNullOrEmpty(query.Status)) { sqlCondition.Append($" and Status = {query.Status}"); } if (!string.IsNullOrEmpty(query.Name)) { sqlCondition.Append($" and Name like '%{query.Name}%'"); } PageRequest preq = new PageRequest { TableName = " [View_Auditor] ", Where = sqlCondition.ToString(), Order = " createtime DESC ", IsSelect = true, IsReturnRecord = true, PageSize = query.PageSize, PageIndex = query.PageIndex, FieldStr = "*" }; var result = new ProjectBLL().GetView_AuditorByPage(preq); var response = new ResponseEntity <object>(true, string.Empty, new DataGridResultEntity <View_Auditor> { TotalRecords = preq.Out_AllRecordCount, DisplayRecords = preq.Out_PageCount, ResultData = result }); return(Json(response, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(new ResponseEntity <object>(-999, string.Empty, ""), JsonRequestBehavior.AllowGet)); } }
public ActionResult GetApprovalList() { var queryParams = new NameValueCollection(); if (!ParamHelper.CheckParaQ(ref queryParams)) { return(Json(new ResponseEntity <int>(RegularFunction.RegularSqlRegexText), JsonRequestBehavior.AllowGet)); } int userType = CurrenUserInfo.UserType; string loginName = CurrenUserInfo.LoginName; List <Department> departmentList = new List <Department>(); if (userType != GDS.Entity.Constant.ConstantDefine.Admin) //验证审批权限 { departmentList = new DepartmentBLL().GetDepartmentByAuditor(loginName); if (departmentList == null || departmentList.Count == 0) { return(Json(new ResponseEntity <dynamic>(10, "权限不足", null), JsonRequestBehavior.AllowGet)); } } var templateApprovalList = getTemplateApprovalList(queryParams, departmentList); var projectApprovalList = getPojectApprovalList(queryParams, departmentList); var approvalList = templateApprovalList.Select(template => { return(new { Id = template.Id, ItemType = "模板", Name = template.Name, DepartId = template.DepartId, Description = template.Description, CreateAt = template.CreateTime, CreateTimeStr = template.CreateTimeStr, CreateBy = template.CreateBy, Status = template.Status }); }).ToList(); approvalList.AddRange( projectApprovalList.Select(project => { return(new { Id = project.Id, ItemType = "项目", Name = project.Name, DepartId = project.BusinessDept, Description = project.Comments, CreateAt = project.CreateTime, CreateTimeStr = project.CreateTimeStr, CreateBy = project.CreateBy, Status = project.Status }); }).ToList() ); if (queryParams.AllKeys.Contains("SearchType") && !string.IsNullOrEmpty(queryParams["SearchType"])) { approvalList = approvalList.Where(approval => approval.ItemType == queryParams["SearchType"]).ToList(); } var response = new ResponseEntity <object>(true, string.Empty, approvalList.OrderByDescending(approval => approval.CreateAt)); return(Json(response, JsonRequestBehavior.AllowGet)); }