public bool DeleteRelation(ResourceInfo RI) { bool IsDelete = true; //long rentID=ListTenant.FirstOrDefault(p=>p.RentName==RI.TenantName).RentID; try { WebRequest webRequest = new VoiceCyber.UMP.Communications.WebRequest(); webRequest.Session = CurrentApp.Session; webRequest.Code = (int)WebCodes.Relation; webRequest.ListData.Add(RI.TenantID.ToString()); webRequest.ListData.Add(RI.ResourceID.ToString()); Service11111Client client = new Service11111Client( WebHelper.CreateBasicHttpBinding(CurrentApp.Session), WebHelper.CreateEndpointAddress( CurrentApp.Session.AppServerInfo, "Service11111")); //Service1111Client client = new Service1111Client(); WebHelper.SetServiceClient(client); WebReturn webReturn = client.DoOperation(webRequest); client.Close(); if (!webReturn.Result) { CurrentApp.ShowExceptionMessage(string.Format("Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message)); IsDelete = false; } if (IsDelete) { //更新listRelation for (int i = 0; i < ListRelation.Count; i++) { if (ListRelation[i].ResourceID == RI.ResourceID && ListRelation[i].UserID == RI.TenantID) { //删掉该条记录 ListRelation.RemoveAt(i); } } //更新listResources,更新界面显示 for (int i = 0; i < Listresources.Count; i++) { if (Listresources[i].ResourceID == RI.ResourceID && Listresources[i].TenantName != null && Listresources[i].IsUsed == true) { Listresources[i].IsUsed = false; Listresources[i].Description = Listresources[i].ToString(); } } LoadListBox(); DeleteTreeNode(RI); } DeleteResource = new ResourceInfo(); } catch (Exception ex) { CurrentApp.ShowExceptionMessage(ex.Message); IsDelete = false; } return(IsDelete); }
public bool SaveRelation(ResourceInfo RI, string ST, string ET) { bool IsSaved = true; //long rentID=ListTenant.FirstOrDefault(p=>p.RentName==RI.TenantName).RentID; try { WebRequest webRequest = new WebRequest(); webRequest.Session = CurrentApp.Session; webRequest.Code = (int)WebCodes.Relation; webRequest.ListData.Add(RI.TenantID.ToString()); webRequest.ListData.Add(RI.ResourceID.ToString()); webRequest.ListData.Add(ST); webRequest.ListData.Add(ET); Service11111Client client = new Service11111Client( WebHelper.CreateBasicHttpBinding(CurrentApp.Session), WebHelper.CreateEndpointAddress( CurrentApp.Session.AppServerInfo, "Service11111")); //Service1111Client client = new Service1111Client(); WebHelper.SetServiceClient(client); WebReturn webReturn = client.DoOperation(webRequest); client.Close(); if (!webReturn.Result) { CurrentApp.ShowExceptionMessage(string.Format("Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message)); IsSaved = false; } if (IsSaved) { //更新listRelation Relation relation = new Relation(); relation.ResourceID = RI.ResourceID; relation.UserID = RI.TenantID; relation.StartTime = Convert.ToDateTime(ST); relation.EndTime = Convert.ToDateTime(ET); ListRelation.Add(relation); //更新listResources,更新界面显示 for (int i = 0; i < Listresources.Count; i++) { if (Listresources[i].ResourceID == RI.ResourceID && Listresources[i].TenantName != null && Listresources[i].IsUsed == false) { Listresources[i].IsUsed = true; Listresources[i].Description = Listresources[i].ToString(); } } LoadListBox(); AddTreeNode(RI); } resource = new ResourceInfo(); } catch (Exception ex) { CurrentApp.ShowExceptionMessage(ex.Message); IsSaved = false; } return(IsSaved); }
//private void InitListAgent() //{ // ListAgent.Clear(); // WebRequest webRequest = new WebRequest(); // webRequest.Session = S1101App.Session; // webRequest.Code = (int)S1101Codes.GetAgentOrExt; // webRequest.ListData.Add(UserItem.ObjID.ToString()); // webRequest.ListData.Add("103"); // Service11011Client client = new Service11011Client( // WebHelper.CreateBasicHttpBinding(S1101App.Session), // WebHelper.CreateEndpointAddress( // S1101App.Session.AppServerInfo, // "Service11011")); // //Service1111Client client = new Service1111Client(); // WebHelper.SetServiceClient(client); // WebReturn webReturn = client.DoOperation(webRequest); // client.Close(); // if (!webReturn.Result) // { // S1101App.ShowExceptionMessage(string.Format("Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message)); // return; // } // if (webReturn.ListData == null) // { // S1101App.ShowExceptionMessage(string.Format("WSFail.\t{0}\t{1}", webReturn.Code, webReturn.Message)); // return; // } // ListAgent = webReturn.ListData; //} //private void InitListExt() //{ // ListExt.Clear(); // WebRequest webRequest = new WebRequest(); // webRequest.Session = S1101App.Session; // webRequest.Code = (int)S1101Codes.GetAgentOrExt; // webRequest.ListData.Add(UserItem.ObjID.ToString()); // webRequest.ListData.Add("104"); // Service11011Client client = new Service11011Client( // WebHelper.CreateBasicHttpBinding(S1101App.Session), // WebHelper.CreateEndpointAddress( // S1101App.Session.AppServerInfo, // "Service11011")); // //Service1111Client client = new Service1111Client(); // WebHelper.SetServiceClient(client); // WebReturn webReturn = client.DoOperation(webRequest); // client.Close(); // if (!webReturn.Result) // { // S1101App.ShowExceptionMessage(string.Format("Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message)); // return; // } // if (webReturn.ListData == null) // { // S1101App.ShowExceptionMessage(string.Format("WSFail.\t{0}\t{1}", webReturn.Code, webReturn.Message)); // return; // } // ListExt = webReturn.ListData; //} //加载录音服务器数据 private void InitListResourceInfo() { mListResourcesInfo.Clear(); WebRequest webRequest = new WebRequest(); webRequest.Session = CurrentApp.Session; webRequest.Code = (int)WebCodes.GetVoiceIP_Name201; Service11111Client client = new Service11111Client( WebHelper.CreateBasicHttpBinding(CurrentApp.Session), WebHelper.CreateEndpointAddress( CurrentApp.Session.AppServerInfo, "Service11111")); //Service1111Client client = new Service1111Client(); 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("WSFail.\t{0}\t{1}", webReturn.Code, webReturn.Message)); return; } OperationReturn optReturn; for (int i = 0; i < webReturn.ListData.Count; i++) { optReturn = XMLHelper.DeserializeObject <ResourceInfo>(webReturn.ListData[i]); if (!optReturn.Result) { ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message)); return; } ResourceInfo info = optReturn.Data as ResourceInfo; if (info == null) { ShowException(string.Format("ResourcePropertyInfo is null")); return; } //info.Description = info.ToString(); mListResourcesInfo.Add(info); } CurrentApp.WriteLog("PageLoad", string.Format("Init ResourceInfo")); }
//初始化ListTenant public void LoadRentInfo() { ListTenant.Clear(); WebRequest webRequestR = new WebRequest(); webRequestR.Session = CurrentApp.Session; webRequestR.Code = (int)WebCodes.GetRentInfo; Service11111Client clientR = new Service11111Client( WebHelper.CreateBasicHttpBinding(CurrentApp.Session), WebHelper.CreateEndpointAddress( CurrentApp.Session.AppServerInfo, "Service11111")); //Service1111Client clientR = new Service1111Client(); WebHelper.SetServiceClient(clientR); WebReturn webReturnR = clientR.DoOperation(webRequestR); clientR.Close(); if (!webReturnR.Result) { CurrentApp.ShowExceptionMessage(string.Format("Fail.\t{0}\t{1}", webReturnR.Code, webReturnR.Message)); return; } if (webReturnR.ListData == null) { CurrentApp.ShowExceptionMessage(string.Format("WSFail.\t{0}\t{1}", webReturnR.Code, webReturnR.Message)); return; } OperationReturn optReturnR; for (int i = 0; i < webReturnR.ListData.Count; i++) { optReturnR = XMLHelper.DeserializeObject <TenantInfo>(webReturnR.ListData[i]); if (!optReturnR.Result) { CurrentApp.ShowExceptionMessage(string.Format("Fail.\t{0}\t{1}", optReturnR.Code, optReturnR.Message)); return; } TenantInfo info = optReturnR.Data as TenantInfo; if (info == null) { CurrentApp.ShowExceptionMessage(string.Format("ResourcePropertyInfo is null")); return; } info.RentName = S1111App.DecryptString(info.RentName); ListTenant.Add(info); } }
public static void LoadResourceManagementData() { Service11111Client LService11111Client = null; BasicHttpBinding LBasicHttpBinding = null; EndpointAddress LEndpointAddress = null; List <string> LListStrWcfArgs = new List <string>(); try { IDataTable00009 = new DataTable(); IDataTable00010 = new DataTable(); IListDataSetReturn = new List <DataSet>(); LBasicHttpBinding = WebHelper.CreateBasicHttpBingding(); LEndpointAddress = WebHelper.CreateEndpointAddress(App.GClassSessionInfo.AppServerInfo, "Service11111"); OperationDataArgs11111 LWCFOperationReturn = new OperationDataArgs11111(); LService11111Client = new Service11111Client(LBasicHttpBinding, LEndpointAddress); LListStrWcfArgs.Add(GClassSessionInfo.DatabaseInfo.TypeID.ToString()); LListStrWcfArgs.Add(GClassSessionInfo.DatabaseInfo.GetConnectionString()); LListStrWcfArgs.Add(GClassSessionInfo.RentInfo.Token); LWCFOperationReturn = LService11111Client.OperationMethodA(1, LListStrWcfArgs); if (LWCFOperationReturn.BoolReturn) { IDataTable00010 = LWCFOperationReturn.DataSetReturn.Tables[0]; } LoadResourcePropertiesDifine(); LoadResourceType("211"); //0 License Server LoadResourceType("212"); //1 Dec Server LoadResourceType("213"); //2 CTI Hub Server } catch { } finally { if (LService11111Client != null) { if (LService11111Client.State == CommunicationState.Opened) { LService11111Client.Close(); } } } }
private static void LoadResourceType(string AStrTypeID) { Service11111Client LService11111Client = null; BasicHttpBinding LBasicHttpBinding = null; EndpointAddress LEndpointAddress = null; List <string> LListStrWcfArgs = new List <string>(); try { LBasicHttpBinding = WebHelper.CreateBasicHttpBingding(); LEndpointAddress = WebHelper.CreateEndpointAddress(App.GClassSessionInfo.AppServerInfo, "Service11111"); OperationDataArgs11111 LWCFOperationReturn = new OperationDataArgs11111(); LService11111Client = new Service11111Client(LBasicHttpBinding, LEndpointAddress); LListStrWcfArgs.Add(GClassSessionInfo.DatabaseInfo.TypeID.ToString()); LListStrWcfArgs.Add(GClassSessionInfo.DatabaseInfo.GetConnectionString()); LListStrWcfArgs.Add(GClassSessionInfo.RentInfo.Token); LListStrWcfArgs.Add(AStrTypeID); LWCFOperationReturn = LService11111Client.OperationMethodA(2, LListStrWcfArgs); if (LWCFOperationReturn.BoolReturn) { IListDataSetReturn.Add(LWCFOperationReturn.DataSetReturn); } else { IListDataSetReturn.Add(null); } } catch { } finally { if (LService11111Client != null) { if (LService11111Client.State == CommunicationState.Opened) { LService11111Client.Close(); } } } }
//初始化Listresources public void LoadVCLogServerInfo() { Listresources.Clear(); WebRequest webRequest = new WebRequest(); webRequest.Session = CurrentApp.Session; webRequest.Code = (int)WebCodes.GetVoiceIP_Name201; Service11111Client client = new Service11111Client( WebHelper.CreateBasicHttpBinding(CurrentApp.Session), WebHelper.CreateEndpointAddress( CurrentApp.Session.AppServerInfo, "Service11111")); //Service1111Client client = new Service1111Client(); WebHelper.SetServiceClient(client); WebReturn webReturn = client.DoOperation(webRequest); client.Close(); if (!webReturn.Result) { CurrentApp.ShowExceptionMessage(string.Format("Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message)); return; } if (webReturn.ListData == null) { CurrentApp.ShowExceptionMessage(string.Format("WSFail.\t{0}\t{1}", webReturn.Code, webReturn.Message)); return; } OperationReturn optReturn; for (int i = 0; i < webReturn.ListData.Count; i++) { optReturn = XMLHelper.DeserializeObject <ResourceInfo>(webReturn.ListData[i]); if (!optReturn.Result) { CurrentApp.ShowExceptionMessage(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message)); return; } ResourceInfo info = optReturn.Data as ResourceInfo; if (info == null) { CurrentApp.ShowExceptionMessage(string.Format("ResourcePropertyInfo is null")); return; } long InfoID = info.ResourceID; for (int j = 0; j < ListRelation.Count; j++) { if (ListRelation[j].ResourceID == InfoID) { info.IsUsed = true; info.TenantID = ListRelation[j].UserID; for (int k = 0; k < ListTenant.Count; k++) { if (ListTenant[k].RentID == ListRelation[j].UserID) { info.TenantName = ListTenant[k].RentName; } } } } info.Description = info.ToString(); Listresources.Add(info); } CurrentApp.WriteLog("PageLoad", string.Format("Init ResourceInfo")); }