/// <summary> /// 根据ObjectID和Page获得对应的语言 /// </summary> /// <param name="strUmpServerPort"></param> /// <param name="strUmpServerHost"></param> /// <param name="strDBHost"></param> /// <param name="strDBPort"></param> /// <param name="strMessageID"></param> /// <returns></returns> public static string GetLanguageItemInDBByObjectIDAndPage(ServerInfomation UmpServer, DBInfo dbInfo, string strObjectID, string strLanCode, string strPage) { string strConnString = string.Empty; switch (dbInfo.DbType) { case (int)Enums.DBType.MSSQL: strConnString = App.CreateMSSqlConnString(dbInfo); break; case (int)Enums.DBType.Oracle: strConnString = App.CreateOracleConnString(dbInfo); break; } string strMessageContent = string.Empty; OperationDataArgs result = new OperationDataArgs(); BasicHttpBinding binding = Common.CreateBasicHttpBinding(60); EndpointAddress adress = Common.CreateEndPoint("HTTP", UmpServer.Host, UmpServer.Port, "WcfServices", "Service00000"); Service00000Client client = new Service00000Client(binding, adress); try { List <string> lstParams = new List <string>(); lstParams.Add(dbInfo.DbType.ToString()); lstParams.Add(strConnString); lstParams.Add(strLanCode); lstParams.Add("M21"); lstParams.Add("0"); lstParams.Add(strPage); result = client.OperationMethodA(8, lstParams); } catch (Exception ex) { result.BoolReturn = false; result.StringReturn = ex.Message; } finally { if (client.State == CommunicationState.Opened) { client.Close(); } } if (result.BoolReturn) { if (result.DataSetReturn.Tables.Count > 0) { List <DataRow> lstRows = result.DataSetReturn.Tables[0].Select("C012 = '" + strObjectID + "'").ToList(); if (lstRows.Count > 0) { strMessageContent = lstRows[0]["C005"].ToString(); } } } return(strMessageContent); }
/// <summary> /// 获得所有已经连接过的服务器配置信息 /// </summary> /// <returns></returns> public static List <ServerInfomation> GetAllServerInfo() { List <ServerInfomation> lstResult = new List <ServerInfomation>(); bool isExists = CheckFileExists(); if (isExists) { XMLOperator xmlOperator = new XMLOperator(App.GStrLoginUserApplicationDataPath + "\\UMP.PF.MAMT\\ServerConfig.xml"); DataSet ds = xmlOperator.GetDs("Root"); if (ds.Tables.Count > 0) { ServerInfomation server; DataRow row = null; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { row = ds.Tables[0].Rows[i]; server = new ServerInfomation(); server.Host = row["Host"].ToString(); server.Port = row["Port"].ToString(); server.UserName = row["Username"].ToString(); lstResult.Add(server); } } else { ServerInfomation server = new ServerInfomation(); server.Host = "127.0.0.1"; server.Port = "8081"; server.UserName = "******"; lstResult.Add(server); } } else { ServerInfomation server = new ServerInfomation(); server.Host = "127.0.0.1"; server.Port = "8081"; server.UserName = "******"; lstResult.Add(server); } return(lstResult); }