Ejemplo n.º 1
0
        public int Connect()
        {
            _config = new CT2Configinterface();
            _config.Load("t2sdk.ini");
            Conn      = new CT2Connection(_config);
            _callback = new Callbacktest();
            Conn.Create(_callback);
            var iret = Conn.Connect(5000);

            return(iret);
        }
Ejemplo n.º 2
0
        private bool InitT2()
        {
            if (conn == null)
            {
                config = new CT2Configinterface();
                config.Load("t2sdk.ini");
                conn     = new CT2Connection(config);
                callback = new callbacktest(this);
                conn.Create(callback);
                int iret = conn.Connect(4000);
                textBox1.Text = "连接" + conn.GetErrorMsg(iret) + "\r\n" + textBox1.Text;
                if (iret != 0)
                {
                    return(false);
                }
            }

            return(true);
        }
Ejemplo n.º 3
0
        public EntrustHunsun()
        {
            try
            {
                CT2Configinterface config = new CT2Configinterface();
                config.Load("t2sdk.ini");

                //连接主
                connMain = new CT2Connection(config);
                connMain.Create2BizMsg(this);
                int ret = connMain.Connect(5000);
                if (ret != 0)
                {
                    Debug.Print(string.Format("Main:连接{0}失败 错误号 {1} 错误信息 {2}", config.GetString("t2sdk", "servers", ""), ret, connMain.GetErrorMsg(ret)));
                }
                else
                {
                    Debug.Print((string.Format("Main:连接{0}成功", config.GetString("t2sdk", "servers", ""))));
                }

                //连接子
                connSub = new CT2Connection(config);
                connSub.Create(null);
                ret = connSub.Connect(5000);
                if (ret != 0)
                {
                    Debug.Print(string.Format("Sub:连接{0}失败 错误号 {1} 错误信息 {2}", config.GetString("t2sdk", "servers", ""), ret, connSub.GetErrorMsg(ret)));
                }
                else
                {
                    Debug.Print((string.Format("Sub:连接{0}成功", config.GetString("t2sdk", "servers", ""))));
                }
            }
            catch (Exception e)
            {
                Debug.Print(e.Message);
            }
        }
Ejemplo n.º 4
0
        public EntrustHundsun()
        {
            this.name   = "恒生UFX委托接口";
            this.Vendor = EntrustVendor.Hundsun;
            MessageManager.GetInstance().Add(MessageType.Warning, "对于x64的机器需要更换引用的ext_t2sdkEx.dll");

            try
            {
                CT2Configinterface config = new CT2Configinterface();
                config.Load(Config.GetInstance().GetParameter(Config.C_PATH_HUNDSUN_CONFIG).ToString());

                #region 打开连接
                //主连接
                connMain = new CT2Connection(config);
                connMain.Create2BizMsg(new UFXMainCallback());
                int ret = connMain.Connect(5000);
                if (ret != 0)
                {
                    MessageManager.GetInstance().Add(MessageType.Error, string.Format("连接{0}失败:main-{1}", config.GetString("t2sdk", "servers", ""), connMain.GetErrorMsg(ret)));
                    return;
                }

                //子连接
                connSub = new CT2Connection(config);
                connSub.Create(null);
                ret = connSub.Connect(5000);
                if (ret != 0)
                {
                    MessageManager.GetInstance().Add(MessageType.Error, string.Format("连接{0}失败:sub-{1}", config.GetString("t2sdk", "servers", ""), connSub.GetErrorMsg(ret)));
                }
                #endregion
            }
            catch (Exception ex)
            {
                MessageManager.GetInstance().Add(MessageType.Error, ex.Message + "请检查license.dat文件是否存在。");
                throw ex;
            }
        }