public static void GetOrgID() { Service61061Client client = null; try { WebRequest webRequest = new WebRequest(); webRequest.Code = (int)S6106RequestCode.GetOrgInfo; webRequest.Session = App.Session; client = new Service61061Client(WebHelper.CreateBasicHttpBinding(App.Session), WebHelper.CreateEndpointAddress(App.Session.AppServerInfo, "Service61061")); WebHelper.SetServiceClient(client); WebReturn webReturn = client.DoOperation(webRequest); if (webReturn.Result) { OrgID = webReturn.Data.ToString(); } } catch { } finally { if (client != null) { if (client.State == System.ServiceModel.CommunicationState.Opened) { client.Close(); } } } }
private List <KeyValueEntry> GetDataByMode(string strMode) { List <KeyValueEntry> lstReturn = new List <KeyValueEntry>(); Service61061Client client = null; try { WebRequest webRequest = new WebRequest(); webRequest.Code = (int)S6106RequestCode.GetReplayCount; webRequest.Session = App.Session; client = new Service61061Client(WebHelper.CreateBasicHttpBinding(App.Session), WebHelper.CreateEndpointAddress(App.Session.AppServerInfo, "Service61061")); webRequest.ListData.Add(iRecTimeLength.ToString()); webRequest.ListData.Add(DateTime.Now.ToString()); webRequest.ListData.Add(strMode); webRequest.ListData.Add(App.OrgID); WebHelper.SetServiceClient(client); WebReturn webReturn = client.DoOperation(webRequest); App.MonitorHelper.AddWebReturn(webReturn); client.Close(); if (!webReturn.Result) { if (webReturn.Code != Defines.RET_FAIL) { App.ShowExceptionMessage(App.GetLanguageInfo(webReturn.Code.ToString(), "WSFail.\t Error code:" + webReturn.Code.ToString())); } else { App.ShowExceptionMessage(string.Format("WSFail.\t{0}\t{1}", webReturn.Code, webReturn.Message)); } return(lstReturn); } OperationReturn optReturn = null; List <KeyValueEntry> lstk = new List <KeyValueEntry>(); for (int i = 0; i < webReturn.ListData.Count; i++) { optReturn = XMLHelper.DeserializeObject <KeyValueEntry>(webReturn.ListData[i]); if (optReturn.Result) { lstk.Add(optReturn.Data as KeyValueEntry); } } return(lstk); } catch (Exception ex) { App.ShowExceptionMessage(string.Format("WSFail.\t{0", ex.Message)); } finally { if (client != null) { if (client.State == System.ServiceModel.CommunicationState.Opened) { client.Close(); } } } return(lstReturn); }
/// <summary> /// 获得录音使用的模式(分机或坐席) /// </summary> /// <returns></returns> public static OperationReturn GetRecordMode() { OperationReturn optReturn = new OperationReturn(); optReturn.Result = true; optReturn.Code = Defines.RET_SUCCESS; Service61061Client client = null; try { WebRequest webRequest = new WebRequest(); webRequest.Code = (int)S6106RequestCode.GetRecordMode; webRequest.Session = App.Session; client = new Service61061Client(WebHelper.CreateBasicHttpBinding(App.Session), WebHelper.CreateEndpointAddress(App.Session.AppServerInfo, "Service61061")); WebHelper.SetServiceClient(client); WebReturn webReturn = client.DoOperation(webRequest); App.MonitorHelper.AddWebReturn(webReturn); client.Close(); if (!webReturn.Result) { optReturn.Result = false; optReturn.Code = webReturn.Code; optReturn.Message = webReturn.Message; return(optReturn); } optReturn.Data = webReturn.Data; return(optReturn); } catch (Exception ex) { optReturn.Result = false; optReturn.Code = Defines.RET_FAIL; optReturn.Message = ex.Message; return(optReturn); } finally { if (client != null) { if (client.State == System.ServiceModel.CommunicationState.Opened) { client.Close(); } } } }
private void ShowChart() { Service61061Client client = null; try { WebRequest webRequest = new WebRequest(); webRequest.Code = (int)S6106RequestCode.GetRecordCount; webRequest.Session = App.Session; webRequest.ListData.Add(iRecTimeLength.ToString()); webRequest.ListData.Add(DateTime.Now.ToString()); client = new Service61061Client(WebHelper.CreateBasicHttpBinding(App.Session), WebHelper.CreateEndpointAddress(App.Session.AppServerInfo, "Service61061")); WebReturn webReturn = client.DoOperation(webRequest); App.MonitorHelper.AddWebReturn(webReturn); client.Close(); if (!webReturn.Result) { if (webReturn.Code == (int)S6106WcfErrorCode.NoData) { App.ShowInfoMessage(App.GetLanguageInfo(((int)S6106WcfErrorCode.NoData).ToString(), "No data")); return; } App.ShowExceptionMessage(string.Format("WSFail.\t{0}\t{1}", webReturn.Code, webReturn.Message)); return; } if (webReturn.ListData.Count <= 0) { return; } List <KeyValuePair <string, int> > CallInList = new List <KeyValuePair <string, int> >(); List <KeyValuePair <string, int> > CallOutList = new List <KeyValuePair <string, int> >(); RecordCountEntry recEntry = null; OperationReturn optReturn = null; foreach (string str in webReturn.ListData) { optReturn = XMLHelper.DeserializeObject <RecordCountEntry>(str); if (!optReturn.Result) { continue; } recEntry = optReturn.Data as RecordCountEntry; string strDate = recEntry.RecDate.Substring(5); KeyValuePair <string, int> item = new KeyValuePair <string, int>(strDate, int.Parse(recEntry.RecCount)); if (recEntry.RecDirection == "0") { CallOutList.Add(item); } else if (recEntry.RecDirection == "1") { CallInList.Add(item); } } var LVarDataSource = new List <List <KeyValuePair <string, int> > >(); LVarDataSource.Add(CallInList); LVarDataSource.Add(CallOutList); RecCountChart.DataContext = LVarDataSource; } catch (Exception ex) { App.ShowExceptionMessage(ex.Message); } finally { if (client != null) { if (client.State == System.ServiceModel.CommunicationState.Opened) { client.Close(); } } } }
private void ShowChart() { Service61061Client client = null; try { WebRequest webRequest = new WebRequest(); webRequest.Code = (int)S6106RequestCode.GetUMPUsedCount; webRequest.Session = App.Session; webRequest.ListData.Add(iRecTimeLength.ToString()); webRequest.ListData.Add(DateTime.Now.ToString()); lstContrledUser.ForEach(obj => webRequest.ListData.Add(obj)); client = new Service61061Client(WebHelper.CreateBasicHttpBinding(App.Session), WebHelper.CreateEndpointAddress(App.Session.AppServerInfo, "Service61061")); WebReturn webReturn = client.DoOperation(webRequest); App.MonitorHelper.AddWebReturn(webReturn); client.Close(); if (!webReturn.Result) { if (webReturn.Code != Defines.RET_FAIL) { App.ShowExceptionMessage(App.GetLanguageInfo(webReturn.Code.ToString(), "WSFail.\t Error code:" + webReturn.Code.ToString())); } else { App.ShowExceptionMessage(string.Format("WSFail.\t{0}\t{1}", webReturn.Code, webReturn.Message)); } return; } if (webReturn.ListData.Count <= 0) { return; } List <string> lstRecords = webReturn.ListData as List <string>; OperationReturn optReturn = null; List <KeyValueEntry> lstk = new List <KeyValueEntry>(); for (int i = 0; i < lstRecords.Count; i++) { optReturn = XMLHelper.DeserializeObject <KeyValueEntry>(lstRecords[i]); if (optReturn.Result) { lstk.Add(optReturn.Data as KeyValueEntry); } } lineUser.DataContext = lstk; } catch (Exception ex) { App.ShowExceptionMessage(ex.Message); } finally { if (client != null) { if (client.State == System.ServiceModel.CommunicationState.Opened) { client.Close(); } } } }