private void sbSave_Click(object sender, EventArgs e) { SimpleButton[] buttons = { sbRefresh, sbSave }; ButtonEnable(false, buttons); //获取旧的参数,保存失败则回溯 DTDeviceInfo dt = DeviceCommViewModel.VM.GPSEntities; bool rs = SaveDeviceComChanges( DeviceCommViewModel.DeviceName.GPS, cbeCommunication.Text, ceUsed.Checked ? "1" : "0"); if (!rs) { BackDeviceComChanges(dt); } ButtonEnable(true, buttons); RefreshUI(); if (!rs) { return; } DeviceNotifyEventArgs args = new DeviceNotifyEventArgs(); args.Key = "GPSDevice"; args.Param = rs; onDeviceNotify(args); //if (rs) XtraMessageBox.Show("保存成功"); //else XtraMessageBox.Show("保存失败"); }
/// <summary> /// 保存设备通讯信息 /// </summary> /// <param name="deviceName"></param> /// <param name="com"></param> /// <param name="intUsed"></param> /// <param name="Param"></param> /// <returns></returns> public bool SaveDeviceComInfo(string deviceName, string com = null, string intUsed = null, string Param = null) { if (com == null && intUsed == null && Param == null) { return(true); } DTDeviceInfo dt = new DTDeviceInfo(); dt.Name.Value = deviceName; DTDeviceInfo dtafter = new DTDeviceInfo(); if (com != null) { dtafter.Commuunication.Value = com; } if (intUsed != null) { dtafter.Used.Value = Convert.ToInt32(intUsed); } if (Param != null) { dtafter.Param.Value = Param; } bool rs = _DataServer.UpdateResult(dtafter, dt); return(rs); }
private void sbSave_Click(object sender, EventArgs e) { SimpleButton[] buttons = { sbRefresh, sbSave }; ButtonEnable(false, buttons); //获取旧的参数,保存失败则回溯 DTDeviceInfo dt = DeviceCommViewModel.VM.AnalysisEntities; bool rs = SaveDeviceComChanges( (DeviceName)Enum.Parse(typeof(DeviceName), cName), cbeCommunication.Text, ceUsedPm.Checked ? "1" : "0" ); if (!rs) { BackDeviceComChanges(dt); } ButtonEnable(true, buttons); RefreshUI(); if (!rs) { return; } DeviceNotifyEventArgs args = new DeviceNotifyEventArgs(); args.Key = "AnalysisDevice"; args.Param = rs; onDeviceNotify(args); }
private void sbSave_Click(object sender, EventArgs e) { SimpleButton[] buttons = { sbRefresh, sbSave }; ButtonEnable(false, buttons); //获取旧的参数,保存失败则回溯 DTDeviceInfo dt = DeviceCommViewModel.VM.PlatEntities; PlatParam pp = new PlatParam(); pp.platNum = tePlatNumber.Text.ToString(); pp.unloadInvalidData = ceUnloadData.Checked; string param = JsonNewtonsoft.ToJSON(pp); bool rs = SaveDeviceComChanges( DeviceCommViewModel.DeviceName.Plat, cbeCommunication.Text, null, param); if (!rs) { BackDeviceComChanges(dt); } ButtonEnable(true, buttons); RefreshUI(); if (!rs) { return; } DeviceNotifyEventArgs args = new DeviceNotifyEventArgs(); args.Key = "PlatDevice"; args.Param = param; onDeviceNotify(args); }
/// <summary> /// 查询设备信息 /// </summary> /// <param name="DeviceName"></param> /// <returns></returns> public ArrayList QueryDeviceInfo(string DeviceName) { DTDeviceInfo dt = new DTDeviceInfo(); dt.Name.Value = DeviceName; ArrayList rs = _DataServer.GetResult(dt); return(rs); }
/// <summary> /// 查询相机 ip,用户名,密码,端口号 /// </summary> /// <returns></returns> private bool LoadCameraParam() { List <object> lsDevice = ResultDataViewModel.VM.Devices; if (lsDevice == null || lsDevice.Count < 1) { ErrorLog.Error(TIPS_DeviceListIsNull); return(false); } for (int i = 0; i < lsDevice.Count; i++) { if (lsDevice[i] is DTDeviceInfo) { try { DTDeviceInfo dt = lsDevice[i] as DTDeviceInfo; if (dt.Name.Value.ToString().Trim() == CameraName) { string param = dt.Param.Value.ToString(); JObject dp = JsonNewtonsoft.FromJSON(param) as JObject; JToken jt; dp.TryGetValue("userName", out jt); UserName = jt.ToString(); dp.TryGetValue("Password", out jt); PassWord = jt.ToString(); string CommInfo = dt.Commuunication.Value.ToString(); if (String.IsNullOrEmpty(CommInfo)) { ErrorLog.Error(TIPS_CommInfoIsNull); return(false); } ResultDataViewModel.VM.Execute(new List <object> { ResultDataViewModel.ExecuteCommand.ec_QueryCommunicationInfo, CommInfo }); if (ResultDataViewModel.VM.QueryComSingleEntities == null || ResultDataViewModel.VM.QueryComSingleEntities.Count < 1) { ErrorLog.Error(TIPS_CommInfoIsNull); // lcVedioTips.Text = ; return(false); } DTCommunicationInfo dtCom = ResultDataViewModel.VM.QueryComSingleEntities[0] as DTCommunicationInfo; IpAddress = dtCom.IP.Value.ToString().Trim(); Port = Convert.ToInt32(dtCom.PortNumberTCP.Value.ToString()); } } catch (Exception ex) { ErrorLog.Error(ex.ToString()); // lcVedioTips.Text = TIPS_Error; return(false); } } } return(true); }
private DTDeviceInfo ClearDTDevice(DTDeviceInfo dt) { if (dt != null) { dt.Commuunication.Value = null; dt.Param.Value = null; dt.Used.Value = null; } return(dt); }
/// <summary> /// 回溯更改 /// </summary> /// <returns></returns> protected virtual bool BackDeviceComChanges(DTDeviceInfo dt) { if (dt == null || dt.Name == null || dt.Name.Value == null) { return(false); } DeviceCommViewModel.VM.Execute(new List <object> { DeviceCommViewModel.ExecuteCommand.ec_SaveDeviceChange, dt.Name.Value.ToString(), dt.Commuunication.Value, dt.Used.Value, dt.Param.Value, }); return(DeviceCommViewModel.VM.SaveComChangeEntities); }
private void ChangeDTDevice(DTDeviceInfo dt1, DTDeviceInfo dt2) { try { if (dt2 == null) { return; } dt1.Commuunication.Value = dt2.Commuunication.Value; dt1.Param.Value = dt2.Param.Value; dt1.Used.Value = dt2.Used.Value; } catch (Exception ex) { } }
private void sbSave_Click(object sender, EventArgs e) { SimpleButton[] buttons = { sbRefresh, sbSave }; ButtonEnable(false, buttons); if (tePassword.Text.Trim() == null || teUserName.Text.Trim() == null) { XtraMessageBox.Show("用户名和密码不能为空"); } //获取旧的参数,保存失败则回溯 DTDeviceInfo dt = DeviceCommViewModel.VM.LicenseRecogEntities; CameraUserAndPwd cup = new CameraUserAndPwd(); cup.userName = teUserName.Text; cup.Password = tePassword.Text; string param = JsonNewtonsoft.ToJSON(cup); bool rs = SaveDeviceComChanges( DeviceCommViewModel.DeviceName.LicenseRecog, cbeCommunication.Text, null, param ); if (!rs) { BackDeviceComChanges(dt); } ButtonEnable(true, buttons); RefreshUI(); if (!rs) { return; } DeviceNotifyEventArgs args = new DeviceNotifyEventArgs(); args.Key = "LicenseRecognitionDevice"; args.Param = param; onDeviceNotify(args); //if (rs) XtraMessageBox.Show("保存成功"); //else XtraMessageBox.Show("保存失败"); }