diff --git a/SGGL/BLL/ProjectData/ProjectService.cs b/SGGL/BLL/ProjectData/ProjectService.cs index 5d01ccf9..fcf65cef 100644 --- a/SGGL/BLL/ProjectData/ProjectService.cs +++ b/SGGL/BLL/ProjectData/ProjectService.cs @@ -326,7 +326,7 @@ /// 获取userId参与项目下拉框 /// /// - public static List GetProjectByUserIdStateDropDownList(string userId, string state) + public static List GetProjectByUserIdStateDropDownList(string userId, string state,string urlType="") { if (userId == Const.sysglyId || userId == Const.hfnbdId || userId == Const.sedinId) { @@ -340,20 +340,42 @@ { /// 获取角色类型 var getRoleP = Funs.DB.Sys_RolePower.FirstOrDefault(x => x.RoleId == getUser.RoleId && x.IsOffice == false); - if (getRoleP != null) + //如果是项目级别,获取到他的类型后,并且还要单位是五环的 + if (!string.IsNullOrEmpty(urlType)) { - return (from x in Funs.DB.Base_Project - where x.ProjectState == state - orderby x.ProjectCode descending - select x).ToList(); + //五环的能看所有项目,否则只能看项目用户中有自己或者所属单位是自己单位的 + if (getRoleP != null && getUser.UnitId== Const.UnitId_CWCEC) + { + return (from x in Funs.DB.Base_Project + where x.ProjectState == state + orderby x.ProjectCode descending + select x).ToList(); + } + else + { + return (from x in Funs.DB.Base_Project + join y in Funs.DB.Project_ProjectUser on x.ProjectId equals y.ProjectId + where ( (y.UserId == userId && y.IsPost == true)|| x.UnitId== getUser.UnitId) && x.ProjectState == state + orderby x.ProjectCode descending + select x).Distinct().ToList(); + } } - else - { - return (from x in Funs.DB.Base_Project - join y in Funs.DB.Project_ProjectUser on x.ProjectId equals y.ProjectId - where y.UserId == userId && y.IsPost == true && x.ProjectState == state - orderby x.ProjectCode descending - select x).Distinct().ToList(); + else { + if (getRoleP != null) + { + return (from x in Funs.DB.Base_Project + where x.ProjectState == state + orderby x.ProjectCode descending + select x).ToList(); + } + else + { + return (from x in Funs.DB.Base_Project + join y in Funs.DB.Project_ProjectUser on x.ProjectId equals y.ProjectId + where y.UserId == userId && y.IsPost == true && x.ProjectState == state + orderby x.ProjectCode descending + select x).Distinct().ToList(); + } } } else @@ -459,11 +481,11 @@ /// /// /// - public static void InitProjectShortNameByStateDropDownList(FineUIPro.DropDownList dropName, string userId, string state, bool isShowPlease) + public static void InitProjectShortNameByStateDropDownList(FineUIPro.DropDownList dropName, string userId, string state, bool isShowPlease,string urlType="") { dropName.DataValueField = "ProjectId"; dropName.DataTextField = "ProjectName"; - var projectlist = GetProjectByUserIdStateDropDownList(userId, state); + var projectlist = GetProjectByUserIdStateDropDownList(userId, state, urlType); dropName.DataSource = projectlist; dropName.DataBind(); if (projectlist.Count() == 0) diff --git a/SGGL/FineUIPro.Web/indexProject.aspx.cs b/SGGL/FineUIPro.Web/indexProject.aspx.cs index 9ab9b61a..b02081ca 100644 --- a/SGGL/FineUIPro.Web/indexProject.aspx.cs +++ b/SGGL/FineUIPro.Web/indexProject.aspx.cs @@ -294,7 +294,7 @@ namespace FineUIPro.Web Response.Expires = 0; //设置过期时间 Response.Cache.SetNoStore(); //在服务器端不缓存该页面 Response.AppendHeader("Pragma", "no-cache"); //在客户端不缓存 - ProjectService.InitProjectShortNameByStateDropDownList(this.drpProject, this.CurrUser.UserId, BLL.Const.ProjectState_1, false); + ProjectService.InitProjectShortNameByStateDropDownList(this.drpProject, this.CurrUser.UserId, BLL.Const.ProjectState_1, false,"1"); if (!string.IsNullOrEmpty(Request.Params["projectId"])) { this.drpProject.SelectedValue = Request.Params["projectId"]; @@ -731,7 +731,7 @@ namespace FineUIPro.Web protected void btnHome_Click(object sender, EventArgs e) { //修改本部用户都能进 - //this.CurrUser.UnitId == Const.UnitId_CWCEC && + //this.CurrUser.UnitId == Const.drpProject && if (string.IsNullOrEmpty(this.CurrUser.LastProjectId) && ((this.CurrUser.IsOffice == true) || this.CurrUser.UserId == Const.sysglyId || this.CurrUser.UserId == Const.hfnbdId)) {