diff --git a/DataBase/版本日志/SGGLDB_WH_2023-10-18.sql b/DataBase/版本日志/SGGLDB_WH_2023-10-18.sql new file mode 100644 index 00000000..a3491d69 --- /dev/null +++ b/DataBase/版本日志/SGGLDB_WH_2023-10-18.sql @@ -0,0 +1,7 @@ +alter table [dbo].[Base_Project] add MonitorPW nvarchar(50) null +alter table [dbo].[Base_Project] add MonitorId nvarchar(50) null +GO + +INSERT INTO [dbo].[Sys_Set] ([SetId], [SetName], [IsAuto], [SetValue]) VALUES (1012, N'Ƶصַ', NULL, N'http://camera.cwcec.com:10000/'); +INSERT INTO [dbo].[Sys_Set] ([SetId], [SetName], [IsAuto], [SetValue]) VALUES (1013, N'Ƶ', NULL, N'LiChao123'); +GO \ No newline at end of file diff --git a/DataBase/版本日志/SGGLDB_WH_2023-10-19.sql b/DataBase/版本日志/SGGLDB_WH_2023-10-19.sql new file mode 100644 index 00000000..53d85d9f Binary files /dev/null and b/DataBase/版本日志/SGGLDB_WH_2023-10-19.sql differ diff --git a/SGGL/BLL/API/APIUserService.cs b/SGGL/BLL/API/APIUserService.cs index 678b5e66..0b559085 100644 --- a/SGGL/BLL/API/APIUserService.cs +++ b/SGGL/BLL/API/APIUserService.cs @@ -73,7 +73,7 @@ namespace BLL join y in db.Project_ProjectUser on x.UserId equals y.UserId where y.ProjectId == projectId && (x.UnitId == unitId || unitId == null) && (roleIds == null || roleList.Contains(y.RoleId)) && (strParam == null || x.UserName.Contains(strParam)) - && y.IsPost ==true + && y.IsPost == true select new Model.UserItem { UserId = x.UserId, @@ -285,7 +285,7 @@ namespace BLL { var getDataLists = (from x in db.Sys_User join y in db.Project_ProjectUser on x.UserId equals y.UserId - where y.ProjectId == projectId + where y.ProjectId == projectId select new Model.UserItem { UserId = x.UserId, @@ -330,5 +330,79 @@ namespace BLL return getDataList.OrderBy(x => x.UnitName).ThenBy(x => x.UserName).ToList(); } } + + + //HSSE副经理 + public static string HSSEEngineerf = "e2166a63-23ae-41de-9fbd-63ead785c033"; + //分包商HSE经理 + public static string FbsGcs = "b01b5d82-c0d9-44fc-b3b9-fca91da34d28"; + //分包商HSE工程师 + public static string FbsHseGcs = "9d12f8fa-56a3-4db4-849e-e85e1c21a769"; + /// + /// 根据受检单位项目id获取参加检查人员(项目HSE经理、HSE工程师、 HSSE副经理、受检单位的分包商HSE经理、分包商HSE工程师) + /// + /// + /// + /// + public static List getCheckUserByProjectIdAndUnitid(string projectId, string unitid) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + //当前项目的项目HSE经理、HSE工程师、 HSSE副经理 + var getlist1 =(from x in db.Sys_User + join y in db.Project_ProjectUser on x.UserId equals y.UserId + where y.ProjectId==projectId && + (y.RoleId.Contains(Const.HSSEManager) || y.RoleId.Contains(Const.HSSEEngineer) + || y.RoleId.Contains(HSSEEngineerf) + ) + select new Model.UserItem + { + UserId = x.UserId, + Account = x.Account, + UserCode = x.UserCode, + Password = x.Password, + UserName = x.UserName, + RoleId = y.RoleId, + RoleName = RoleService.getRoleNamesRoleIds(y.RoleId), + UnitId = y.UnitId, + UnitName = db.Base_Unit.First(z => z.UnitId == y.UnitId).UnitName, + LoginProjectId = y.ProjectId, + LoginProjectName = db.Base_Project.First(z => z.ProjectId == y.ProjectId).ProjectName, + IdentityCard = x.IdentityCard, + Email = x.Email, + Telephone = x.Telephone, + IsOffice = x.IsOffice, + SignatureUrl = x.SignatureUrl.Replace('\\', '/'), + }).ToList(); + //受检单位的分包商HSE经理、分包商HSE工程师 + var getlist2 =(from x in db.Sys_User + join y in db.Project_ProjectUser on x.UserId equals y.UserId + where y.ProjectId == projectId && y.UnitId == unitid && + (y.RoleId.Contains(FbsGcs) || y.RoleId.Contains(FbsHseGcs) + ) + select new Model.UserItem + { + UserId = x.UserId, + Account = x.Account, + UserCode = x.UserCode, + Password = x.Password, + UserName = x.UserName, + RoleId = y.RoleId, + RoleName = RoleService.getRoleNamesRoleIds(y.RoleId), + UnitId = y.UnitId, + UnitName = db.Base_Unit.First(z => z.UnitId == y.UnitId).UnitName, + LoginProjectId = y.ProjectId, + LoginProjectName = db.Base_Project.First(z => z.ProjectId == y.ProjectId).ProjectName, + IdentityCard = x.IdentityCard, + Email = x.Email, + Telephone = x.Telephone, + IsOffice = x.IsOffice, + SignatureUrl = x.SignatureUrl.Replace('\\', '/'), + }).ToList(); + var getlist = getlist1.Union(getlist2).ToList(); + return getlist; + + } + } } } diff --git a/SGGL/BLL/API/HSSE/APICheckSpecialService.cs b/SGGL/BLL/API/HSSE/APICheckSpecialService.cs index 3c15b020..bf053967 100644 --- a/SGGL/BLL/API/HSSE/APICheckSpecialService.cs +++ b/SGGL/BLL/API/HSSE/APICheckSpecialService.cs @@ -56,7 +56,8 @@ namespace BLL ResponsibleMan = x.ResponsibleMan, ReceiveMan = x.ReceiveMan, - ReceiveManName = UserService.getUserNamesUserIds(x.ReceiveMan) + ReceiveManName = UserService.getUserNamesUserIds(x.ReceiveMan), + AttachUrl2= APIUpLoadFileService.getFileUrl(x.CheckSpecialId+"zgh", null), }; return getInfo.FirstOrDefault(); @@ -98,8 +99,8 @@ namespace BLL ResponsibleMan = x.ResponsibleMan, ReceiveMan = x.ReceiveMan, - ReceiveManName = UserService.getUserNamesUserIds(x.ReceiveMan) - + ReceiveManName = UserService.getUserNamesUserIds(x.ReceiveMan), + AttachUrl2 = APIUpLoadFileService.getFileUrl(x.CheckSpecialId + "zgh", null), }; return getInfo.FirstOrDefault(); } @@ -232,7 +233,7 @@ namespace BLL //// 删除专项检查明细项 Check_CheckSpecialDetailService.DeleteCheckSpecialDetails(newCheckSpecial.CheckSpecialId); } - ////保存附件 + ////保存附件(提交前附件) if (!string.IsNullOrEmpty(newItem.AttachUrl1)) { UploadFileService.SaveAttachUrl(UploadFileService.GetSourceByAttachUrl(newItem.AttachUrl1, 10, null), newItem.AttachUrl1, Const.ProjectCheckSpecialMenuId, newCheckSpecial.CheckSpecialId); @@ -242,6 +243,16 @@ namespace BLL CommonService.DeleteAttachFileById(Const.ProjectCheckSpecialMenuId, newCheckSpecial.CheckSpecialId); } + ////保存附件(整改后附件) + if (!string.IsNullOrEmpty(newItem.AttachUrl2)) + { + UploadFileService.SaveAttachUrl(UploadFileService.GetSourceByAttachUrl(newItem.AttachUrl2, 10, null), newItem.AttachUrl2, Const.ProjectCheckSpecialMenuId, newCheckSpecial.CheckSpecialId+"zgh"); + } + else + { + CommonService.DeleteAttachFileById(Const.ProjectCheckSpecialMenuId, newCheckSpecial.CheckSpecialId + "zgh"); + } + ///// 新增检查项 if (newItem.CheckSpecialDetailItems != null && newItem.CheckSpecialDetailItems.Count() > 0) { diff --git a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj index 30cae4d3..175370da 100644 --- a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj +++ b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj @@ -1473,6 +1473,7 @@ + @@ -14184,6 +14185,13 @@ ProjectList.aspx + + ProjectMonitorList.aspx + ASPXCodeBehind + + + ProjectMonitorList.aspx + ProjectSet.aspx ASPXCodeBehind diff --git a/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecial.aspx b/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecial.aspx index 5a70c33f..f3ee4869 100644 --- a/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecial.aspx +++ b/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecial.aspx @@ -51,7 +51,7 @@ - + diff --git a/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecial.aspx.cs b/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecial.aspx.cs index 9b77dffb..e1148b87 100644 --- a/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecial.aspx.cs +++ b/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecial.aspx.cs @@ -60,7 +60,7 @@ namespace FineUIPro.Web.HSSE.Check { string strSql = @"SELECT CheckSpecial.CheckSpecialId,CodeRecords.Code AS CheckSpecialCode," + @" CheckItemSet.CheckItemName,CheckSpecial.CheckTime,(CASE WHEN CheckSpecial.CheckType ='1' THEN '联合检查' ELSE '专项检查' END) AS CheckTypeName" - + @" ,(CASE WHEN CheckSpecial.States='2' THEN '待确认' WHEN CheckSpecial.States='3' THEN '已确认' WHEN CheckSpecial.States='1' THEN '待整改' ELSE '待提交' END) AS StatesName" + + @" ,(CASE WHEN CheckSpecial.States='2' THEN '待确认' WHEN CheckSpecial.States='3' THEN '已关闭' WHEN CheckSpecial.States='1' THEN '待整改' ELSE '待提交' END) AS StatesName" + @" FROM Check_CheckSpecial AS CheckSpecial " + @" LEFT JOIN Sys_CodeRecords AS CodeRecords ON CheckSpecial.CheckSpecialId=CodeRecords.DataId " + @" LEFT JOIN Technique_CheckItemSet AS CheckItemSet ON CheckItemSet.CheckItemSetId = CheckSpecial.CheckItemSetId where 1=1"; diff --git a/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecialView.aspx b/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecialView.aspx index 08a475e7..23fe916b 100644 --- a/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecialView.aspx +++ b/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecialView.aspx @@ -100,9 +100,14 @@ - + + + + diff --git a/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecialView.aspx.cs b/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecialView.aspx.cs index ae8ccfb0..37a68c6a 100644 --- a/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecialView.aspx.cs +++ b/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecialView.aspx.cs @@ -90,6 +90,19 @@ namespace FineUIPro.Web.HSSE.Check PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/CheckSpecial&menuId={1}&type=-1", this.CheckSpecialId, BLL.Const.ProjectCheckSpecialMenuId))); } } + + /// + /// 上传附件 + /// + /// + /// + protected void btnAttachUrl_Click2(object sender, EventArgs e) + { + if (!string.IsNullOrEmpty(this.CheckSpecialId)) + { + PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/CheckSpecial&menuId={1}&type=-1", this.CheckSpecialId+"zgh", BLL.Const.ProjectCheckSpecialMenuId))); + } + } #endregion /// diff --git a/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecialView.aspx.designer.cs b/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecialView.aspx.designer.cs index e9ca0ba9..045c02e0 100644 --- a/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecialView.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecialView.aspx.designer.cs @@ -158,6 +158,15 @@ namespace FineUIPro.Web.HSSE.Check /// protected global::FineUIPro.Button btnAttachUrl; + /// + /// btnAttachUrl2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnAttachUrl2; + /// /// ToolbarFill1 控件。 /// diff --git a/SGGL/FineUIPro.Web/ProjectData/ProjectMonitorList.aspx b/SGGL/FineUIPro.Web/ProjectData/ProjectMonitorList.aspx new file mode 100644 index 00000000..2d93e473 --- /dev/null +++ b/SGGL/FineUIPro.Web/ProjectData/ProjectMonitorList.aspx @@ -0,0 +1,84 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ProjectMonitorList.aspx.cs" Inherits="FineUIPro.Web.ProjectData.ProjectMonitorList" %> + + + + + + 项目清单 + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/ProjectData/ProjectMonitorList.aspx.cs b/SGGL/FineUIPro.Web/ProjectData/ProjectMonitorList.aspx.cs new file mode 100644 index 00000000..da09fdbc --- /dev/null +++ b/SGGL/FineUIPro.Web/ProjectData/ProjectMonitorList.aspx.cs @@ -0,0 +1,220 @@ +using BLL; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Data.SqlClient; +using System.Linq; + +namespace FineUIPro.Web.ProjectData +{ + public partial class ProjectMonitorList : PageBase + { + + /// + /// 定义项 + /// + public string ProjectCode + { + get + { + return (string)ViewState["ProjectCode"]; + } + set + { + ViewState["ProjectCode"] = value; + } + } + public string Id + { + get + { + return (string)ViewState["Id"]; + } + set + { + ViewState["Id"] = value; + } + } + public string Devices + { + get + { + var sysSet16 = (from x in Funs.DB.Sys_Set where x.SetName == "视频监控地址" select x).ToList().FirstOrDefault(); + string url = sysSet16.SetValue; + string res = APIGetHttpService.Http(url + "api/v1/user/channellist?token=" + URLToken + "&id=" + Id + "&related=true"); + string devices = ""; + JObject jObject = (JObject)JsonConvert.DeserializeObject(res); + JArray channelList = jObject.Value("ChannelList"); + HashSet set = new HashSet(); + foreach (var c in channelList) + { + set.Add(c["DeviceID"] + ":" + c["ID"]); + } + if (set.Count > 0) + { + devices = string.Join(",", set); + } + return devices; + } + set + { + ViewState["Devices"] = value; + } + } + + /// + /// 定义项 + /// + public string URLToken + { + get + { + return (string)ViewState["URLToken"]; + } + set + { + ViewState["URLToken"] = value; + } + } + + #region 加载 + /// + /// 加载页面 + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + this.ProjectCode = Request.QueryString["ProjectCode"]; + this.URLToken = Request.QueryString["URLToken"]; + this.Id = Request.QueryString["Id"]; + Funs.DropDownPageSize(this.ddlPageSize); + if (this.CurrUser != null && this.CurrUser.PageSize.HasValue) + { + Grid1.PageSize = this.CurrUser.PageSize.Value; + } + this.ddlPageSize.SelectedValue = Grid1.PageSize.ToString(); + // 绑定表格 + + this.BindGrid(); + } + } + #endregion + + #region 绑定数据 + /// + /// 绑定数据 + /// + private void BindGrid() + { + var sysSet16 = (from x in Funs.DB.Sys_Set where x.SetName == "视频监控地址" select x).ToList().FirstOrDefault(); + + + + DataTable dt = new DataTable(); + dt.Columns.Add("id"); + dt.Columns.Add("name"); + dt.Columns.Add("serial"); + dt.Columns.Add("deviceName"); + string url = sysSet16.SetValue; + List urls = new List(); + string res = APIGetHttpService.Http(url + "api/v1/device/channeltree?token=" + URLToken); + + List> jsonNvr = JsonConvert.DeserializeObject>>(res); + foreach (Dictionary nvr in jsonNvr) + { + if (string.IsNullOrEmpty(txtProjectName.Text.Trim()) || nvr["customName"].Contains(txtProjectName.Text.Trim())) + { + string jsonCameras = APIGetHttpService.Http(url + "api/v1/device/channeltree?token=" + URLToken + "&serial=" + nvr["serial"]); + List> jsonDiv = JsonConvert.DeserializeObject>>(jsonCameras); + foreach (Dictionary div in jsonDiv) + { + var rowDiv = dt.NewRow(); + rowDiv["id"] = div["id"]; + rowDiv["deviceName"] = nvr["customName"]; + if (!string.IsNullOrEmpty(div["customName"])) + { + rowDiv["name"] = div["customName"]; + } + else + { + rowDiv["name"] = div["name"]; + } + rowDiv["serial"] = div["code"]; + + dt.Rows.Add(rowDiv); + } + } + } + + + + Grid1.RecordCount = dt.Rows.Count; + Grid1.DataSource = this.GetPagedDataTable(Grid1, dt); + Grid1.DataBind(); + if (!string.IsNullOrEmpty(Devices)) + { + Grid1.SelectedRowIDArray = Devices.Split(','); + } + } + #endregion + + #region Grid + /// + /// + /// + /// + /// + protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e) + { + BindGrid(); + } + + /// + /// + /// + /// + /// + protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e) + { + + Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue); + BindGrid(); + } + + protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e) + { + BindGrid(); + } + #endregion + + + protected void btnSearch_Click(object sender, EventArgs e) + { + BindGrid(); + } + + + protected void Grid1_RowSelect(object sender, GridRowSelectEventArgs e) + { + var sysSet16 = (from x in Funs.DB.Sys_Set where x.SetName == "视频监控地址" select x).ToList().FirstOrDefault(); + string url = sysSet16.SetValue; + APIGetHttpService.Http(url + "api/v1/user/savechannels?token=" + URLToken + "&id=" + Id + "&channels[]=" + e.RowID); + + } + + + + protected void Grid1_RowDeselect(object sender, GridRowSelectEventArgs e) + { + var sysSet16 = (from x in Funs.DB.Sys_Set where x.SetName == "视频监控地址" select x).ToList().FirstOrDefault(); + string url = sysSet16.SetValue; + APIGetHttpService.Http(url + "api/v1/user/removechannels?token=" + URLToken + "&id=" + Id + "&channels[]=" + e.RowID); + } + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/ProjectData/ProjectMonitorList.aspx.designer.cs b/SGGL/FineUIPro.Web/ProjectData/ProjectMonitorList.aspx.designer.cs new file mode 100644 index 00000000..48fc148f --- /dev/null +++ b/SGGL/FineUIPro.Web/ProjectData/ProjectMonitorList.aspx.designer.cs @@ -0,0 +1,116 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.ProjectData +{ + + + public partial class ProjectMonitorList + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// Panel1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel Panel1; + + /// + /// Grid1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Grid Grid1; + + /// + /// Toolbar2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar2; + + /// + /// txtProjectName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtProjectName; + + /// + /// btnSearch 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnSearch; + + /// + /// lblNumber 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label lblNumber; + + /// + /// ToolbarSeparator1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1; + + /// + /// ToolbarText1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarText ToolbarText1; + + /// + /// ddlPageSize 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList ddlPageSize; + } +} diff --git a/SGGL/FineUIPro.Web/ProjectData/ProjectSet.aspx b/SGGL/FineUIPro.Web/ProjectData/ProjectSet.aspx index d70af9ef..50d0409f 100644 --- a/SGGL/FineUIPro.Web/ProjectData/ProjectSet.aspx +++ b/SGGL/FineUIPro.Web/ProjectData/ProjectSet.aspx @@ -127,7 +127,10 @@ - + + + diff --git a/SGGL/FineUIPro.Web/ProjectData/ProjectSet.aspx.cs b/SGGL/FineUIPro.Web/ProjectData/ProjectSet.aspx.cs index 3c28874d..aa89bc1b 100644 --- a/SGGL/FineUIPro.Web/ProjectData/ProjectSet.aspx.cs +++ b/SGGL/FineUIPro.Web/ProjectData/ProjectSet.aspx.cs @@ -5,19 +5,32 @@ using System.Data.SqlClient; using System.Linq; using System.Text; using BLL; +using Newtonsoft.Json; using AspNet = System.Web.UI.WebControls; namespace FineUIPro.Web.ProjectData { public partial class ProjectSet : PageBase - { - #region 加载 - /// - /// 加载页面 - /// - /// - /// - protected void Page_Load(object sender, EventArgs e) + { + public string URLToken + { + get + { + return (string)ViewState["URLToken"]; + } + set + { + ViewState["URLToken"] = value; + } + } + + #region 加载 + /// + /// 加载页面 + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { @@ -208,13 +221,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 btnView_Click(object sender, EventArgs e) + 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; + + Funs.DB.SubmitChanges(); + } + + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ProjectMonitorList.aspx?ProjectCode={0}&Id={1}&URLToken={2}", project.ProjectCode, project.MonitorId, URLToken, "查看 - "))); + + } + else + { + ShowNotify("请选择项目进入!", MessageBoxIcon.Warning); + } + } + + /// + /// 查看 + /// + /// + /// + 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, "查看 - "))); } diff --git a/SGGL/FineUIPro.Web/ProjectData/ProjectSet.aspx.designer.cs b/SGGL/FineUIPro.Web/ProjectData/ProjectSet.aspx.designer.cs index b8728ef2..91108d9f 100644 --- a/SGGL/FineUIPro.Web/ProjectData/ProjectSet.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/ProjectData/ProjectSet.aspx.designer.cs @@ -7,180 +7,191 @@ // //------------------------------------------------------------------------------ -namespace FineUIPro.Web.ProjectData { - - - public partial class ProjectSet { - - /// - /// form1 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::System.Web.UI.HtmlControls.HtmlForm form1; - - /// - /// PageManager1 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.PageManager PageManager1; - - /// - /// Panel1 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.Panel Panel1; - - /// - /// Grid1 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.Grid Grid1; - - /// - /// Toolbar2 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.Toolbar Toolbar2; - - /// - /// ckState 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.RadioButtonList ckState; - - /// - /// txtProjectName 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.TextBox txtProjectName; - - /// - /// btnNew 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.Button btnNew; - - /// - /// btnOut 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.Button btnOut; - - /// - /// lblNumber 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::System.Web.UI.WebControls.Label lblNumber; - - /// - /// ToolbarSeparator1 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1; - - /// - /// ToolbarText1 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.ToolbarText ToolbarText1; - - /// - /// ddlPageSize 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.DropDownList ddlPageSize; - - /// - /// Window1 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.Window Window1; - - /// - /// Menu1 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.Menu Menu1; - - /// - /// btnMenuEdit 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.MenuButton btnMenuEdit; - - /// - /// btnEnter 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.MenuButton btnEnter; - - /// - /// btnView 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.MenuButton btnView; - - /// - /// btnMenuDelete 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.MenuButton btnMenuDelete; - } +namespace FineUIPro.Web.ProjectData +{ + + + public partial class ProjectSet + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// Panel1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel Panel1; + + /// + /// Grid1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Grid Grid1; + + /// + /// Toolbar2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar2; + + /// + /// ckState 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.RadioButtonList ckState; + + /// + /// txtProjectName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtProjectName; + + /// + /// btnNew 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnNew; + + /// + /// btnOut 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnOut; + + /// + /// lblNumber 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label lblNumber; + + /// + /// ToolbarSeparator1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1; + + /// + /// ToolbarText1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarText ToolbarText1; + + /// + /// ddlPageSize 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList ddlPageSize; + + /// + /// Window1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window Window1; + + /// + /// Menu1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Menu Menu1; + + /// + /// btnMenuEdit 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuEdit; + + /// + /// btnEnter 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnEnter; + + /// + /// btnMonitor 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMonitor; + + /// + /// btnView 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnView; + + /// + /// btnMenuDelete 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuDelete; + } } diff --git a/SGGL/FineUIPro.Web/indexProject.aspx b/SGGL/FineUIPro.Web/indexProject.aspx index 2b62a95f..4436757e 100644 --- a/SGGL/FineUIPro.Web/indexProject.aspx +++ b/SGGL/FineUIPro.Web/indexProject.aspx @@ -448,6 +448,13 @@ +