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 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)); } }
/// <summary> /// 获得语言包 /// </summary> /// <param name="strModuleID"></param> /// <returns></returns> public static OperationReturn InitLanguageInfos() { OperationReturn optReturn = new OperationReturn(); optReturn.Result = true; optReturn.Code = Defines.RET_SUCCESS; try { if (Session == null || Session.LangTypeInfo == null) { optReturn.Result = false; optReturn.Code = (int)S1600WcfError.SessionNotAvailable; return(optReturn); } ListLanguageInfos.Clear(); VoiceCyber.UMP.Communications.WebRequest webRequest = new VoiceCyber.UMP.Communications.WebRequest(); webRequest.Code = (int)RequestCode.WSGetLangList; webRequest.Session = Session; webRequest.ListData.Clear(); webRequest.ListData.Add(Session.LangTypeInfo.LangID.ToString()); webRequest.ListData.Add(string.Empty); webRequest.ListData.Add(string.Format("0{0}16", ConstValue.SPLITER_CHAR)); webRequest.ListData.Add(string.Format("0{0}1600", ConstValue.SPLITER_CHAR)); 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) { optReturn.Code = webReturn.Code; optReturn.Result = false; return(optReturn); //ShowExceptionMessage(string.Format("{0}\t{1}", webReturn.Code, webReturn.Message)); } for (int i = 0; i < webReturn.ListData.Count; i++) { optReturn = XMLHelper.DeserializeObject <LanguageInfo>(webReturn.ListData[i]); if (!optReturn.Result) { //ShowExceptionMessage(string.Format("{0}\t{1}", optReturn.Code, optReturn.Message)); return(optReturn); } LanguageInfo langInfo = optReturn.Data as LanguageInfo; if (langInfo == null) { //ShowExceptionMessage(string.Format("LanguageInfo is null")); return(optReturn); } ListLanguageInfos.Add(langInfo); } return(optReturn); } catch (Exception ex) { optReturn.Result = false; optReturn.Code = Defines.RET_FAIL; optReturn.Message = ex.Message; return(optReturn); } }