public static void InitLanguageInfos(string strModuleID) { try { if (Session == null || Session.LangTypeInfo == null) { return; } ListLanguageInfos.Clear(); VoiceCyber.UMP.Communications.WebRequest webRequest = new VoiceCyber.UMP.Communications.WebRequest(); webRequest.Code = (int)RequestCode.WSGetLangList; webRequest.Session = Session; webRequest.ListData.Add(Session.LangTypeInfo.LangID.ToString()); webRequest.ListData.Add(string.Empty); webRequest.ListData.Add(string.Format("0{0}61", ConstValue.SPLITER_CHAR)); webRequest.ListData.Add(string.Format("0{0}{1}", ConstValue.SPLITER_CHAR, strModuleID)); webRequest.ListData.Add(string.Empty); webRequest.ListData.Add(string.Empty); MonitorHelper.AddWebRequest(webRequest); Service11012Client client = new Service11012Client( WebHelper.CreateBasicHttpBinding(Session) , WebHelper.CreateEndpointAddress(Session.AppServerInfo, "Service11012")); WebReturn webReturn = client.DoOperation(webRequest); MonitorHelper.AddWebReturn(webReturn); client.Close(); if (!webReturn.Result) { ShowExceptionMessage(string.Format("{0}\t{1}", webReturn.Code, webReturn.Message)); } for (int i = 0; i < webReturn.ListData.Count; i++) { OperationReturn optReturn = XMLHelper.DeserializeObject <LanguageInfo>(webReturn.ListData[i]); if (!optReturn.Result) { ShowExceptionMessage(string.Format("{0}\t{1}", optReturn.Code, optReturn.Message)); return; } LanguageInfo langInfo = optReturn.Data as LanguageInfo; if (langInfo == null) { ShowExceptionMessage(string.Format("LanguageInfo is null")); return; } ListLanguageInfos.Add(langInfo); } WriteLog("AppLang", string.Format("Init LanguageInfos end,ListLanguageInfos.count =" + ListLanguageInfos.Count)); } catch (Exception ex) { WriteLog("InitLang", string.Format("InitLang fail.\t{0}", ex.Message)); } }
public static void InitLanguageInfos() { try { Thread.Sleep(5000); if (Session == null || Session.LangTypeInfo == null) { return; } ListLanguageInfos.Clear(); WebRequest webRequest = new WebRequest(); webRequest.Code = (int)RequestCode.WSGetLangList; webRequest.Session = Session; webRequest.ListData.Add(Session.LangTypeInfo.LangID.ToString()); webRequest.ListData.Add(string.Empty); webRequest.ListData.Add("31"); webRequest.ListData.Add("3102"); webRequest.ListData.Add(string.Empty); webRequest.ListData.Add(string.Empty); Service11012Client client = new Service11012Client( WebHelper.CreateBasicHttpBinding(Session) , WebHelper.CreateEndpointAddress(Session.AppServerInfo, "Service11012")); WebReturn webReturn = client.DoOperation(webRequest); client.Close(); if (!webReturn.Result) { ShowExceptionMessage(string.Format("{0}\t{1}", webReturn.Code, webReturn.Message)); } for (int i = 0; i < webReturn.ListData.Count; i++) { OperationReturn optReturn = XMLHelper.DeserializeObject <LanguageInfo>(webReturn.ListData[i]); if (!optReturn.Result) { ShowExceptionMessage(string.Format("{0}\t{1}", optReturn.Code, optReturn.Message)); return; } LanguageInfo langInfo = optReturn.Data as LanguageInfo; if (langInfo == null) { ShowExceptionMessage(string.Format("LanguageInfo is null")); return; } ListLanguageInfos.Add(langInfo); } } catch (Exception ex) { ShowExceptionMessage(ex.Message); } }