//未上报信息 private void NotReportDataLoade() { int notReportTimes = int.Parse(ReadWriteXml.ReadXml("NotReportTimes")); dgvNotReport.AutoGenerateColumns = false; dgvNotReport.DataSource = wellInfoService.GetNotReportNumInfo(notReportTimes); }
private static bool GetValue(string Node, string Attribute) { string str = ReadWriteXml.Read(Node, Attribute); bool result = false; bool.TryParse(str, out result); return(result); }
private void btnSet_Click(object sender, EventArgs e) { if (PortName.SelectedItem == null || BaudRate.SelectedItem == null) { UMessageBox.Show("请选择串口号和波特率!", "人井监控管理系统", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { ReadWriteXml.WriteXml("PortName", PortName.SelectedItem.ToString()); ReadWriteXml.WriteXml("BaudRate", BaudRate.SelectedItem.ToString()); UMessageBox.Show("保存成功,请重启系统!", "人井监控管理系统", MessageBoxButtons.OK, MessageBoxIcon.Information); Process.GetCurrentProcess().CloseMainWindow(); } }
public void Execute(IJobExecutionContext context) { sysSave_Day = int.Parse(ReadWriteXml.ReadXml("SysLogTime")); if (logService.DeleteSystemLogInfo(DateTime.Now.ToString("yyyy/MM/dd"), sysSave_Day) > 0) { LogHelper.WriteQuartzLog("删除超过" + sysSave_Day + "天的系统日志"); } userSave_Day = int.Parse(ReadWriteXml.ReadXml("UserLogTime")); if (logService.DeleteUserLogInfo(DateTime.Now.ToString("yyyy/MM/dd"), userSave_Day) > 0) { LogHelper.WriteQuartzLog("删除超过" + userSave_Day + "天的用户日志"); } }
public void Init() { //指定全局设置和命令行参数 CefSettings settings = new CefSettings(); //语言 settings.Locale = "zh-CN"; settings.AcceptLanguageList = "zh-CN"; settings.LocalesDirPath = @"webbrowerlib\locales\"; //日志输出 settings.LogFile = @"log\LogData.txt"; settings.LogSeverity = LogSeverity.Error; settings.CachePath = "cache"; settings.BrowserSubprocessPath = @"webbrowerlib\CefSharp.BrowserSubprocess.exe"; if (!Cef.IsInitialized) { Cef.Initialize(settings, true, false); } webBrower = new ChromiumWebBrowser("http://rendering/"); webBrower.LoadHtml(Resources.Loading, "http://rendering/"); webBrower.RegisterJsObject("jsObj", new JsEvent(), false); BrowserSettings browserSettings = new BrowserSettings(); browserSettings.DefaultEncoding = "UTF-8"; browserSettings.WebGl = CefState.Enabled; webBrower.BrowserSettings = browserSettings; //禁用右击菜单 webBrower.MenuHandler = new MenuHandler(); webBrower.JsDialogHandler = new JsDialogHandler(); Task.Run(() => { wellInfoService = new WellInfoService(); StringBuilder html = new StringBuilder(); string location = ReadWriteXml.ReadXml("DefaultLocation"); list = wellInfoService.GetWellInfo_List(null); json = JsonConvert.SerializeObject(list); html.AppendFormat(Resources.mapHeader, json, location); html.Append(Resources.mapContent); webBrower.LoadHtml(html.ToString(), "http://rendering/"); }); }
private void btnSysSet_Click(object sender, EventArgs e) { if (tbSysLogTime.Text.Trim() == "" && tbUserLogTime.Text.Trim() == "" && tbNotReportTimes.Text.Trim() == "" && tbRefreshTime.Text.Trim() == "" && tbReportInterval.Text.Trim() == "") { UMessageBox.Show("请输入内容。", "人井监控管理系统", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (IsNumber(tbSysLogTime.Text.Trim()) && IsNumber(tbUserLogTime.Text.Trim()) && IsNumber(tbNotReportTimes.Text.Trim()) && IsNumber(tbRefreshTime.Text.Trim()) && IsNumber(tbReportInterval.Text.Trim())) { ReadWriteXml.WriteXml("SysLogTime", tbSysLogTime.Text.Trim()); ReadWriteXml.WriteXml("UserLogTime", tbUserLogTime.Text.Trim()); ReadWriteXml.WriteXml("NotReportTimes", tbNotReportTimes.Text.Trim()); ReadWriteXml.WriteXml("RefreshTime", tbRefreshTime.Text.Trim()); ReadWriteXml.WriteXml("ReportInterval", cbEnabled.Checked.ToString() + "-" + tbReportInterval.Text.Trim()); UMessageBox.Show("设置成功。", "人井监控管理系统", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { UMessageBox.Show("输入的值错误。", "人井监控管理系统", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void SystemSettingsControl_Load(object sender, EventArgs e) { if (isOpen) { tbSysLogTime.Text = ReadWriteXml.ReadXml("SysLogTime"); tbUserLogTime.Text = ReadWriteXml.ReadXml("UserLogTime"); tbNotReportTimes.Text = ReadWriteXml.ReadXml("NotReportTimes"); tbRefreshTime.Text = ReadWriteXml.ReadXml("RefreshTime"); cbEnabled.Checked = Convert.ToBoolean(ReadWriteXml.ReadXml("ReportInterval").Split('-')[0]); tbReportInterval.Text = ReadWriteXml.ReadXml("ReportInterval").Split('-')[1]; DeviceLoad(); GetDeviceMsg(); } else { DeviceLoad(); tabControl1.TabPages.Remove(OperatorSet); tabControl1.TabPages.Remove(UserSet); tabControl1.TabPages.Remove(SysSetTab); } PortName.SelectedItem = ReadWriteXml.ReadXml("PortName"); BaudRate.SelectedItem = ReadWriteXml.ReadXml("BaudRate"); }
private void timer1_Tick(object sender, EventArgs e) { this.timer1.Stop(); if (SerialPort.GetPortNames().Length != 0) { //读取配置文件 string portName = ReadWriteXml.ReadXml("PortName"); string baudRate = ReadWriteXml.ReadXml("BaudRate"); CDMASMS.Set(portName, Convert.ToInt32(baudRate)); if (CDMASMS.Open()) { string TSX = CDMASMS.SendAT("AT^MEID").Replace("\r\n", "").Replace("OK", ""); string production_Name = CDMASMS.SendAT("AT+CGMM").Replace("\r\n", "").Replace("OK", ""); if (TSX.Length == 14 && production_Name.IndexOf("MC323") != -1) { TSX = SysFunction.GetSecurit(TSX.Remove(3, 5)); if (tsx.Equals(TSX)) { string netstat = CDMASMS.SendAT("AT+CREG?").Replace("\r\n", "").Replace("OK", ""); if (netstat.Split(',')[1] == "1") { if (ReadWriteRegistry.ReadRegistry("isInvalid") == null) { ReadWriteRegistry.WriteRegistry("isInvalid", "false"); } if (ReadWriteRegistry.ReadRegistry("isInvalid") == "true") { this.DialogResult = DialogResult.Abort; } else { CDMASMS.DeviceInitialize(); this.DialogResult = DialogResult.OK; } this.Close(); } else { UMessageBox.Show("未注册到本地网络!", "人井监控管理系统", MessageBoxButtons.OK, MessageBoxIcon.Error); CDMASMS.Close(); this.Close(); } } else { UMessageBox.Show("硬件不匹配!", "人井监控管理系统", MessageBoxButtons.OK, MessageBoxIcon.Error); CDMASMS.Close(); this.Close(); } } else { UMessageBox.Show("串口打开失败,请在系统设置中重新配置串口数据。", "人井监控管理系统", MessageBoxButtons.OK, MessageBoxIcon.Error); this.DialogResult = DialogResult.No; this.Close(); } } else { UMessageBox.Show("串口打开失败,请在系统设置中重新配置串口数据。", "人井监控管理系统", MessageBoxButtons.OK, MessageBoxIcon.Error); this.DialogResult = DialogResult.No; this.Close(); } } else { UMessageBox.Show("读取硬件信息失败!请确认硬件设备连接正确。", "人井监控管理系统", MessageBoxButtons.OK, MessageBoxIcon.Error); CDMASMS.Close(); this.Close(); } }
private static void SetValue(string Node, string Attribute, bool value) { string attributeValue = value.ToString(); ReadWriteXml.Write(Node, Attribute, attributeValue); }
/// <summary> /// 处理信息 /// </summary> private void DisposeMsg(CSPNType type) { switch (type) { case CSPNType.AlarmInfo: switch (well_State_ID) { case 2: SenAlarmMsg("报警信息", time, realName); break; case 3: SenAlarmMsg("状态信息(低电量报警)", time, realName); break; case 4: SenAlarmMsg("状态信息(烟感报警)", time, realName); break; case 5: SenAlarmMsg("状态信息(烟感低电量报警)", time, realName); break; } wellStateService.UpdateWellCurrentStateInfo(7, terminal_ID); wellInfoService.UpdateReportInfo_Pending(1, terminal_ID); wellInfoService.UpdateReportInfo_Send(7, terminal_ID); GetSMS.UpdateMap(terminal_ID); if (refreshMessageDelegate != null) { refreshMessageDelegate(); } break; case CSPNType.DisposeInfo: switch (well_State_ID) { //case 2: // UpdateDisposeMsg("报警信息", time, realName); // break; //case 3: // UpdateDisposeMsg("状态信息(低电量报警)", time, realName); // break; //case 4: // UpdateDisposeMsg("状态信息(烟感报警)", time, realName); // break; //case 5: // UpdateDisposeMsg("状态信息(烟感低电量报警)", time, realName); // break; case 7: UpdateDisposeMsg("报警信息", time, realName); break; } wellStateService.UpdateWellCurrentStateInfo(1, terminal_ID); wellInfoService.UpdateReportInfo_Send(1, terminal_ID); GetSMS.UpdateMap(terminal_ID); break; case CSPNType.NotReportInfo: CDMASMS.SendCHNSms(string.Format("位于:{0}的{1}已经{2}天或超过{2}天未发送信息。", place, terminal_Name, ReadWriteXml.ReadXml("NotReportTimes")), phone); wellInfoService.Empty_NotReportNumInfo(terminal_ID); userLogHelper.InsertUserLog(DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"), "处理未上报信息。", CommonClass.UserName, null, null); break; } }
public void SaveLocationInfo() { ReadWriteXml.WriteXml("DefaultLocation", locationInfo); UMessageBox.Show("设置成功!", "人井监控管理系统", MessageBoxButtons.OK, MessageBoxIcon.Information); }