From 5030ef836e254faa7a9980fe0261b5263f922d50 Mon Sep 17 00:00:00 2001 From: xiaju <1784803958@qq.com> Date: Mon, 31 Mar 2025 19:08:04 +0800 Subject: [PATCH] 1 --- SGGL/BLL/Common/Const.cs | 17 +- .../ProjectData/ProjectSet.aspx.cs | 167 +++++++++--------- .../ProjectData/ProjectSetSave.aspx | 4 +- .../ProjectData/ProjectSetSave.aspx.cs | 12 ++ 4 files changed, 117 insertions(+), 83 deletions(-) diff --git a/SGGL/BLL/Common/Const.cs b/SGGL/BLL/Common/Const.cs index 5bbd5c0a..5298c192 100644 --- a/SGGL/BLL/Common/Const.cs +++ b/SGGL/BLL/Common/Const.cs @@ -18,10 +18,25 @@ namespace BLL public const string sysglyId = "AF17168B-87BD-4GLY-1111-F0A0A1158F9B"; /// - /// 系统管理员ID + /// 系统管理员ID——JT /// public const string hfnbdId = "C4A62EC0-E5D3-4EBF-A5FA-E56AA89633C0"; + /// + /// 施工部——付伟 + /// + public const string fuweiId = "dd72a950-8a8e-4958-ba8c-954c58a9beea"; + + /// + /// 施工部——申银行 + /// + public const string shenyinhangId = "fb3b3171-f2f3-40b1-b40b-9424cc14ecfe"; + + /// + /// 施工部——张慧敏 + /// + public const string zhanghuiminId = "fb3b3171-f2f3-40b1-b40b-9424cc14ecfe"; + /// /// 公共临时账户ID /// diff --git a/SGGL/FineUIPro.Web/ProjectData/ProjectSet.aspx.cs b/SGGL/FineUIPro.Web/ProjectData/ProjectSet.aspx.cs index 89b1dc1a..16797569 100644 --- a/SGGL/FineUIPro.Web/ProjectData/ProjectSet.aspx.cs +++ b/SGGL/FineUIPro.Web/ProjectData/ProjectSet.aspx.cs @@ -11,26 +11,26 @@ using AspNet = System.Web.UI.WebControls; namespace FineUIPro.Web.ProjectData { public partial class ProjectSet : PageBase - { - public string URLToken - { - get - { - return (string)ViewState["URLToken"]; - } - set - { - ViewState["URLToken"] = value; - } - } + { + public string URLToken + { + get + { + return (string)ViewState["URLToken"]; + } + set + { + ViewState["URLToken"] = value; + } + } - #region 加载 - /// - /// 加载页面 - /// - /// - /// - protected void Page_Load(object sender, EventArgs e) + #region 加载 + /// + /// 加载页面 + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { @@ -229,68 +229,68 @@ namespace FineUIPro.Web.ProjectData } } } - /// - /// 关联摄像头 - /// - /// - /// - protected void btnMonitor_Click(object sender, EventArgs e) - { - var sysSet16 = (from x in Funs.DB.Sys_Set where x.SetName == "视频监控地址" select x).ToList().FirstOrDefault(); - var sysSet17 = (from x in Funs.DB.Sys_Set where x.SetName == "视频监控密码" select x).ToList().FirstOrDefault(); - if (sysSet16 == null) - { - ShowNotify("视频监控地址未设置!", MessageBoxIcon.Warning); - return; - } - if (sysSet17 == null) - { - ShowNotify("视频监控密码未设置!", MessageBoxIcon.Warning); - return; - } - if (!string.IsNullOrEmpty(Grid1.SelectedRowID)) - { - string url = sysSet16.SetValue; - string username = "admin"; - string password = sysSet17.SetValue; + /// + /// 关联摄像头 + /// + /// + /// + protected void btnMonitor_Click(object sender, EventArgs e) + { + var sysSet16 = (from x in Funs.DB.Sys_Set where x.SetName == "视频监控地址" select x).ToList().FirstOrDefault(); + var sysSet17 = (from x in Funs.DB.Sys_Set where x.SetName == "视频监控密码" select x).ToList().FirstOrDefault(); + if (sysSet16 == null) + { + ShowNotify("视频监控地址未设置!", MessageBoxIcon.Warning); + return; + } + if (sysSet17 == null) + { + ShowNotify("视频监控密码未设置!", MessageBoxIcon.Warning); + return; + } + if (!string.IsNullOrEmpty(Grid1.SelectedRowID)) + { + string url = sysSet16.SetValue; + string username = "admin"; + string password = sysSet17.SetValue; - if (string.IsNullOrEmpty(URLToken)) - { - String res = BLL.CommonService.CreateGetHttpResponse(url + "api/v1/login?username=" + username + "&password=" + Funs.EncryptionPassword(password)); - Dictionary dicres = JsonConvert.DeserializeObject>(res); - URLToken = dicres["URLToken"]; - } - var project = Funs.DB.Base_Project.FirstOrDefault(x => x.ProjectId == Grid1.SelectedRowID); + if (string.IsNullOrEmpty(URLToken)) + { + String res = BLL.CommonService.CreateGetHttpResponse(url + "api/v1/login?username=" + username + "&password=" + Funs.EncryptionPassword(password)); + Dictionary dicres = JsonConvert.DeserializeObject>(res); + URLToken = dicres["URLToken"]; + } + var project = Funs.DB.Base_Project.FirstOrDefault(x => x.ProjectId == Grid1.SelectedRowID); - string resUserInfor = BLL.CommonService.CreateGetHttpResponse(url + "api/v1/user/info?token=" + URLToken + "&username=" + project.ProjectCode); - if ("user not found".Equals(resUserInfor) || "远程服务器返回错误: (400) 错误的请求。".Equals(resUserInfor)) - { - string resUserSave = BLL.CommonService.CreateGetHttpResponse(url + "api/v1/user/save?token=" + URLToken + "&ID=0&Username=" + project.ProjectCode + "&Role=操作员,观众&Enable=true"); - Dictionary dicUserSave = JsonConvert.DeserializeObject>(resUserSave); - project.MonitorId = dicUserSave["ID"]; - string newPassWord = Funs.EncryptionPassword(DateTime.Now.Ticks.ToString()); - newPassWord = newPassWord.Substring(newPassWord.Length - 9, 8); - string resResPS = BLL.CommonService.CreateGetHttpResponse(url + "api/v1/user/resetpassword?token=" + URLToken + "&id=" + dicUserSave["ID"] + "&password=" + newPassWord); - project.MonitorPW = newPassWord; + string resUserInfor = BLL.CommonService.CreateGetHttpResponse(url + "api/v1/user/info?token=" + URLToken + "&username=" + project.ProjectCode); + if ("user not found".Equals(resUserInfor) || "远程服务器返回错误: (400) 错误的请求。".Equals(resUserInfor)) + { + string resUserSave = BLL.CommonService.CreateGetHttpResponse(url + "api/v1/user/save?token=" + URLToken + "&ID=0&Username=" + project.ProjectCode + "&Role=操作员,观众&Enable=true"); + Dictionary dicUserSave = JsonConvert.DeserializeObject>(resUserSave); + project.MonitorId = dicUserSave["ID"]; + string newPassWord = Funs.EncryptionPassword(DateTime.Now.Ticks.ToString()); + newPassWord = newPassWord.Substring(newPassWord.Length - 9, 8); + string resResPS = BLL.CommonService.CreateGetHttpResponse(url + "api/v1/user/resetpassword?token=" + URLToken + "&id=" + dicUserSave["ID"] + "&password=" + newPassWord); + project.MonitorPW = newPassWord; - Funs.DB.SubmitChanges(); - } + Funs.DB.SubmitChanges(); + } - PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ProjectMonitorList.aspx?ProjectCode={0}&Id={1}&URLToken={2}", project.ProjectCode, project.MonitorId, URLToken, "查看 - "))); + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ProjectMonitorList.aspx?ProjectCode={0}&Id={1}&URLToken={2}", project.ProjectCode, project.MonitorId, URLToken, "查看 - "))); - } - else - { - ShowNotify("请选择项目进入!", MessageBoxIcon.Warning); - } - } + } + else + { + ShowNotify("请选择项目进入!", MessageBoxIcon.Warning); + } + } - /// - /// 查看 - /// - /// - /// - protected void btnView_Click(object sender, EventArgs e) + /// + /// 查看 + /// + /// + /// + protected void btnView_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(Grid1.SelectedRowID)) { PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ProjectSetMap.aspx?projectId={0}&value=0", Grid1.SelectedRowID, "查看 - "))); } @@ -316,11 +316,11 @@ namespace FineUIPro.Web.ProjectData var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, menuId); if (buttonList.Count() > 0) { - if (buttonList.Contains(BLL.Const.BtnAdd)) - { - btnUpdata.Hidden = false; - this.btnNew.Hidden = false; - } + //if (buttonList.Contains(BLL.Const.BtnAdd)) + //{ + // btnUpdata.Hidden = false; + // this.btnNew.Hidden = false; + //} if (buttonList.Contains(BLL.Const.BtnModify) || buttonList.Contains(BLL.Const.BtnSave)) { this.btnMenuEdit.Hidden = false; @@ -330,6 +330,13 @@ namespace FineUIPro.Web.ProjectData this.btnMenuDelete.Hidden = false; } } + + string curruserId = this.CurrUser.UserId; + if (curruserId == Const.sysglyId || curruserId == Const.hfnbdId || curruserId == Const.fuweiId || curruserId == Const.shenyinhangId || curruserId == Const.zhanghuiminId) + {//只有管理员、JT、付伟、申银行、张慧敏的账号可以新增和维护项目数据 + btnUpdata.Hidden = false; + this.btnNew.Hidden = false; + } } #endregion diff --git a/SGGL/FineUIPro.Web/ProjectData/ProjectSetSave.aspx b/SGGL/FineUIPro.Web/ProjectData/ProjectSetSave.aspx index 0ddcac3d..7341da11 100644 --- a/SGGL/FineUIPro.Web/ProjectData/ProjectSetSave.aspx +++ b/SGGL/FineUIPro.Web/ProjectData/ProjectSetSave.aspx @@ -178,8 +178,8 @@ - - + + diff --git a/SGGL/FineUIPro.Web/ProjectData/ProjectSetSave.aspx.cs b/SGGL/FineUIPro.Web/ProjectData/ProjectSetSave.aspx.cs index e1b00b8b..871d9dbe 100644 --- a/SGGL/FineUIPro.Web/ProjectData/ProjectSetSave.aspx.cs +++ b/SGGL/FineUIPro.Web/ProjectData/ProjectSetSave.aspx.cs @@ -35,6 +35,18 @@ namespace FineUIPro.Web.ProjectData { if (!IsPostBack) { + string curruserId = this.CurrUser.UserId; + if (curruserId == Const.sysglyId || curruserId == Const.hfnbdId || curruserId == Const.fuweiId || curruserId == Const.shenyinhangId || curruserId == Const.zhanghuiminId) + {//只有管理员、JT、付伟、申银行、张慧敏的账号可以新增和维护项目数据 + btnSave.Hidden = false; + this.btnSave.Hidden = false; + } + else + { + btnSave.Hidden = true; + this.btnSave.Hidden = true; + } + BindGrid(); BindGrid2(); this.btnClose.OnClientClick = ActiveWindow.GetHideReference();