关联摄像头
This commit is contained in:
@@ -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 加载
|
||||
/// <summary>
|
||||
/// 加载页面
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
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)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
@@ -208,13 +221,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 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<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;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/// <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, "查看 - "))); }
|
||||
|
||||
Reference in New Issue
Block a user