using Apache.NMS.ActiveMQ.Commands; using BLL; using FineUIPro.Web.DataShow; using FineUIPro.Web.SysManage; using Org.BouncyCastle.Asn1.Ocsp; using System; using System.Collections.Generic; using System.Configuration; using System.Data; using System.Data.SqlClient; using System.Linq; using System.Reflection; using System.Threading.Tasks; using System.Web; using System.Web.Services; using System.Web.UI; using System.Web.UI.WebControls; using System.Windows.Forms; using static System.Windows.Forms.AxHost; namespace FineUIPro.Web { public partial class WorkBench : PageBase { #region 定义变量 /// /// 当前登录人Id /// public string UserId { get { return (string)ViewState["UserId"]; } set { ViewState["UserId"] = value; } } #endregion #region Init /// /// Init /// /// /// protected void Page_Init(object sender, EventArgs e) { string themeStr = Request.QueryString["theme"]; string menuStr = Request.QueryString["menu"]; string https = ConfigurationManager.AppSettings["Https"]; if (!String.IsNullOrEmpty(themeStr) || !String.IsNullOrEmpty(menuStr)) { if (!String.IsNullOrEmpty(themeStr)) { HttpCookie cookie = new HttpCookie("Theme_Pro", "Cupertino") { Expires = DateTime.Now.AddYears(1) }; Response.Cookies.Add(cookie); } if (!String.IsNullOrEmpty(menuStr)) { HttpCookie cookie = new HttpCookie("MenuStyle_Pro", menuStr) { Expires = DateTime.Now.AddYears(1) }; if (https == "true") { cookie.Secure = true; } Response.Cookies.Add(cookie); } PageContext.Redirect("~/default.aspx"); return; } //////////////////////////////////////////////////////////////// if (!IsPostBack) { } } #endregion #region 加载页面 /// /// 加载页面 /// /// /// protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { var user = BLL.UserService.GetUserByUserId(this.CurrUser.UserId); if (user != null) { this.UserId = this.CurrUser.UserId; this.lName.Text = user.UserName; this.lblName.Text = "欢迎回来," + user.UserName; this.lAccount.Text = user.Account; this.lUnitName.Text = BLL.UnitService.GetUnitNameByUnitId(user.UnitId); this.lEmail.Text = user.Email; if (!string.IsNullOrEmpty(user.IdentityCard)) { var person = BLL.PersonService.GetPersonImgByIdentityCard(user.IdentityCard); if (person != null) { this.imgPic.Src = ("~/" + person.PhotoUrl); } } //this.lPostName.Text = user.WorkPostId; } //公司级看板权限 if (this.CurrUser.IsOffice == true || this.CurrUser.UserId == Const.sysglyId || this.CurrUser.UserId == Const.hfnbdId) { divgsj.Visible = true; } else { divgsj.Visible = false; } if (Request.Cookies["SelectLan"] != null) { HttpCookie lanCookie = Request.Cookies["SelectLan"]; if (lanCookie["lan"] != null) { drpSelectLan.SelectedValue = lanCookie["lan"]; } } } } #endregion #region 待办预警 [WebMethod] public static string getGztm(string userId, string sType) { string returnDbHtml = ""; var getDataList = Funs.DB.Sp_WorkBench_GetToDoItems(userId, sType).ToList(); foreach (var item in getDataList) { returnDbHtml += "

" + item.ProjectCode + " " + "" + item.MenuName + " " + item.Content + "

" + item.DataTime.ToString().Replace('/', '-').Split(' ')[0] + "

"; } return returnDbHtml; } /// /// 打开待办 /// /// /// protected void btnshowWindows(object sender, EventArgs e) { PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("{0}", hiddenUrl.Value, "办理 - "))); } #endregion #region 我的项目 [WebMethod] public static string getProject(string proState, string userId) { string returnDbHtml = ""; if (userId == Const.sysglyId || userId == Const.hfnbdId || userId == Const.sedinId) { string strSql = @"select ProjectId,ProjectCode,(ProjectCode+' '+ProjectName) as ProjectName,ProjectState, (case when AttachFile.AttachUrl is null then '../../res/images/16.png' else (case when AttachFile.AttachUrl is not null and AttachFile.AttachUrl like '%,%' then '../../' + SUBSTRING(AttachFile.AttachUrl, 1 , CHARINDEX(',',AttachFile.AttachUrl)-1) else '../../'+AttachFile.AttachUrl end ) end)as AttachUrl from Base_Project left join AttachFile on AttachFile.ToKeyId=Base_Project.ProjectId" + @" WHERE 1=1"; List listStr = new List(); if (proState != "1") { strSql += " AND (ProjectState = '" + proState + "' )"; } else { strSql += " AND (ProjectState = '1' OR ProjectState IS NULL)"; } strSql += " order by ProjectCode"; SqlParameter[] parameter = listStr.ToArray(); DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); for (int i = 0; i < tb.Rows.Count; i++) { returnDbHtml += "

" + tb.Rows[i][2].ToString() + "

进入项目

"; //returnDbHtml += "abc"; } } else { string urlType = ""; var getUser = UserService.GetUserByUserId(userId); if (getUser != null) { /// 获取角色类型 var getRoleP = Funs.DB.Sys_RolePower.FirstOrDefault(x => x.RoleId == getUser.RoleId && x.IsOffice == false); //如果是项目级别,获取到他的类型后,并且还要单位是五环的 if (!string.IsNullOrEmpty(urlType)) { //五环的能看所有项目,否则只能看项目用户中有自己或者所属单位是自己单位的 if (getRoleP != null && getUser.UnitId == Const.UnitId_CWCEC) { string strSql = @"select ProjectId,ProjectCode,(ProjectCode+' '+ProjectName) as ProjectName,ProjectState, (case when AttachFile.AttachUrl is null then '../../res/images/16.png' else (case when AttachFile.AttachUrl is not null and AttachFile.AttachUrl like '%,%' then '../../' + SUBSTRING(AttachFile.AttachUrl, 1 , CHARINDEX(',',AttachFile.AttachUrl)-1) else '../../'+AttachFile.AttachUrl end ) end)as AttachUrl from Base_Project left join AttachFile on AttachFile.ToKeyId=Base_Project.ProjectId" + @" WHERE 1=1"; List listStr = new List(); if (proState != "1") { strSql += " AND (ProjectState = '" + proState + "' )"; } else { strSql += " AND (ProjectState = '1' OR ProjectState IS NULL)"; } strSql += " order by ProjectCode"; SqlParameter[] parameter = listStr.ToArray(); DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); for (int i = 0; i < tb.Rows.Count; i++) { returnDbHtml += "

" + tb.Rows[i][2].ToString() + "

进入项目

"; } } else { string strSql = @"select distinct p.ProjectId,p.ProjectCode,(p.ProjectCode+' '+p.ProjectName) as ProjectName,p.ProjectState (case when AttachFile.AttachUrl is null then '../../res/images/16.png' else (case when AttachFile.AttachUrl is not null and AttachFile.AttachUrl like '%,%' then '../../' + SUBSTRING(AttachFile.AttachUrl, 1 , CHARINDEX(',',AttachFile.AttachUrl)-1) else '../../'+AttachFile.AttachUrl end ) end)as AttachUrl from Base_Project p left join Project_ProjectUser as pu on pu.ProjectId = p.ProjectId left join AttachFile on AttachFile.ToKeyId=p.ProjectId where ((pu.UserId=@userId and pu.IsPost='true') or p.UnitId=@unitId)"; List listStr = new List(); listStr.Add(new SqlParameter("@userId", userId)); listStr.Add(new SqlParameter("@unitId", getUser.UnitId)); if (proState != "1") { strSql += " AND (ProjectState = '" + proState + "' )"; } else { strSql += " AND (ProjectState = '1' OR ProjectState IS NULL)"; } strSql += " order by ProjectCode"; SqlParameter[] parameter = listStr.ToArray(); DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); for (int i = 0; i < tb.Rows.Count; i++) { returnDbHtml += "

" + tb.Rows[i][2].ToString() + "

进入项目

"; } } } else { if (getRoleP != null) { string strSql = @"select ProjectId,ProjectCode,(ProjectCode+' '+ProjectName) as ProjectName,ProjectState, (case when AttachFile.AttachUrl is null then '../../res/images/16.png' else (case when AttachFile.AttachUrl is not null and AttachFile.AttachUrl like '%,%' then '../../' + SUBSTRING(AttachFile.AttachUrl, 1 , CHARINDEX(',',AttachFile.AttachUrl)-1) else '../../'+AttachFile.AttachUrl end ) end)as AttachUrl from Base_Project left join AttachFile on AttachFile.ToKeyId=Base_Project.ProjectId" + @" WHERE 1=1"; List listStr = new List(); if (proState != "1") { strSql += " AND (ProjectState = '" + proState + "' )"; } else { strSql += " AND (ProjectState = '1' OR ProjectState IS NULL)"; } strSql += " order by ProjectCode"; SqlParameter[] parameter = listStr.ToArray(); DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); for (int i = 0; i < tb.Rows.Count; i++) { returnDbHtml += "

" + tb.Rows[i][2].ToString() + "

进入项目

"; } } else { string strSql = @"select distinct p.ProjectId,p.ProjectCode,(p.ProjectCode+' '+p.ProjectName) as ProjectName,p.ProjectState, (case when AttachFile.AttachUrl is null then '../../res/images/16.png' else (case when AttachFile.AttachUrl is not null and AttachFile.AttachUrl like '%,%' then '../../' + SUBSTRING(AttachFile.AttachUrl, 1 , CHARINDEX(',',AttachFile.AttachUrl)-1) else '../../'+AttachFile.AttachUrl end ) end)as AttachUrl from Base_Project p left join Project_ProjectUser as pu on pu.ProjectId = p.ProjectId left join AttachFile on AttachFile.ToKeyId=p.ProjectId where pu.UserId=@userId and pu.IsPost='true' "; List listStr = new List(); listStr.Add(new SqlParameter("@userId", userId)); if (proState != "1") { strSql += " AND (p.ProjectState = '" + proState + "' )"; } else { strSql += " AND (p.ProjectState = '1' OR p.ProjectState IS NULL)"; } strSql += " order by ProjectCode"; SqlParameter[] parameter = listStr.ToArray(); DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); for (int i = 0; i < tb.Rows.Count; i++) { returnDbHtml += "

" + tb.Rows[i][2].ToString() + "

进入项目

"; } } } } } return returnDbHtml; } #endregion #region 跳转公司级看板 /// /// 跳转公司级看板 /// /// /// protected void gsjkb_Click(object sender, EventArgs e) { if (this.CurrUser.IsOffice == true || this.CurrUser.UserId == Const.sysglyId || this.CurrUser.UserId == Const.hfnbdId) { PageContext.Redirect("~/index.aspx", "_top"); } } #endregion #region 任务中心 /// /// 任务中心 /// /// /// protected void rwzx_Click(object sender, EventArgs e) { ShowNotify("开发中"); } #endregion #region 系统管理 /// /// 系统管理 /// /// /// protected void xtgl_Click(object sender, EventArgs e) { ShowNotify("开发中"); } #endregion #region 中英文切换 /// /// 中英文切换 /// /// /// protected void drpSelectLan_SelectedIndexChanged(object sender, EventArgs e) { string https = ConfigurationManager.AppSettings["Https"]; HttpCookie lanCookie = Request.Cookies["SelectLan"]; lanCookie["lan"] = drpSelectLan.SelectedValue; lanCookie.Expires = DateTime.Now.AddDays(1); if (https == "true") { lanCookie.Secure = true; } Response.Cookies.Add(lanCookie); Response.Redirect(Request.UrlReferrer.ToString());//刷新当前页面 } #endregion #region 个人信息 /// /// 个人信息 /// /// /// protected void btnPersonal_Click(object sender, EventArgs e) { PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("Personal/PersonalInfo.aspx"))); } #endregion } }