/// <summary> /// Method to get system parameters /// </summary> /// <param name="paraCode">paraCode</param> public List <SysParamInfo> GetSysParams(int paraCode) { try { SqlParameter[] parms = { new SqlParameter("@ParaCode", SqlDbType.Int) }; if (paraCode == ComUtility.DefaultInt32) { parms[0].Value = DBNull.Value; } else { parms[0].Value = paraCode; } var sysParms = new List <SysParamInfo>(); using (var rdr = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, SqlText.SQL_SELECT_USER_GETSYSPARAMS, parms)) { while (rdr.Read()) { var parm = new SysParamInfo(); parm.ID = ComUtility.DBNullInt32Handler(rdr["ID"]); parm.ParaCode = ComUtility.DBNullInt32Handler(rdr["ParaCode"]); parm.ParaData = ComUtility.DBNullInt32Handler(rdr["ParaData"]); parm.ParaDisplay = ComUtility.DBNullStringHandler(rdr["ParaDisplay"]); parm.Note = ComUtility.DBNullStringHandler(rdr["Note"]); sysParms.Add(parm); } } return(sysParms); } catch { throw; } }
public string SaveVideoParamters() { try { var param1 = new SysParamInfo() { ID = 4, ParaCode = 30000001, ParaData = 0, ParaDisplay = VideoIPField.Text.Trim(), Note = "Video IP" }; var param2 = new SysParamInfo() { ID = 5, ParaCode = 30000001, ParaData = 1, ParaDisplay = VideoPortField.Text.Trim(), Note = "Video Port" }; var param3 = new SysParamInfo() { ID = 6, ParaCode = 30000001, ParaData = 2, ParaDisplay = VideoUIDField.Text.Trim(), Note = "Video UID" }; var param4 = new SysParamInfo() { ID = 7, ParaCode = 30000001, ParaData = 3, ParaDisplay = VideoPwdField.Text.Trim(), Note = "Video Password" }; new BUser().UpdateSysParams(new List <SysParamInfo>() { param1, param2, param3, param4 }); return(String.Format("{{\"Status\":{0}, \"Msg\":\"{1}\"}}", 200, "数据保存成功")); } catch (Exception err) { WebUtility.WriteLog(EnmSysLogLevel.Error, EnmSysLogType.Exception, err.ToString(), Page.User.Identity.Name); return(String.Format("{{\"Status\":{0}, \"Msg\":\"{1}\"}}", 0, err.Message)); } }
/// <summary> /// Save License /// </summary> protected void SaveBtn_Click(object sender, DirectEventArgs e) { try { var mcode = MachineCode.Text.Trim(); if (String.IsNullOrEmpty(mcode)) { ResultStatusBar.SetStatus(new StatusBarStatusConfig() { Icon = Icon.Exclamation, Text = "未获得机器标识码,请先启动服务程序。" }); return; } if (!Regex.IsMatch(mcode, @"^[a-fA-F0-9]{32}$")) { ResultStatusBar.SetStatus(new StatusBarStatusConfig() { Icon = Icon.Exclamation, Text = "机器标识码格式错误" }); return; } var lcode = LicenseCode.Text.Trim(); if (String.IsNullOrEmpty(lcode)) { ResultStatusBar.SetStatus(new StatusBarStatusConfig() { Icon = Icon.Exclamation, Text = "注册码不能为空" }); return; } var dl = WebUtility.GetDecryptLicense(lcode, mcode); if (dl == null) { ResultStatusBar.SetStatus(new StatusBarStatusConfig() { Icon = Icon.Exclamation, Text = "注册码无效,请与服务商联系。" }); return; } var parm = new SysParamInfo() { ID = 3, ParaCode = 20000001, ParaData = 0, ParaDisplay = mcode, Note = lcode }; new BUser().UpdateSysParams(new List <SysParamInfo>() { parm }); UserLimitLbl.Text = String.Format("最多允许{0}个用户同时在线", dl.MaxUsers); ExpiredLbl.Text = new DateTime(dl.Expiration) == new DateTime(2099, 12, 31) ? "永不过期" : WebUtility.GetDateString(new DateTime(dl.Expiration)); RemarkLbl.Text = String.Format("产品已注册给: {0} - {1}", dl.Name, dl.Company); ResultStatusBar.SetStatus(new StatusBarStatusConfig() { Icon = Icon.Accept, Text = "产品注册成功" }); } catch (Exception err) { WebUtility.WriteLog(EnmSysLogLevel.Error, EnmSysLogType.Exception, err.ToString(), Page.User.Identity.Name); ResultStatusBar.SetStatus(new StatusBarStatusConfig() { Icon = Icon.Exclamation, Text = err.Message }); } }
/// <summary> /// Setting Button Click /// </summary> protected void SettingButton_Click(object sender, DirectEventArgs e) { try { var value = 0; if (middisplay.Checked) { value += int.Parse(middisplay.InputValue); } if (stafeaturesdisplay.Checked) { value += int.Parse(stafeaturesdisplay.InputValue); } if (statypedisplay.Checked) { value += int.Parse(statypedisplay.InputValue); } if (productordisplay.Checked) { value += int.Parse(productordisplay.InputValue); } var current = new IDValuePair <string, int>(Page.User.Identity.Name, value); var param1 = new BUser().GetSysParams(50000001).Find(p => p.ParaData == 0); if (param1 == null) { param1 = new SysParamInfo() { ID = 14, ParaCode = 50000001, ParaData = 0, ParaDisplay = null, Note = "用户Profile" }; } var displays = new List <IDValuePair <string, int> >() { current }; if (param1.ParaDisplay != null && !string.IsNullOrEmpty(param1.ParaDisplay.Trim())) { var existings = Newtonsoft.Json.JsonConvert.DeserializeObject <List <IDValuePair <string, int> > >(param1.ParaDisplay); if (existings != null) { foreach (var et in existings) { if (et.ID.Equals(current.ID, StringComparison.CurrentCultureIgnoreCase)) { continue; } displays.Add(et); } } } param1.ParaDisplay = Newtonsoft.Json.JsonConvert.SerializeObject(displays); var userEntity = new BUser(); userEntity.UpdateSysParams(new List <SysParamInfo>() { param1 }); UserData.SysParams = userEntity.GetSysParams(WebUtility.DefaultInt32); WebUtility.ShowMessage(EnmErrType.Info, "数据保存完成"); } catch (Exception err) { WebUtility.WriteLog(EnmSysLogLevel.Error, EnmSysLogType.Exception, err.ToString(), Page.User.Identity.Name); WebUtility.ShowMessage(EnmErrType.Error, err.Message); } }
/// <summary> /// Ok Button Click /// </summary> protected void OkButton_Click(object sender, DirectEventArgs e) { try { var param1 = new SysParamInfo() { ID = 8, ParaCode = 40000001, ParaData = 0, ParaDisplay = AlmExSpinnerField1.Number.ToString(), Note = "超频告警阈值" }; var param2 = new SysParamInfo() { ID = 9, ParaCode = 40000001, ParaData = 1, ParaDisplay = AlmExSpinnerField2.Number.ToString(), Note = "超短告警阈值" }; var param3 = new SysParamInfo() { ID = 10, ParaCode = 40000001, ParaData = 2, ParaDisplay = AlmExSpinnerField3.Number.ToString(), Note = "超长告警阈值" }; var param4 = new SysParamInfo() { ID = 11, ParaCode = 40000001, ParaData = 3, ParaDisplay = AlmExSpinnerField4.Number.ToString(), Note = "发现时间异常告警阈值" }; var param5 = new SysParamInfo() { ID = 12, ParaCode = 40000001, ParaData = 4, ParaDisplay = AlmExSpinnerField5.Number.ToString(), Note = "清除时间异常告警阈值" }; var param6 = new SysParamInfo() { ID = 13, ParaCode = 40000001, ParaData = 5, ParaDisplay = AlmExTextField1.Text.ToString(), Note = "重要告警标识" }; new BUser().UpdateSysParams(new List <SysParamInfo>() { param1, param2, param3, param4, param5, param6 }); WebUtility.ShowMessage(EnmErrType.Info, "数据保存完成"); } catch (Exception err) { WebUtility.WriteLog(EnmSysLogLevel.Error, EnmSysLogType.Exception, err.ToString(), Page.User.Identity.Name); WebUtility.ShowMessage(EnmErrType.Error, err.Message); } }