This commit is contained in:
夏菊 2025-03-31 19:08:04 +08:00
parent 74ed6ce38d
commit 5030ef836e
4 changed files with 117 additions and 83 deletions

View File

@ -18,10 +18,25 @@ namespace BLL
public const string sysglyId = "AF17168B-87BD-4GLY-1111-F0A0A1158F9B";
/// <summary>
/// 系统管理员ID
/// 系统管理员ID——JT
/// </summary>
public const string hfnbdId = "C4A62EC0-E5D3-4EBF-A5FA-E56AA89633C0";
/// <summary>
/// 施工部——付伟
/// </summary>
public const string fuweiId = "dd72a950-8a8e-4958-ba8c-954c58a9beea";
/// <summary>
/// 施工部——申银行
/// </summary>
public const string shenyinhangId = "fb3b3171-f2f3-40b1-b40b-9424cc14ecfe";
/// <summary>
/// 施工部——张慧敏
/// </summary>
public const string zhanghuiminId = "fb3b3171-f2f3-40b1-b40b-9424cc14ecfe";
/// <summary>
/// 公共临时账户ID
/// </summary>

View File

@ -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
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
@ -229,68 +229,68 @@ namespace FineUIPro.Web.ProjectData
}
}
}
/// <summary>
/// 关联摄像头
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
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;
/// <summary>
/// 关联摄像头
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
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<string, string> dicres = JsonConvert.DeserializeObject<Dictionary<string, string>>(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<string, string> dicres = JsonConvert.DeserializeObject<Dictionary<string, string>>(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<string, string> dicUserSave = JsonConvert.DeserializeObject<Dictionary<string, string>>(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<string, string> dicUserSave = JsonConvert.DeserializeObject<Dictionary<string, string>>(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);
}
}
/// <summary>
/// 查看
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnView_Click(object sender, EventArgs e)
/// <summary>
/// 查看
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
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

View File

@ -178,8 +178,8 @@
</f:FormRow>
<f:FormRow>
<Items>
<f:TextArea ID="txtWorkRange" runat="server" Label="工作范围" MaxLength="500" Height="100px"></f:TextArea>
<f:TextArea ID="txtRemark" runat="server" Label="项目概况" MaxLength="500" Height="100px" LabelWidth="150px"></f:TextArea>
<f:TextArea ID="txtWorkRange" runat="server" Label="工作范围" MaxLength="500" Height="120px"></f:TextArea>
<f:TextArea ID="txtRemark" runat="server" Label="项目概况" MaxLength="500" Height="120px" LabelWidth="150px"></f:TextArea>
</Items>
</f:FormRow>
<f:FormRow>

View File

@ -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();