コード例 #1
0
        /// <summary>
        /// 获取连接管理中心开户WCF连接实例
        /// </summary>
        /// <returns></returns>
        public static CommonParaClient GetCommonParaClient()
        {
            CommonParaClient client = null;

            try
            {
                client = new CommonParaClient();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(client);
        }
 /// <summary>
 /// 获得所有商品的品种类别
 /// </summary>
 /// <returns></returns>
 protected List <CM_BreedClassType> GetAllBreedClassType()
 {
     try
     {
         using (CommonParaClient client = ManagementCenterDataAgent.Instanse.GetComonParaInstanse())
         {
             return(client.GetAllBreedClassType());
         }
     }
     catch (Exception ex)
     {
         LogHelper.WriteError(GenerateInfo.CH_E006, ex);
         return(null);
     }
 }
 /// <summary>
 /// 根据IP和端口获取撮合中心实体
 /// </summary>
 /// <param name="ip">ip地址</param>
 /// <param name="port">端口</param>
 /// <returns></returns>
 protected RC_MatchCenter GetMatchCenterByAddress(string ip, int port)
 {
     try
     {
         using (CommonParaClient client = ManagementCenterDataAgent.Instanse.GetComonParaInstanse())
         {
             return(client.GetMatchCenterByIpAndPort(ip, port));
         }
     }
     catch (Exception ex)
     {
         LogHelper.WriteError(GenerateInfo.CH_E006, ex);
         return(null);
     }
 }
 /// <summary>
 /// 获取所有撮合机配置代码
 /// </summary>
 /// <returns></returns>
 protected List <RC_TradeCommodityAssign> GetAllTradeCommodityAssign()
 {
     try
     {
         using (CommonParaClient client = ManagementCenterDataAgent.Instanse.GetComonParaInstanse())
         {
             return(client.GetAllTradeCommodityAssign());
         }
     }
     catch (Exception ex)
     {
         LogHelper.WriteError(GenerateInfo.CH_E006, ex);
         return(null);
     }
 }
 /// <summary>
 /// 根据撮合中心ID获取所有撮合机
 /// </summary>
 /// <param name="centerID">撮合中心id</param>
 /// <returns></returns>
 protected List <RC_MatchMachine> GetAllMatchMachineByMatchCenterID(int centerID)
 {
     try
     {
         using (CommonParaClient client = ManagementCenterDataAgent.Instanse.GetComonParaInstanse())
         {
             return(client.GetAllMatchMachineByMatchCenter(centerID));
         }
     }
     catch (Exception ex)
     {
         LogHelper.WriteError(GenerateInfo.CH_E006, ex);
         return(null);
     }
 }
コード例 #6
0
        ///// <summary>
        ///// 获取管理中心公共数据连接客户端对象
        ///// </summary>
        //private static CommonParaClient commonClient;
        ///// <summary>
        ///// 获取管理中心【期货】交易规则连接客户端对象
        ///// </summary>
        //private static FuturesTradeRulesClient futureClient;
        ///// <summary>
        ///// 获取管理中心【现货】交易规则连接客户端对象
        ///// </summary>
        //private static SpotTradeRulesClient tradeRuleClient;

        /// <summary>
        /// 获取与管理中心公共数据连接客户端对象
        /// 这里不捕捉异常,所以外部调用时要捕捉异常
        /// </summary>
        /// <returns></returns>
        public CommonParaClient GetComonParaInstanse()
        {
            CommonParaClient client = new CommonParaClient();

            return(client);

            #region oldcode
            //get
            //{
            //if (commonClient == null)
            //{
            //    string strAddress = AppConfig.GetConfigManageCenterIP();
            //    string port = AppConfig.GetConfigManagePort().ToString();
            //    EndpointAddress orderAddress = new EndpointAddress("net.tcp://" + strAddress + ":" + port + "/WcfCommonalityProvider");
            //    commonClient = new CommonParaClient("NetTcpBinding_ICommonPara", orderAddress);
            //}
            //return commonClient;
            //}
            #endregion
        }
 /// <summary>
 /// 检查是否成功
 /// </summary>
 /// <returns></returns>
 protected bool IsConnManagerCenterSuccess()
 {
     try
     {
         using (CommonParaClient client = ManagementCenterDataAgent.Instanse.GetComonParaInstanse())
         {
             List <RC_MatchCenter> list = client.GetAllMatchCenter();
             if (Utils.IsNullOrEmpty(list))
             {
                 return(false);
             }
         }
     }
     catch (Exception ex)
     {
         LogHelper.WriteError(GenerateInfo.CH_E006, ex);
         return(false);
     }
     return(true);
 }
コード例 #8
0
        /// <summary>
        /// 获取所有的现货代码
        /// </summary>
        public static void GetAllCM_Commodity()
        {
            list.Clear();
            spotList.Clear();
            int[] breeid = { 7, 8, 21, 22 };
            using (CommonParaClient client = GetCommonParaClient())
            {
                foreach (var k in breeid)
                {
                    List <CM_Commodity> item = new List <CM_Commodity>();
                    item = client.GetCommodityByBreedClassID(k);

                    list.AddRange(item);
                }
            }
            using (SpotTradeRulesClient client = GetSpotTradeRulesClient())
            {
                spotList = client.GetAllSpotCosts();
            }
        }
コード例 #9
0
 public static void testcurrcy()
 {
     CommonParaClient          newobj = new CommonParaClient();
     CM_CurrencyBreedClassType tt     = newobj.GetCurrencyByBreedClassID(7);
 }