private void LvVoiceServer_MouseDoubleClick(object sender, MouseButtonEventArgs e) { object o = LvVoiceServer.SelectedItem; if (o == null) { return; } CVoiceServer cvs = (o as ListViewItem).Content as CVoiceServer; if (cvs != null && cvs.NumEanbleEncryption == "1" && lstPolicyBindding.Where(p => p.CusFiled1 == cvs.IPResourceID).ToList().Count == 0) { GetPoliciesByVoiceIPSource(cvs.IPResourceID); } }
/// <summary> /// 能管理的录音服务器 /// </summary> private void GetCanOperationVoiceServer() { try { if (mListResourcesInfo == null) { return; } WebRequest webRequest = new WebRequest(); webRequest.Session = CurrentApp.Session; webRequest.Code = (int)S2400RequestCode.GetResourceObjList; webRequest.ListData.Add(CurrentApp.Session.UserID.ToString()); webRequest.ListData.Add("221"); //webRequest.ListData.Add("1"); //Service24011Client client = new Service24011Client(); Service24011Client client = new Service24011Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session), WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service24011")); WebHelper.SetServiceClient(client); WebReturn webReturn = client.DoOperation(webRequest); client.Close(); if (!webReturn.Result) { ShowException(string.Format("Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message)); return; } if (webReturn.ListData == null) { ShowException(string.Format("Fail.\tListData is null")); return; } LvVoiceServer.Items.Clear(); for (int i = 0; i < webReturn.ListData.Count; i++) { ListViewItem AddEncryptionObjectItem = new ListViewItem(); ContextMenu LocalContextMenu = new ContextMenu(); string[] strInfo = webReturn.ListData[i].Split('|'); if (strInfo.Count() == 2) { ResourceInfo ri = mListResourcesInfo.Where(p => p.ResourceID.ToString() == strInfo[0]).FirstOrDefault(); if (ri != null) { CVoiceServer cvs = new CVoiceServer(); cvs.VoiceServer = ri.ResourceName; cvs.NumEanbleEncryption = strInfo[1]; cvs.IPResourceID = ri.ResourceID.ToString(); cvs.EanbleEncryption = strInfo[1] == "1" ? CurrentApp.GetLanguageInfo("240300003", "YES") : CurrentApp.GetLanguageInfo("240300004", "NO"); LLstVoiceServer.Add(cvs); if (strInfo[1] == "1" && HasPermission(S2400Const.Opt_PolicyBinddingDisable))//已经设置加密绑定 { MenuItem LocalMenuItem = new MenuItem(); SetMenuItem(ref LocalMenuItem, CurrentApp.GetLanguageInfo("FO2403002", "Deny Encryption Bind"), S2400Const.Opt_PolicyBinddingDisable.ToString(), strInfo[0] + "|" + cvs.VoiceServer); LocalContextMenu.Items.Add(LocalMenuItem); } else if (strInfo[1] == "0" && HasPermission(S2400Const.OPT_PolicyBinddingEnable)) { MenuItem LocalMenuItem = new MenuItem(); SetMenuItem(ref LocalMenuItem, CurrentApp.GetLanguageInfo("FO2403001", "Grant Encryption Bind"), S2400Const.OPT_PolicyBinddingEnable.ToString(), strInfo[0] + "|" + cvs.VoiceServer); LocalContextMenu.Items.Add(LocalMenuItem); } AddEncryptionObjectItem.Content = cvs; if (LocalContextMenu.Items.Count > 0) { ContextMenuService.SetContextMenu(AddEncryptionObjectItem, LocalContextMenu); } LvVoiceServer.Items.Add(AddEncryptionObjectItem); } } } } catch (Exception ex) { ShowException(ex.Message); } }