private void btnYes_Click(object sender, RoutedEventArgs e) { int EndID = 0; String ParentId; string tmpTreeItemStr = string.Empty; ParentId = treeModel.Name; tmpTreeItemStr = txtParent.Text.Trim() + "-" + txtChrild.Text.Trim(); if (NetWorkClient.ControllerServer.Connected) { DefaultPrivilege.Des = ""; NetWorkClient.ControllerServer.Send(JsonInterFace.Add_privilege_request(txtChrild.Text.Trim(), ParentId, DefaultPrivilege.Des));//请求权限 } else { Parameters.PrintfLogsExtended("向服务器请求添加权限:", "Connected: Failed!"); } Thread.Sleep(1000); if (JsonInterFace.PrivilegeManageClass.PrivilegeTable.Rows.Count > 0) { EndID = Convert.ToInt32(JsonInterFace.PrivilegeManageClass.PrivilegeTable.Rows[JsonInterFace.PrivilegeManageClass.PrivilegeTable.Rows.Count - 1][0].ToString()); } DataRow rw = JsonInterFace.PrivilegeManageClass.PrivilegeTable.NewRow(); rw[0] = (EndID + 1).ToString(); rw[1] = txtChrild.Text.Trim(); rw[2] = ParentId; rw[3] = ParentId + "-" + txtChrild.Text.Trim(); JsonInterFace.PrivilegeManageClass.PrivilegeTable.Rows.Add(rw); this.Close(); }
private void btnImport_Click(object sender, RoutedEventArgs e) { if (MessageBox.Show("确定导入批量配置参数?", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Warning) == MessageBoxResult.Cancel) { return; } Microsoft.Win32.OpenFileDialog importFileDialog = new Microsoft.Win32.OpenFileDialog(); importFileDialog.Filter = "Text File(*.txt)|*.txt|All files(*.*)|*.*"; importFileDialog.AddExtension = true; importFileDialog.RestoreDirectory = true; if (txtImportFile.Text.Trim() == "") { if ((bool)importFileDialog.ShowDialog()) { try { string localFilePath = importFileDialog.FileName.ToString(); txtImportFile.Text = localFilePath; if (UpLoadConfigurationFile(localFilePath)) { if (NetWorkClient.ControllerServer.Connected) { NetWorkClient.ControllerServer.Send(JsonInterFace.BatchConfigurationImportRequest(new FileInfo(localFilePath).Name)); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "提示", MessageBoxButton.OK, MessageBoxImage.Warning); } } } else { try { string localFilePath = txtImportFile.Text; if (File.Exists(localFilePath)) { if (UpLoadConfigurationFile(localFilePath)) { if (NetWorkClient.ControllerServer.Connected) { NetWorkClient.ControllerServer.Send(JsonInterFace.BatchConfigurationImportRequest(new FileInfo(localFilePath).Name)); } } } else { MessageBox.Show("文件[" + localFilePath + "]不存在!", "提示", MessageBoxButton.OK, MessageBoxImage.Warning); } } catch (Exception ex) { MessageBox.Show(ex.Message, "提示", MessageBoxButton.OK, MessageBoxImage.Warning); } } }
private void btnSelect_Click(object sender, RoutedEventArgs e) { //用户类型 if ((bool)WhiteName.IsChecked) { JsonInterFace.ReDirection.UserType = "0"; } else if ((bool)BlackName.IsChecked) { JsonInterFace.ReDirection.UserType = "1"; } else { JsonInterFace.ReDirection.UserType = "2"; } if (NetWorkClient.ControllerServer.Connected) { NetWorkClient.ControllerServer.Send(JsonInterFace.Get_redirection_Request(txtParentFullPathName.Text.Trim(), txtSelfName.Text.Trim(), JsonInterFace.ReDirection.UserType)); Thread.Sleep(1000); this.Close(); } else { Parameters.PrintfLogsExtended("向服务器请求重定向:", "Connected: Failed!"); } }
/// <summary> /// 接收到服务器的数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> static void ControllerServer_DatagramReceived( object sender, TcpDatagramReceivedEventArgs <byte[]> e) { try { if (e.TcpClient != null) { if (RemoteHost == "" || RemoteHost == null) { RemoteHost = ((IPEndPoint)e.TcpClient.Client.RemoteEndPoint).Address.ToString(); } if (RemotePort == "" || RemotePort == null) { RemotePort = ((IPEndPoint)e.TcpClient.Client.RemoteEndPoint).Port.ToString(); } } //处理数据 JsonInterFace.Parse(e.Datagram, RemoteHost, RemotePort); } catch (Exception ex) { if (Parameters.LogStatus == 0) { JsonInterFace.IODataHelper.SaveLogs(DateTime.Now.ToString(), "接收服务端数据异常", ex.Message, ex.StackTrace); } else { Parameters.PrintfLogsExtended("接收服务端数据异常", ex.Message, ex.StackTrace); } } }
private void btnAdd_Click(object sender, RoutedEventArgs e) { try { if (cbxMode.SelectedIndex < 0) { cbxMode.Focus(); cbxMode.IsDropDownOpen = true; MessageBox.Show("请选择该设备的制式!", "提示", MessageBoxButton.OK, MessageBoxImage.Warning); return; } if (MessageBox.Show("确定添加设备[" + JsonInterFace.LteDeviceParameter.DeviceName + "]?", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Warning) == MessageBoxResult.OK) { if (NetWorkClient.ControllerServer.Connected) { Parameters.ConfigType = "Manul"; NetWorkClient.ControllerServer.Send(JsonInterFace.AddDeviceNameRequest(JsonInterFace.LteDeviceParameter.DomainFullPathName, JsonInterFace.LteDeviceParameter.DeviceName, JsonInterFace.LteDeviceParameter.DeviceMode)); } else { MessageBox.Show("网络与有服务器断开!", "提示", MessageBoxButton.OK, MessageBoxImage.Warning); return; } } } catch (Exception ex) { Parameters.PrintfLogsExtended(ex.Message, ex.StackTrace); } }
private void btnUpdate_Click(object sender, RoutedEventArgs e) { try { Dictionary <string, string> Params = new Dictionary <string, string>(); if (!selfParam.Mode.Equals(JsonInterFace.LteDeviceParameter.DeviceMode)) { Params.Add("mode", cbxMode.Text.Trim()); } if (!selfParam.SN.Trim().Equals(JsonInterFace.LteDeviceParameter.SN)) { Params.Add("sn", txtSN.Text.Trim()); } if (!selfParam.IP.Trim().Equals(JsonInterFace.LteDeviceParameter.IpAddr)) { Params.Add("ipAddr", txtIPAddr.Text.Trim()); } if (!selfParam.Port.Trim().Equals(JsonInterFace.LteDeviceParameter.Port)) { Params.Add("port", txtPort.Text.Trim()); } if (!selfParam.NetMask.Equals(JsonInterFace.LteDeviceParameter.NetMask)) { Params.Add("netmask", JsonInterFace.LteDeviceParameter.NetMask); } if (!selfParam.DeviceName.Trim().Equals(JsonInterFace.LteDeviceParameter.DeviceName)) { Params.Add("name", txtDeviceName.Text.Trim()); } Params.Add("carrier", "0"); if (Params.Count <= 0) { MessageBox.Show("内容未改变!", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Information); return; } if (MessageBox.Show("确定更新设备信息[" + JsonInterFace.LteDeviceParameter.DeviceName + "]?", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Warning) == MessageBoxResult.OK) { if (NetWorkClient.ControllerServer.Connected) { Parameters.ConfigType = "Manul"; NetWorkClient.ControllerServer.Send(JsonInterFace.AddDeviceNameUpdateParametersRequest(JsonInterFace.LteDeviceParameter.DomainFullPathName, selfParam.DeviceName, Params)); } } } catch (Exception ex) { Parameters.PrintfLogsExtended(ex.Message, ex.StackTrace); } }
private void btnAdd_Click(object sender, RoutedEventArgs e) { if (txtSourceDomainNodeName.Text.Trim() == "") { MessageBox.Show("请指定要添加域名的位置!", "提示", MessageBoxButton.OK, MessageBoxImage.Warning); return; } if (!txtDomainNodeName.Text.Trim().Equals("")) { //添加域结点 if ((Parameters.DomainActionInfoClass.NodeType.Equals(NodeType.StructureNode.ToString()) || Parameters.DomainActionInfoClass.NodeType.Equals(NodeType.RootNode.ToString())) && Parameters.DomainActionInfoClass.IsStation.Equals("0")) { if (MessageBox.Show("确定添加域名吗?", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Warning) == MessageBoxResult.OK) { try { Parameters.DomainActionInfoClass.SelfName = txtDomainNodeName.Text.Trim(); Parameters.DomainActionInfoClass.NodeContent = txtDomainNodeName.Text.Trim(); Parameters.DomainActionInfoClass.IsStation = "0"; Parameters.DomainActionInfoClass.NodeType = NodeType.StructureNode.ToString(); Parameters.DomainActionInfoClass.NodeIcon = new NodeIcon().StructureCloseNodeIcon; NetWorkClient.ControllerServer.Send(JsonInterFace.AddDomainNodeName(Parameters.DomainActionInfoClass.PathName, Parameters.DomainActionInfoClass.SelfName, Convert.ToInt32(Parameters.DomainActionInfoClass.IsStation), "")); txtDomainNodeName.Text = ""; } catch (Exception ex) { Parameters.PrintfLogsExtended(ex.Message, ex.StackTrace); } } } else if (Parameters.DomainActionInfoClass.NodeType.Equals(NodeType.StructureNode.ToString()) && Parameters.DomainActionInfoClass.IsStation.Equals("1")) { MessageBox.Show("站点中只能添加设备,要添加设备,请在设备管理中操作!", "提示", MessageBoxButton.OK, MessageBoxImage.Warning); return; } else if (Parameters.DomainActionInfoClass.NodeType.Equals(NodeType.LeafNode.ToString())) { MessageBox.Show("不能在设备中添加域名!", "提示", MessageBoxButton.OK, MessageBoxImage.Warning); return; } } else { MessageBox.Show("请输入域名!", "提示", MessageBoxButton.OK, MessageBoxImage.Warning); } }
private void btnExport_Click(object sender, RoutedEventArgs e) { if (MessageBox.Show("确定导出批量配置参数?", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Warning) == MessageBoxResult.Cancel) { return; } if (txtExportFile.Text == "") { Microsoft.Win32.SaveFileDialog SaveFileDialog = new Microsoft.Win32.SaveFileDialog(); SaveFileDialog.Filter = "Text File(*.txt)|*.txt|All files(*.*)|*.*"; SaveFileDialog.AddExtension = true; SaveFileDialog.RestoreDirectory = true; if ((bool)SaveFileDialog.ShowDialog()) { try { txtExportFile.Text = SaveFileDialog.FileName; if (SaveFileDialog.FileName != null && SaveFileDialog.FileName != "") { JsonInterFace.BatchConfigurationOutputParameter.LocalDir = SaveFileDialog.FileName; if (NetWorkClient.ControllerServer.Connected) { NetWorkClient.ControllerServer.Send(JsonInterFace.BatchConfigurationInfoRequest(new FileInfo(JsonInterFace.BatchConfigurationOutputParameter.LocalDir).Name)); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "提示", MessageBoxButton.OK, MessageBoxImage.Warning); } } } else { try { JsonInterFace.BatchConfigurationOutputParameter.LocalDir = txtExportFile.Text; if (NetWorkClient.ControllerServer.Connected) { NetWorkClient.ControllerServer.Send(JsonInterFace.BatchConfigurationInfoRequest(new FileInfo(JsonInterFace.BatchConfigurationOutputParameter.LocalDir).Name)); } } catch (Exception ex) { MessageBox.Show(ex.Message, "提示", MessageBoxButton.OK, MessageBoxImage.Warning); } } }
private void btnAddOK_Click(object sender, RoutedEventArgs e) { MessageBoxResult dr = MessageBox.Show("确定要修改用户访问权限吗?", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Question); if (dr == MessageBoxResult.OK) { string userName; string newPwd; string OldPwd; if ((!txtUpdateUserName.Text.Trim().Equals("")) || (!NewpasswordBox.Password.ToString().Equals("")) || (!OldpasswordBox.Password.ToString().Equals(""))) { userName = txtUpdateUserName.Text.Trim(); newPwd = NewpasswordBox.Password.ToString(); OldPwd = OldpasswordBox.Password.ToString(); //请求修改用户密码 if (NetWorkClient.ControllerServer.Connected) { NetWorkClient.ControllerServer.Send(JsonInterFace.Modify_user_psw_Request(userName, OldPwd, newPwd)); if (!PriIdSet.Equals("")) { NetWorkClient.ControllerServer.Send(JsonInterFace.Update_usr_domain_request(userName, PriIdSet, "")); } } else { Parameters.PrintfLogsExtended("向服务器请求修改用户密码:", "Connected: Failed!"); } if (!PriIdSet.Equals("")) { foreach (DataRow rw in JsonInterFace.UsrdomainManageClass.UsrDomainTable.Rows) { if (rw[0].ToString().Equals(userName)) { rw[1] = PriIdSet; break; } } } Thread.Sleep(1000); this.Close(); } else { MessageBox.Show("用户名、新密码、旧密码都不能为空"); } } }
private void btnSetLngLat_Click(object sender, RoutedEventArgs e) { try { if (StructureInfo.ParentName != "" || StructureInfo.ParentName != null) { mapweb.InvokeScript("deleteAllMarker"); mapweb.InvokeScript("setStructureNodePoint", new Object[] { StructureInfo.Tmplng, StructureInfo.Tmplat, StructureInfo.MarkerTitle }); var ParentName = string.Empty; for (int i = 0; i < StructureInfo.ParentName.Split(new char[] { '.' }).Length - 1; i++) { if (i == 0) { ParentName += StructureInfo.ParentName.Split(new char[] { '.' })[i]; } else { ParentName += "." + StructureInfo.ParentName.Split(new char[] { '.' })[i]; } } if (NetWorkClient.ControllerServer.Connected) { NetWorkClient.ControllerServer.Send(JsonInterFace.Set_station_location_Request(ParentName, StructureInfo.MarkerTitle, StructureInfo.Tmplng, StructureInfo.Tmplat)); } else { Parameters.PrintfLogsExtended("网络与服务器断开!", "Connected: Failed!"); } } else { MessageBox.Show("请先选择站点"); } } catch (Exception ex) { Parameters.PrintfLogsExtended("手动设置站点位置事件:", ex.Message, ex.StackTrace); } }
private void btnSelectIMSI_Click(object sender, RoutedEventArgs e) { try { string imsi = string.Empty; string timeStart = string.Empty; string timeEnd = string.Empty; timeStart = Convert.ToDateTime(dpStartTime.Text).ToString("yyyy-MM-dd") + " " + System.Int32.Parse(txtStartHour.Text.Trim()).ToString().PadLeft(2, '0') + ":" + System.Int32.Parse(txtStartMinute.Text.Trim()).ToString().PadLeft(2, '0') + ":" + System.Int32.Parse(txtStartSecond.Text.Trim()).ToString().PadLeft(2, '0'); timeEnd = Convert.ToDateTime(dpEndTime.Text).ToString("yyyy-MM-dd") + " " + System.Int32.Parse(txtEndHour.Text.Trim()).ToString().PadLeft(2, '0') + ":" + System.Int32.Parse(txtEndMinute.Text.Trim()).ToString().PadLeft(2, '0') + ":" + System.Int32.Parse(txtEndSecond.Text.Trim()).ToString().PadLeft(2, '0'); imsi = txtIMSI.Text.Trim(); if (NetWorkClient.ControllerServer.Connected) { NetWorkClient.ControllerServer.Send(JsonInterFace.Get_imsi_path_Request(timeStart, timeEnd, imsi)); } else { Parameters.PrintfLogsExtended("网络与服务器断开!", "Connected: Failed!"); } } catch (Exception ex) { MessageBox.Show("轨迹查询" + ex.Message, "提示", MessageBoxButton.OK, MessageBoxImage.Warning); } string marker = mapweb.InvokeScript("GetAllMarker").ToString(); string[] listMarker = marker.Split(new char[] { '|' }); for (int i = 0; i < listMarker.Length - 1; i++) { string point = listMarker[i]; } }
private void btnDelete_Click(object sender, RoutedEventArgs e) { try { if (cbxMode.SelectedIndex < 0) { MessageBox.Show("请选择制式!", "提示", MessageBoxButton.OK, MessageBoxImage.Warning); return; } if (MessageBox.Show("确定删除设备[" + JsonInterFace.LteDeviceParameter.DeviceName + "]?", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Warning) == MessageBoxResult.OK) { if (NetWorkClient.ControllerServer.Connected) { NetWorkClient.ControllerServer.Send(JsonInterFace.DeleteDeviceNameRequest(JsonInterFace.LteDeviceParameter.DomainFullPathName, JsonInterFace.LteDeviceParameter.DeviceName)); } } } catch (Exception ex) { Parameters.PrintfLogsExtended(ex.Message, ex.StackTrace); } }
private void btnOK_Click(object sender, RoutedEventArgs e) { string OriginalPd = txtOriginalPassword.Text.Trim(); string newPd = txtNewPassword.Password.Trim(); string reNewPd = txtReNewPassword.Password.Trim(); string userName = new DesEncrypt().UnEncrypt(Parameters.ReadIniFile("Login", "UserName", "", Parameters.INIFile), new DefineCode().Code()); if (newPd == reNewPd) { if (NetWorkClient.ControllerServer.Connected) { NetWorkClient.ControllerServer.Send(JsonInterFace.Modify_user_psw_Request(userName, OriginalPd, newPd)); } else { Parameters.PrintfLogsExtended("向服务器请求修改用户密码:", "Connected: Failed!"); } } else { MessageBox.Show("两次新密码输入不一致,请重新输入", "提示"); } }
private void btnEnter_Click(object sender, RoutedEventArgs e) { try { TreeViewNodeInfoClass.IsStation = (bool)chkStation.IsChecked; if (TreeViewNodeInfoClass.NodeName.Trim().Equals("")) { MessageBox.Show("请输入域名称!", "提示", MessageBoxButton.OK, MessageBoxImage.Warning); return; } else { if (!NetWorkClient.ControllerServer.Connected) { MessageBox.Show("网络已断开!", "提示", MessageBoxButton.OK, MessageBoxImage.Warning); return; } else { if (regexDomain.Match(TreeViewNodeInfoClass.NodeName).Success) { JsonInterFace.ShowMessage("输入的域名称格式非法,域名只能为[128位以下划线开头的字母或中文或英文组成的名称]!", 16); return; } //添加域名 if (TreeViewNodeInfoClass.Operation == DeviceTreeOperation.DomainAdd) { Parameters.DomainActionInfoClass.SelfID += 1; Parameters.DomainActionInfoClass.SelfName = TreeViewNodeInfoClass.NodeName; Parameters.DomainActionInfoClass.NodeContent = TreeViewNodeInfoClass.DesInfo; Parameters.DomainActionInfoClass.IsStation = (Convert.ToInt32((bool)chkStation.IsChecked)).ToString(); NetWorkClient.ControllerServer.Send(JsonInterFace.AddDomainNodeName(TreeViewNodeInfoClass.FullNodeName, TreeViewNodeInfoClass.NodeName, Convert.ToInt32(TreeViewNodeInfoClass.IsStation), txtDesContent.Text)); //添加经纬度 if (TreeViewNodeInfoClass.IsStation && txtLngContent.Text != "" & txtLatContent.Text != "") { Regex re = new Regex(@"^(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*))$"); if (!re.IsMatch(txtLngContent.Text) || !re.IsMatch(txtLatContent.Text)) { MessageBox.Show("经纬度输入格式有误", "提示", MessageBoxButton.OK, MessageBoxImage.Warning); return; } NetWorkClient.ControllerServer.Send(JsonInterFace.Set_station_location_Request(TreeViewNodeInfoClass.FullNodeName, TreeViewNodeInfoClass.NodeName, JsonInterFace.StationMap.Lng, JsonInterFace.StationMap.Lat)); } } //重命名域名 else if (TreeViewNodeInfoClass.Operation == DeviceTreeOperation.DomainReName) { string oldDomainName = TreeViewNodeInfoClass.FullNodeName; string newDomainName = string.Empty; string[] tmpDomainName = oldDomainName.Split(new char[] { '.' }); if (!Parameters.DomainActionInfoClass.SelfID.Equals(1)) { for (int i = 0; i < tmpDomainName.Length - 1; i++) { if (!newDomainName.Trim().Equals("")) { newDomainName += "." + tmpDomainName[i]; } else { newDomainName += tmpDomainName[i]; } } newDomainName = newDomainName + "." + TreeViewNodeInfoClass.NodeName; Parameters.DomainActionInfoClass.OldFullDomainName = oldDomainName; Parameters.DomainActionInfoClass.SelfName = txtInputContent.Text; Parameters.DomainActionInfoClass.NodeContent = txtInputContent.Text; Parameters.DomainActionInfoClass.AliasName = txtDesContent.Text; Parameters.DomainActionInfoClass.PathName = newDomainName; Parameters.DomainActionInfoClass.NewFullDomainName = newDomainName; Parameters.DomainActionInfoClass.IsStation = (Convert.ToInt32((bool)chkStation.IsChecked)).ToString(); if (NetWorkClient.ControllerServer.Connected) { //判断域名是否修改,如果没有修改就更新备注或者是否站点(需增加接口支持) NetWorkClient.ControllerServer.Send(JsonInterFace.ReNameDomainNodeName(oldDomainName, newDomainName, Convert.ToInt32(Parameters.DomainActionInfoClass.IsStation), Parameters.DomainActionInfoClass.AliasName)); } else { JsonInterFace.ShowMessage("网络与服务器断开!", (int)WindowMessageType.Warnning); } } else { JsonInterFace.ShowMessage("该主域名称不能修改!", (int)WindowMessageType.Warnning); } //添加经纬度 if (TreeViewNodeInfoClass.IsStation && txtLngContent.Text != "" & txtLatContent.Text != "") { string ParentName = string.Empty; Regex re = new Regex(@"^(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*))$"); for (int i = 0; i < TreeViewNodeInfoClass.FullNodeName.Split(new char[] { '.' }).Length - 1; i++) { if (i == 0) { ParentName += TreeViewNodeInfoClass.FullNodeName.Split(new char[] { '.' })[i]; } else { ParentName += "." + TreeViewNodeInfoClass.FullNodeName.Split(new char[] { '.' })[i]; } } if (!re.IsMatch(txtLngContent.Text) || !re.IsMatch(txtLatContent.Text)) { MessageBox.Show("经纬度输入格式有误", "提示", MessageBoxButton.OK, MessageBoxImage.Warning); return; } NetWorkClient.ControllerServer.Send(JsonInterFace.Set_station_location_Request(ParentName, TreeViewNodeInfoClass.NodeName, JsonInterFace.StationMap.Lng, JsonInterFace.StationMap.Lat)); } } else if (TreeViewNodeInfoClass.Operation == DeviceTreeOperation.DeviceAdd) { Parameters.DeviceActionInfoClass.SelfID = Parameters.DomainActionInfoClass.SelfID.ToString(); Parameters.DeviceActionInfoClass.ParentID = Parameters.DomainActionInfoClass.ParentID.ToString(); Parameters.DeviceActionInfoClass.DeviceName = txtInputContent.Text.Trim(); Parameters.DeviceActionInfoClass.DomainFullName = TreeViewNodeInfoClass.FullNodeName; NetWorkClient.ControllerServer.Send(JsonInterFace.AddDeviceNameRequest(Parameters.DeviceActionInfoClass.DomainFullName, Parameters.DeviceActionInfoClass.DeviceName, Parameters.DeviceActionInfoClass.Mode)); } } } } catch (Exception ex) { Parameters.PrintfLogsExtended(ex.Message, ex.StackTrace); } }
private void Page_Loaded(object sender, RoutedEventArgs e) { try { //语言 //数据源 txtTxpower.DataContext = JsonInterFace.WhiteListSelfLearningParameter; txtDuration.DataContext = JsonInterFace.WhiteListSelfLearningParameter; txtClearWhiteList.DataContext = JsonInterFace.WhiteListSelfLearningParameter; txtCommand.DataContext = JsonInterFace.WhiteListSelfLearningParameter; //白名单状态 txtWhitelListSellLearningStatus.DataContext = JsonInterFace.LTEDeviceDetail; //获取白名单自学习状态 if (NetWorkClient.ControllerServer.Connected) { string DomainFullPathName = string.Empty; string[] _DomainFullPathName = RemoteAPInfoParameter.DomainFullPathName.Split(new char[] { '.' }); for (int i = 0; i < _DomainFullPathName.Length - 1; i++) { if (DomainFullPathName == "" || DomainFullPathName == null) { DomainFullPathName = _DomainFullPathName[i]; } else { DomainFullPathName += "." + _DomainFullPathName[i]; } } NetWorkClient.ControllerServer.Send( JsonInterFace.GetDeviceDetailRequest( DomainFullPathName, RemoteAPInfoParameter.DeviceName ) ); } else { MessageBox.Show("网络与服务器断开!", "提示", MessageBoxButton.OK, MessageBoxImage.Warning); } //自学习状态参数查询 if (NetWorkClient.ControllerServer.Connected) { NetWorkClient.ControllerServer.Send( JsonInterFace.APWhiteListSelfLearningParameterQuery( RemoteAPInfoParameter.DomainFullPathName, RemoteAPInfoParameter.DeviceName, RemoteAPInfoParameter.IP, RemoteAPInfoParameter.Port, RemoteAPInfoParameter.InnerType, RemoteAPInfoParameter.SN ) ); } else { MessageBox.Show("网络与服务器断开!", "提示", MessageBoxButton.OK, MessageBoxImage.Warning); } } catch (Exception ex) { Parameters.PrintfLogsExtended(ex.Message, ex.StackTrace); } }
private void btnEnter_Click(object sender, RoutedEventArgs e) { Regex regexInt = new Regex(@"\d"); try { if (txtTxpower.Text.Trim() != "") { if (regexInt.Match(txtTxpower.Text).Success) { if (Convert.ToInt32(txtTxpower.Text) < -128 || Convert.ToInt32(txtTxpower.Text) > 0) { MessageBox.Show("衰减值超出范围,范围[-128~0]", "提示", MessageBoxButton.OK, MessageBoxImage.Warning); return; } } else { MessageBox.Show("衰减值格式非法,范围[-128~0]", "提示", MessageBoxButton.OK, MessageBoxImage.Warning); return; } } else { MessageBox.Show("请输入衰减值,范围[-128~0]", "提示", MessageBoxButton.OK, MessageBoxImage.Warning); return; } if (txtDuration.Text.Trim() != "") { if (regexInt.Match(txtDuration.Text).Success) { if (Convert.ToUInt32(txtDuration.Text) < 0 || Convert.ToUInt32(txtDuration.Text) > 65535) { MessageBox.Show("白名单自学习时长超出范围,范围[0-65535]", "提示", MessageBoxButton.OK, MessageBoxImage.Warning); return; } } else { MessageBox.Show("白名单自学习时长格式非,范围[0-65535]", "提示", MessageBoxButton.OK, MessageBoxImage.Warning); return; } } else { MessageBox.Show("请输入白名单自学习时长,范围[0-65535]", "提示", MessageBoxButton.OK, MessageBoxImage.Warning); return; } string ParentFullNamePath = string.Empty; string[] _ParentFullNamePath = RemoteAPInfoParameter.DomainFullPathName.Split(new char[] { '.' }); for (int i = 0; i < _ParentFullNamePath.Length - 1; i++) { if (ParentFullNamePath == null || ParentFullNamePath == "") { ParentFullNamePath = _ParentFullNamePath[i]; } else { ParentFullNamePath += "." + _ParentFullNamePath[i]; } } // >>> 检测白名单自学习工作状态 <<< if (JsonInterFace.LTEDeviceDetail.Command == "已启动") { if (JsonInterFace.WhiteListSelfLearningParameter.Command != "0") { MessageBox.Show("操作绝拒,白名单自学习正在工作......,请先停止!", "提示", MessageBoxButton.OK, MessageBoxImage.Warning); return; } } //发送 if (NetWorkClient.ControllerServer.Connected) { NetWorkClient.ControllerServer.Send( JsonInterFace.APWhiteListSelfLearningSettingRequest( ParentFullNamePath, RemoteAPInfoParameter.DeviceName, RemoteAPInfoParameter.IP, RemoteAPInfoParameter.Port, RemoteAPInfoParameter.InnerType, RemoteAPInfoParameter.SN )); DialogResult = true; } else { MessageBox.Show("网络与服务器断开!", "提示", MessageBoxButton.OK, MessageBoxImage.Warning); return; } } catch (Exception ex) { Parameters.PrintfLogsExtended(ex.Message, ex.StackTrace); } }
//批量提交设备重启 private void RebootApTasck(byte TaskType) { try { switch (TaskType) { case 0: JsonInterFace.SystemLogsInfo.Input( DateTime.Now.ToString(), "正在重启动设备[" + JsonInterFace.LteDeviceParameter.DomainFullPathName + "." + JsonInterFace.LteDeviceParameter.DeviceName + ",SN=" + JsonInterFace.LteDeviceParameter.SN + "]", "设备重启", "正在通讯..." ); NetWorkClient.ControllerServer.Send(JsonInterFace.APRestartRequest( JsonInterFace.LteDeviceParameter.DomainFullPathName + "." + JsonInterFace.LteDeviceParameter.DeviceName, JsonInterFace.LteDeviceParameter.DeviceName, JsonInterFace.LteDeviceParameter.IpAddr, int.Parse(JsonInterFace.LteDeviceParameter.Port), JsonInterFace.LteDeviceParameter.InnerType, JsonInterFace.LteDeviceParameter.SN )); break; case 1: JsonInterFace.SystemLogsInfo.Input( DateTime.Now.ToString(), "正在重启动设备[" + JsonInterFace.WCDMADeviceParameter.DomainFullPathName + "." + JsonInterFace.WCDMADeviceParameter.DeviceName + ",SN=" + JsonInterFace.WCDMADeviceParameter.SN + "]", "设备重启", "正在通讯..." ); NetWorkClient.ControllerServer.Send(JsonInterFace.APRestartRequest( JsonInterFace.WCDMADeviceParameter.DomainFullPathName + "." + JsonInterFace.WCDMADeviceParameter.DeviceName, JsonInterFace.WCDMADeviceParameter.DeviceName, JsonInterFace.WCDMADeviceParameter.IpAddr, int.Parse(JsonInterFace.WCDMADeviceParameter.Port), JsonInterFace.WCDMADeviceParameter.InnerType, JsonInterFace.WCDMADeviceParameter.SN )); break; case 2: JsonInterFace.SystemLogsInfo.Input( DateTime.Now.ToString(), "正在重启动设备[" + JsonInterFace.GSMDeviceParameter.DomainFullPathName + "." + JsonInterFace.GSMDeviceParameter.DeviceName + ",SN=" + JsonInterFace.GSMDeviceParameter.SN + "]", "设备重启", "正在通讯..." ); NetWorkClient.ControllerServer.Send(JsonInterFace.APRestartRequest( JsonInterFace.GSMDeviceParameter.DomainFullPathName + "." + JsonInterFace.GSMDeviceParameter.DeviceName, JsonInterFace.GSMDeviceParameter.DeviceName, JsonInterFace.GSMDeviceParameter.IpAddr, int.Parse(JsonInterFace.GSMDeviceParameter.Port), JsonInterFace.GSMDeviceParameter.InnerType, JsonInterFace.GSMDeviceParameter.SN )); break; case 3: JsonInterFace.SystemLogsInfo.Input( DateTime.Now.ToString(), "正在重启动设备[" + JsonInterFace.CDMADeviceParameter.DomainFullPathName + "." + JsonInterFace.CDMADeviceParameter.DeviceName + ",SN=" + JsonInterFace.CDMADeviceParameter.SN + "]", "设备重启", "正在通讯..." ); NetWorkClient.ControllerServer.Send(JsonInterFace.APRestartRequest( JsonInterFace.CDMADeviceParameter.DomainFullPathName + "." + JsonInterFace.CDMADeviceParameter.DeviceName, JsonInterFace.CDMADeviceParameter.DeviceName, JsonInterFace.CDMADeviceParameter.IpAddr, int.Parse(JsonInterFace.CDMADeviceParameter.Port), JsonInterFace.CDMADeviceParameter.InnerType, JsonInterFace.CDMADeviceParameter.SN )); break; case 4: JsonInterFace.SystemLogsInfo.Input( DateTime.Now.ToString(), "正在重启动设备[" + JsonInterFace.GSMV2DeviceParameter.DomainFullPathName + "." + JsonInterFace.GSMV2DeviceParameter.DeviceName + ",SN=" + JsonInterFace.GSMV2DeviceParameter.SN + "]", "设备重启", "正在通讯..." ); NetWorkClient.ControllerServer.Send(JsonInterFace.APRestartRequest( JsonInterFace.GSMV2DeviceParameter.DomainFullPathName + "." + JsonInterFace.GSMV2DeviceParameter.DeviceName, JsonInterFace.GSMV2DeviceParameter.DeviceName, JsonInterFace.GSMV2DeviceParameter.IpAddr, int.Parse(JsonInterFace.GSMV2DeviceParameter.Port), JsonInterFace.GSMV2DeviceParameter.InnerType, JsonInterFace.GSMV2DeviceParameter.SN )); break; case 5: JsonInterFace.SystemLogsInfo.Input( DateTime.Now.ToString(), "正在重启动设备[" + JsonInterFace.TDSDeviceParameter.DomainFullPathName + "." + JsonInterFace.TDSDeviceParameter.DeviceName + ",SN=" + JsonInterFace.TDSDeviceParameter.SN + "]", "设备重启", "正在通讯..." ); NetWorkClient.ControllerServer.Send(JsonInterFace.APRestartRequest( JsonInterFace.TDSDeviceParameter.DomainFullPathName + "." + JsonInterFace.TDSDeviceParameter.DeviceName, JsonInterFace.TDSDeviceParameter.DeviceName, JsonInterFace.TDSDeviceParameter.IpAddr, int.Parse(JsonInterFace.TDSDeviceParameter.Port), JsonInterFace.TDSDeviceParameter.InnerType, JsonInterFace.TDSDeviceParameter.SN )); break; default: JsonInterFace.SystemLogsInfo.Input(DateTime.Now.ToString(), "设备重启未找到对应的类型", "设备重启", "内部故障"); break; } } catch (Exception Ex) { Parameters.PrintfLogsExtended("提交设备重启", Ex.Message, Ex.StackTrace); } }
private void chkTreeViewItem_Click(object sender, RoutedEventArgs e) { try { //实现单选效果 if ((DeviceTreeViewItem[0] as CheckBox) == null) { DeviceTreeViewItem[0] = sender; } else { if (sender != DeviceTreeViewItem[0]) { ((CheckBoxTreeModel)(DeviceTreeViewItem[0] as CheckBox).DataContext).IsChecked = false; (DeviceTreeViewItem[0] as CheckBox).IsChecked = false; ((CheckBoxTreeModel)(sender as CheckBox).DataContext).IsChecked = true; (sender as CheckBox).IsChecked = true; } DeviceTreeViewItem[0] = sender; } mapweb.InvokeScript("deleteAllMarker"); mapweb.InvokeScript("existenceLngLat", new Object[] { true }); string SelfID = ((CheckBoxTreeModel)(sender as CheckBox).DataContext).Id; string Model = ((CheckBoxTreeModel)(sender as CheckBox).DataContext).Mode; string NodeName = ((CheckBoxTreeModel)(sender as CheckBox).DataContext).Name; string FullName = ((CheckBoxTreeModel)(sender as CheckBox).DataContext).FullName; string IsStation = ((CheckBoxTreeModel)(sender as CheckBox).DataContext).IsStation; string SelfNodeType = ((CheckBoxTreeModel)(sender as CheckBox).DataContext).SelfNodeType; Boolean NodeChecked = ((CheckBoxTreeModel)(sender as CheckBox).DataContext).IsChecked; if (!NodeChecked) { return; } if (NodeChecked && IsStation == "1" && SelfNodeType.Equals(NodeType.StructureNode.ToString())) { if (NetWorkClient.ControllerServer.Connected) { string[] name = FullName.Split(new char[] { '.' }); string ParentName = string.Empty; for (int i = 0; i < name.Length - 1; i++) { if (i == 0) { ParentName += name[i]; } else { ParentName += "." + name[i]; } } NetWorkClient.ControllerServer.Send(JsonInterFace.Get_station_location_Request(ParentName, NodeName)); } else { Parameters.PrintfLogsExtended("网络与服务器断开!", "Connected: Failed!"); } } } catch (Exception ex) { Parameters.PrintfLogsExtended("百度地图显示", ex.Message, ex.StackTrace); } }
private void btnOK_Click(object sender, RoutedEventArgs e) { string GeranRedirect = "0"; string arfcn = String.Empty; string UtranRedirect = "0"; string uarfcn = String.Empty; string EutranRedirect = "0"; string earfcn = String.Empty; string parentFullPathName = txtParentFullPathName.Text; string name = txtSelfName.Text; string category = string.Empty; string priority = string.Empty; string RejectMethod = string.Empty; string additionalFreq = txtAdditionalFreq.Text; //用户类型 if ((bool)WhiteName.IsChecked) { category = "0"; Parameters.RedirectionParam.Category = WhiteName.Content.ToString(); } else if ((bool)BlackName.IsChecked) { category = "1"; Parameters.RedirectionParam.Category = BlackName.Content.ToString(); } else { category = "2"; Parameters.RedirectionParam.Category = OtherName.Content.ToString(); } //优选 if ((bool)rbGeranRedirect.IsChecked) { priority = "2"; GeranRedirect = "1"; arfcn = txtOptimization.Text.Trim(); Parameters.RedirectionParam.Optimization = "2G"; } else if ((bool)rbUtranRedirect.IsChecked) { priority = "3"; UtranRedirect = "1"; uarfcn = txtOptimization.Text.Trim(); Parameters.RedirectionParam.Optimization = "3G"; } else if ((bool)rbEutranRedirect.IsChecked) { priority = "4"; EutranRedirect = "1"; earfcn = txtOptimization.Text.Trim(); Parameters.RedirectionParam.Optimization = "4G"; } else { priority = "0"; Parameters.RedirectionParam.Optimization = "无"; } //制式 if (cmbRejectMethod.SelectedIndex == 0) { RejectMethod = "1"; } else if (cmbRejectMethod.SelectedIndex == 1) { RejectMethod = "2"; } else if (cmbRejectMethod.SelectedIndex == 2) { RejectMethod = "255"; } else { RejectMethod = System.Convert.ToInt32(cmbRejectMethod.Text, 10).ToString(); } Parameters.RedirectionParam.Priority = priority; Parameters.RedirectionParam.RejectMethod = cmbRejectMethod.Text; Parameters.RedirectionParam.Freq = txtOptimization.Text; Parameters.RedirectionParam.AdditionalFreq = txtAdditionalFreq.Text; if (NetWorkClient.ControllerServer.Connected) { NetWorkClient.ControllerServer.Send(JsonInterFace.Set_redirection_Request(parentFullPathName, name, category, priority, GeranRedirect, arfcn, UtranRedirect, uarfcn, EutranRedirect, earfcn, RejectMethod, additionalFreq)); Thread.Sleep(1000); this.Close(); } else { Parameters.PrintfLogsExtended("向服务器请求设置重定向:", "Connected: Failed!"); } }
private void btnSave_Click(object sender, RoutedEventArgs e) { if (MessageBox.Show("确定保存服务器基本参数?", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Warning) == MessageBoxResult.OK) { //检测数据正确性 if (!Parameters.IsIP((object)Parameters.ServerBaseParameter.StrDbIpAddr)) { JsonInterFace.ShowMessage("数据库IP地址非法!", 16); return; } if (!Parameters.IsIP((object)Parameters.ServerBaseParameter.StrFtpIpAddr)) { JsonInterFace.ShowMessage("FTP服务器IP地址非法!", 16); return; } if (!Parameters.ISDigital(Parameters.ServerBaseParameter.StrFtpPort)) { JsonInterFace.ShowMessage("FTP服务器端口非法!", 16); return; } else { if (int.Parse(Parameters.ServerBaseParameter.StrFtpPort) < 1 || int.Parse(Parameters.ServerBaseParameter.StrFtpPort) > 65535) { JsonInterFace.ShowMessage("FTP服务器端口非法!", 16); return; } } if (!Parameters.ISDigital(Parameters.ServerBaseParameter.StrStartPortCDMA_ZYF)) { JsonInterFace.ShowMessage("CDMA监听端口非法!", 16); return; } else { if (int.Parse(Parameters.ServerBaseParameter.StrStartPortCDMA_ZYF) < 1 || int.Parse(Parameters.ServerBaseParameter.StrStartPortCDMA_ZYF) > 65535) { JsonInterFace.ShowMessage("CDMA监听端口非法!", 16); return; } } if (!Parameters.ISDigital(Parameters.ServerBaseParameter.StrStartPortGSM_ZYF)) { JsonInterFace.ShowMessage("GSMV2监听端口非法!", 16); return; } else { if (int.Parse(Parameters.ServerBaseParameter.StrStartPortGSM_ZYF) < 1 || int.Parse(Parameters.ServerBaseParameter.StrStartPortGSM_ZYF) > 65535) { JsonInterFace.ShowMessage("GSMV2监听端口非法!", 16); return; } } if (!Parameters.ISDigital(Parameters.ServerBaseParameter.StrStartPortGSM_HJT)) { JsonInterFace.ShowMessage("GSM监听端口非法!", 16); return; } else { if (int.Parse(Parameters.ServerBaseParameter.StrStartPortGSM_HJT) < 1 || int.Parse(Parameters.ServerBaseParameter.StrStartPortGSM_HJT) > 65535) { JsonInterFace.ShowMessage("GSM监听端口非法!", 16); return; } } if (!Parameters.ISDigital(Parameters.ServerBaseParameter.StrStartPortLTE)) { JsonInterFace.ShowMessage("LTE监听端口非法!", 16); return; } else { if (int.Parse(Parameters.ServerBaseParameter.StrStartPortLTE) < 1 || int.Parse(Parameters.ServerBaseParameter.StrStartPortLTE) > 65535) { JsonInterFace.ShowMessage("LTE监听端口非法!", 16); return; } } if (!Parameters.ISDigital(Parameters.ServerBaseParameter.StrStartPortTDS)) { JsonInterFace.ShowMessage("TDS监听端口非法!", 16); return; } else { if (int.Parse(Parameters.ServerBaseParameter.StrStartPortTDS) < 1 || int.Parse(Parameters.ServerBaseParameter.StrStartPortTDS) > 65535) { JsonInterFace.ShowMessage("TDS监听端口非法!", 16); return; } } if (!Parameters.ISDigital(Parameters.ServerBaseParameter.StrStartPortWCDMA)) { JsonInterFace.ShowMessage("WCDMA监听端口非法!", 16); return; } else { if (int.Parse(Parameters.ServerBaseParameter.StrStartPortWCDMA) < 1 || int.Parse(Parameters.ServerBaseParameter.StrStartPortWCDMA) > 65535) { JsonInterFace.ShowMessage("WCDMA监听端口非法!", 16); return; } } if (!Parameters.ISDigital(Parameters.ServerBaseParameter.StrStartPortAppWindows)) { JsonInterFace.ShowMessage("Client监听端口非法!", 16); return; } else { if (int.Parse(Parameters.ServerBaseParameter.StrStartPortAppWindows) < 1 || int.Parse(Parameters.ServerBaseParameter.StrStartPortAppWindows) > 65535) { JsonInterFace.ShowMessage("Client监听端口非法!", 16); return; } } if (!Parameters.ISDigital(Parameters.ServerBaseParameter.StrStartPortAppLinux)) { JsonInterFace.ShowMessage("AP监听端口非法!", 16); return; } else { if (int.Parse(Parameters.ServerBaseParameter.StrStartPortAppLinux) < 1 || int.Parse(Parameters.ServerBaseParameter.StrStartPortAppLinux) > 65535) { JsonInterFace.ShowMessage("AP监听端口非法!", 16); return; } } if (!Parameters.ISDigital(Parameters.ServerBaseParameter.StrStartPortAppAndroid)) { JsonInterFace.ShowMessage("Android监听端口非法!", 16); return; } else { if (int.Parse(Parameters.ServerBaseParameter.StrStartPortAppAndroid) < 1 || int.Parse(Parameters.ServerBaseParameter.StrStartPortAppAndroid) > 65535) { JsonInterFace.ShowMessage("Android监听端口非法!", 16); return; } } if (!Parameters.ISDigital(Parameters.ServerBaseParameter.LogMaxSize)) { JsonInterFace.ShowMessage("Log文件大小值非法!", 16); return; } else { if (int.Parse(Parameters.ServerBaseParameter.LogMaxSize) < 1 || int.Parse(Parameters.ServerBaseParameter.LogMaxSize) > 65535) { JsonInterFace.ShowMessage("Log文件大小值非法!", 16); return; } } Dictionary <string, string> Params = new Dictionary <string, string>(); Params.Add("strDbIpAddr", Parameters.ServerBaseParameter.StrDbIpAddr); Params.Add("logOutputLevel", Parameters.ServerBaseParameter.LogOutputLevel); Params.Add("strFtpIpAddr", Parameters.ServerBaseParameter.StrFtpIpAddr); Params.Add("strFtpUserId", Parameters.ServerBaseParameter.StrFtpUserId); Params.Add("strFtpUserPsw", Parameters.ServerBaseParameter.StrFtpUserPsw); Params.Add("strFtpPort", Parameters.ServerBaseParameter.StrFtpPort); Params.Add("strFtpUpdateDir", Parameters.ServerBaseParameter.StrFtpUpdateDir); Params.Add("strStartPortCDMA_ZYF", Parameters.ServerBaseParameter.StrStartPortCDMA_ZYF); Params.Add("strStartPortGSM_ZYF", Parameters.ServerBaseParameter.StrStartPortGSM_ZYF); Params.Add("strStartPortGSM_HJT", Parameters.ServerBaseParameter.StrStartPortGSM_HJT); Params.Add("strStartPortLTE", Parameters.ServerBaseParameter.StrStartPortLTE); Params.Add("strStartPortTDS", Parameters.ServerBaseParameter.StrStartPortTDS); Params.Add("strStartPortWCDMA", Parameters.ServerBaseParameter.StrStartPortWCDMA); Params.Add("strStartPortAppWindows", Parameters.ServerBaseParameter.StrStartPortAppWindows); Params.Add("strStartPortAppLinux", Parameters.ServerBaseParameter.StrStartPortAppLinux); Params.Add("strStartPortAppAndroid", Parameters.ServerBaseParameter.StrStartPortAppAndroid); Params.Add("dataAlignMode", Parameters.ServerBaseParameter.DataAlignMode); Params.Add("logMaxSize", Parameters.ServerBaseParameter.LogMaxSize); if (NetWorkClient.ControllerServer.Connected) { NetWorkClient.ControllerServer.Send(JsonInterFace.ServerBaseParameterSaveRequest(Params)); } else { MessageBox.Show("网络与服务器已断开!", "提示", MessageBoxButton.OK, MessageBoxImage.Warning); } } }
private void AddStructureNode() { Thread.Sleep(5000); while (true) { try { if (ThreadFlag) { Dispatcher.Invoke(() => { string Point = mapweb.InvokeScript("getPoint").ToString(); if (Point != null && Point.Length > 0) { StructureInfo.Tmplng = Point.Split(new char[] { ',' })[0]; StructureInfo.Tmplat = Point.Split(new char[] { ',' })[1]; } string StructureInfostr = mapweb.InvokeScript("getPointInfo").ToString(); if (StructureInfostr != null && StructureInfostr.Length > 0) { if (StructureInfostr.Split(new char[] { ',' }).Length > 1) { StructureInfo.ParentName = ((CheckBoxTreeModel)(DeviceTreeViewItem[0] as CheckBox).DataContext).FullName; StructureInfo.MarkerTitle = ((CheckBoxTreeModel)(DeviceTreeViewItem[0] as CheckBox).DataContext).Name; string[] name = StructureInfo.ParentName.Split(new char[] { '.' }); string ParentName = string.Empty; for (int i = 0; i < name.Length - 1; i++) { if (i == 0) { ParentName += name[i]; } else { ParentName += "." + name[i]; } } StructureInfo.Tmplng = StructureInfostr.Split(new char[] { ',' })[0]; StructureInfo.Tmplat = StructureInfostr.Split(new char[] { ',' })[1]; StructureInfo.SetExistence = Convert.ToBoolean(StructureInfostr.Split(new char[] { ',' })[2]); if (NetWorkClient.ControllerServer.Connected) { //添加域(不重复实现) //NetWorkClient.ControllerServer.Send(JsonInterFace.AddDomainNodeName(StructureInfo.ParentName, StructureInfo.MarkerTitle, Convert.ToInt32(StructureInfo.IsStation), StructureInfo.Des)); //如果添加站点,则保存位置 if (StructureInfo.SetExistence) { NetWorkClient.ControllerServer.Send(JsonInterFace.Set_station_location_Request(ParentName, StructureInfo.MarkerTitle, StructureInfo.Tmplng, StructureInfo.Tmplat)); } } else { Parameters.PrintfLogsExtended("网络与服务器断开!", "Connected: Failed!"); } } } }); } } catch (Exception ex) { Parameters.PrintfLogsExtended("添加站点错误", ex.Message, ex.StackTrace); } Thread.Sleep(50); } }
private void btnOK_Click(object sender, RoutedEventArgs e) { string RoleType = string.Empty; string IsRead = string.Empty; string IsWrite = string.Empty; JsonInterFace.RoleManageInfo.Name = ""; JsonInterFace.RoleManageInfo.RoleType = ""; JsonInterFace.RoleManageInfo.TimeStart = ""; JsonInterFace.RoleManageInfo.TimeEnd = ""; JsonInterFace.RoleManageInfo.Des = ""; JsonInterFace.RoleManageInfo.IsRead = ""; JsonInterFace.RoleManageInfo.IsWrite = ""; JsonInterFace.RoleManageInfo.AliasName = ""; try { if (cbInherit.SelectedIndex == 0) { RoleType = "Operator"; IsRead = GetpriIdSet(treeSource); IsWrite = GetIsWrite(treeSource); } else { if (JsonInterFace.GroupprivilegeManageList.Count > 0) { for (int i = 0; i < JsonInterFace.GroupprivilegeManageList.Count; i++) { if (cbInherit.SelectedIndex == 1) { RoleType = "SeniorOperator"; if (JsonInterFace.GroupprivilegeManageList[i].GroupName.Equals("SeniorOperator")) { IsRead = JsonInterFace.GroupprivilegeManageList[i].PriIdSet; IsWrite = JsonInterFace.GroupprivilegeManageList[i].Des; } } else if (cbInherit.SelectedIndex == 2) { RoleType = "Operator"; if (JsonInterFace.GroupprivilegeManageList[i].GroupName.Equals("Operator")) { IsRead = JsonInterFace.GroupprivilegeManageList[i].PriIdSet; IsWrite = JsonInterFace.GroupprivilegeManageList[i].Des; } } } } else { if (cbInherit.SelectedIndex == 1) { RoleType = "SeniorOperator"; IsRead = ""; IsWrite = ""; } else if (cbInherit.SelectedIndex == 2) { RoleType = "Operator"; IsRead = ""; IsWrite = ""; } } } MessageBoxResult dr = MessageBox.Show("确定要增加用户组吗?", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Question); if (dr == MessageBoxResult.OK) { //请求增加用户组和权限 if (NetWorkClient.ControllerServer.Connected) { if ((!dploreStartTime.Text.Equals("")) && (!dploreEndTime.Text.Equals(""))) { JsonInterFace.RoleManageInfo.TimeStart = Convert.ToDateTime(dploreStartTime.Text).ToString("yyyy-MM-dd 00:00:00"); JsonInterFace.RoleManageInfo.TimeEnd = Convert.ToDateTime(dploreEndTime.Text).ToString("yyyy-MM-dd 00:00:00"); } else { JsonInterFace.RoleManageInfo.TimeStart = "1970-01-01 00:00:00"; JsonInterFace.RoleManageInfo.TimeEnd = "3000-01-01 00:00:00"; } Parameters.ConfigType = "AddRole"; JsonInterFace.RoleManageInfo.Name = txtUserGroupName.Text.Trim(); JsonInterFace.RoleManageInfo.RoleType = RoleType; JsonInterFace.RoleManageInfo.Des = ""; JsonInterFace.RoleManageInfo.IsRead = IsRead; JsonInterFace.RoleManageInfo.IsWrite = IsWrite; JsonInterFace.RoleManageInfo.AliasName = txtUserGroupName.Text.Trim(); //添加用户组 NetWorkClient.ControllerServer.Send(JsonInterFace.Add_role_Request(JsonInterFace.RoleManageInfo.Name, JsonInterFace.RoleManageInfo.RoleType, JsonInterFace.RoleManageInfo.TimeStart, JsonInterFace.RoleManageInfo.TimeEnd, "")); if (!JsonInterFace.RoleManageInfo.IsRead.Equals("")) { NetWorkClient.ControllerServer.Send(JsonInterFace.Add_group_privilege_request(JsonInterFace.RoleManageInfo.Name, JsonInterFace.RoleManageInfo.IsRead, JsonInterFace.RoleManageInfo.IsWrite)); } this.Close(); } else { Parameters.PrintfLogsExtended("向服务器请求增加用户及权限:", "Connected: Failed!"); } } } catch (Exception ex) { Parameters.PrintfLogsExtended("添加用户组", ex.Message, ex.StackTrace); } }
private void btnDelete_Click(object sender, RoutedEventArgs e) { try { if (txtSourceDomainNodeName.Text.Trim() == "") { MessageBox.Show("请指定要添加域名的位置!", "提示", MessageBoxButton.OK, MessageBoxImage.Warning); return; } if (DeviceListTreeView.SelectedItem != null) { string NodeName = ((CheckBoxTreeModel)DeviceListTreeView.SelectedItem).Name; int SelfID = Convert.ToInt32(((CheckBoxTreeModel)DeviceListTreeView.SelectedItem).Id); int ParentID = 0; string FullNodeName = string.Empty; bool isStation = false; string TreeNodeType = string.Empty; for (int i = 0; i < JsonInterFace.BindTreeViewClass.DeviceTreeTable.Rows.Count; i++) { if (JsonInterFace.BindTreeViewClass.DeviceTreeTable.Rows[i][2].ToString().Equals(NodeName) && int.Parse(JsonInterFace.BindTreeViewClass.DeviceTreeTable.Rows[i][1].ToString()).Equals(SelfID)) { FullNodeName = JsonInterFace.BindTreeViewClass.DeviceTreeTable.Rows[i][0].ToString(); ParentID = Convert.ToInt32(JsonInterFace.BindTreeViewClass.DeviceTreeTable.Rows[i][3].ToString()); isStation = Convert.ToBoolean(int.Parse(JsonInterFace.BindTreeViewClass.DeviceTreeTable.Rows[i][4].ToString())); TreeNodeType = JsonInterFace.BindTreeViewClass.DeviceTreeTable.Rows[i][8].ToString(); break; } } if (TreeNodeType.Equals(NodeType.StructureNode.ToString())) { try { if (MessageBox.Show("确定删除[" + Parameters.DomainActionInfoClass.PathName + "]吗?", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Warning).Equals(MessageBoxResult.OK)) { Parameters.DomainActionInfoClass.PathName = FullNodeName; Parameters.DomainActionInfoClass.SelfID = SelfID; Parameters.DomainActionInfoClass.SelfName = NodeName; Parameters.DomainActionInfoClass.ParentID = ParentID; btnDelete.Tag = "Delete"; NetWorkClient.ControllerServer.Send(JsonInterFace.DeleteDomainNameRequest(FullNodeName)); } } catch (Exception ex) { Parameters.PrintfLogsExtended(ex.Message, ex.StackTrace); } } else if (Parameters.DomainActionInfoClass.NodeType.Equals(NodeType.RootNode.ToString())) { MessageBox.Show("[设备]域不允许删除!", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Warning); } else { MessageBox.Show("选择的内容不是域名!", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Warning); } } else { MessageBox.Show("请选择要删除的域名!", "提示", MessageBoxButton.OK, MessageBoxImage.Warning); } } catch (Exception ex) { Parameters.PrintfLogsExtended(ex.Message, ex.StackTrace); } }
private void Window_Loaded(object sender, RoutedEventArgs e) { if (Parameters.LanguageType.Equals("CN") || Parameters.LanguageType.Equals("")) { AdvanceSetLanguageClass = new Language_CN.AdvanceSet(); this.DataContext = (Language_CN.AdvanceSet)AdvanceSetLanguageClass; } else if (Parameters.LanguageType.Equals("EN")) { AdvanceSetLanguageClass = new Language_EN.AdvanceSet(); this.DataContext = (Language_EN.AdvanceSet)AdvanceSetLanguageClass; } #region 权限 if (RoleTypeClass.RoleType != null && RoleTypeClass.RoleType != "") { if (RoleTypeClass.RoleType.Equals("RoleType")) { if (!RoleTypeClass.RolePrivilege.ContainsKey("后台设置")) { tiBackgroundSet.Visibility = System.Windows.Visibility.Collapsed; btnSave.IsEnabled = false; tabControl.SelectedIndex = 1; } else { tabControl.SelectedIndex = 0; tiBackgroundSet.Visibility = System.Windows.Visibility.Visible; btnSave.IsEnabled = Convert.ToBoolean(int.Parse(RoleTypeClass.RolePrivilege["后台设置"])); } if (!RoleTypeClass.RolePrivilege.ContainsKey("配置导入导出")) { tiImportExportSet.Visibility = System.Windows.Visibility.Collapsed; btnExport.IsEnabled = false; btnImport.IsEnabled = false; tabControl.SelectedIndex = 0; } else { tiImportExportSet.Visibility = System.Windows.Visibility.Visible; btnExport.IsEnabled = Convert.ToBoolean(int.Parse(RoleTypeClass.RolePrivilege["配置导入导出"])); btnImport.IsEnabled = Convert.ToBoolean(int.Parse(RoleTypeClass.RolePrivilege["配置导入导出"])); } } } #endregion txtDBIPAddr.DataContext = Parameters.ServerBaseParameter; txtLogsType.DataContext = Parameters.ServerBaseParameter; txtDataAlignMode.DataContext = Parameters.ServerBaseParameter; txtLogsFileSize.DataContext = Parameters.ServerBaseParameter; txtFTPServerIPAddr.DataContext = Parameters.ServerBaseParameter; txtFTPServerPort.DataContext = Parameters.ServerBaseParameter; txtFTPServerUser.DataContext = Parameters.ServerBaseParameter; txtFTPServerPass.DataContext = Parameters.ServerBaseParameter; txtFTPServerPath.DataContext = Parameters.ServerBaseParameter; txtCDMAPort.DataContext = Parameters.ServerBaseParameter; txtGSMV2Port.DataContext = Parameters.ServerBaseParameter; txtGSMPort.DataContext = Parameters.ServerBaseParameter; txtLTEPort.DataContext = Parameters.ServerBaseParameter; txtWCDMAPort.DataContext = Parameters.ServerBaseParameter; txtClientPort.DataContext = Parameters.ServerBaseParameter; txtAPPort.DataContext = Parameters.ServerBaseParameter; txtAndroidPort.DataContext = Parameters.ServerBaseParameter; txtTDSPort.DataContext = Parameters.ServerBaseParameter; //句柄 Parameters.AdvanceSettingWinHandle = new WindowInteropHelper(this).Handle; //载入基本参数 if (NetWorkClient.ControllerServer.Connected) { NetWorkClient.ControllerServer.Send(JsonInterFace.ServerBaseParameterRequest()); } }