protected override void InitLanguageInfos() { base.InitLanguageInfos(); try { 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("11"); webRequest.ListData.Add("1112"); 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); } WriteLog(string.Format("AppStart\t\tLanguage loaded")); } catch (Exception ex) { ShowExceptionMessage(ex.Message); } }
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)); } }
protected override void InitLanguageInfos() { base.InitLanguageInfos(); try { if (Session == null || Session.LangTypeInfo == null) { return; } //ListLanguageInfos.Clear(); WebRequest webRequest = new WebRequest(); webRequest.Code = (int)RequestCode.WSGetLangList; webRequest.Session = Session; //ListParams //0 LangID //1 PreName(语言内容编码的前缀,比如 FO:模块、操作显示语言) //2 ModuleID //3 SubModuleID //4 Page //5 Name webRequest.ListData.Add(Session.LangTypeInfo.LangID.ToString()); webRequest.ListData.Add(string.Empty); webRequest.ListData.Add("11"); webRequest.ListData.Add("1102"); webRequest.ListData.Add(string.Empty); webRequest.ListData.Add(string.Empty); Service11012Client client = new Service11012Client(WebHelper.CreateBasicHttpBinding(Session), WebHelper.CreateEndpointAddress(Session.AppServerInfo, "Service11012")); WebHelper.SetServiceClient(client); 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); } //MessageBox.Show(name+" 1:ok"); //ListParams //0 LangID //1 PreName(语言内容编码的前缀,比如 FO:模块、操作显示语言) //2 ModuleID //3 SubModuleID //4 Page //5 Name webRequest = new WebRequest(); webRequest.Session = Session; webRequest.Code = (int)RequestCode.WSGetLangList; webRequest.ListData.Add(string.Empty); webRequest.ListData.Add("FO"); webRequest.ListData.Add(string.Empty); webRequest.ListData.Add(string.Empty); webRequest.ListData.Add(string.Empty); webRequest.ListData.Add(string.Empty); client = new Service11012Client(WebHelper.CreateBasicHttpBinding(Session), WebHelper.CreateEndpointAddress(Session.AppServerInfo, "Service11012")); WebHelper.SetServiceClient(client); 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; } if (ListLanguageInfos.Where(p => p.LangID == langInfo.LangID && p.Name == langInfo.Name).Count() == 0) { ListLanguageInfos.Add(langInfo); } } //MessageBox.Show(name+" 2:ok"); webRequest = new WebRequest(); webRequest.Session = Session; webRequest.Code = (int)RequestCode.WSGetLangList; webRequest.ListData.Add(string.Empty); webRequest.ListData.Add("COM"); webRequest.ListData.Add(string.Empty); webRequest.ListData.Add(string.Empty); webRequest.ListData.Add(string.Empty); webRequest.ListData.Add(string.Empty); client = new Service11012Client(WebHelper.CreateBasicHttpBinding(Session), WebHelper.CreateEndpointAddress(Session.AppServerInfo, "Service11012")); WebHelper.SetServiceClient(client); 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; } if (ListLanguageInfos.Where(p => p.LangID == langInfo.LangID && p.Name == langInfo.Name).Count() == 0) { ListLanguageInfos.Add(langInfo); } } //MessageBox.Show(name+" 3:ok"); } catch (Exception ex) { //ShowExceptionMessage(ex.Message); } }