Example #1
0
        // *****************************************************************
        // ****                     Constructors                        ****
        // *****************************************************************
        //
        //
        //
        public HedgeOptionsDatabaseWriterTest()
        {
            m_Log = new LogHub("BRELibLog", string.Format("{0}{1}", UV.Lib.Application.AppInfo.GetInstance().BasePath,
                                                          UV.Lib.Application.AppInfo.GetInstance().LogDirectory), true, LogLevel.ShowAllMessages);
            InitializeComponent();
            m_UIDispatcher = Dispatcher.CurrentDispatcher;

            DatabaseInfo dbInfo = DatabaseInfo.Create(DatabaseInfo.DatabaseLocation.bredev);

            dbInfo.UserName        = "******";
            dbInfo.UserPW          = "test";
            m_DatabaseReaderWriter = new DatabaseReaderWriter(dbInfo);
            m_DatabaseReaderWriter.QueryResponse += new EventHandler(DatabaseReaderWriter_QueryResponse);

            this.textBoxExchangeName.Text = "CME";
            this.textBoxProductName.Text  = "GE";
            this.textBoxProductType.Text  = "Spread";

            m_TTAPIService = TTApiService.GetInstance();
            m_TTAPIService.ServiceStateChanged += new EventHandler(TTApiService_ServiceStateChanged);
            m_TTAPIService.Start(true);

            m_Market = new MarketTTAPI();
            m_Market.MarketStatusChanged += new EventHandler(MarketTTAPI_MarketStatusChanged);
            m_Market.FoundResource       += new EventHandler(MarketTTAPI_MarketFoundServiceResource);
            m_Market.Start();
            m_Market.Connect();                             // initialize connection to API.
        }
Example #2
0
 public ViewResultBase Details()
 {
     if (!string.IsNullOrEmpty(Request["isTooltip"]))
     {
         if (!string.IsNullOrEmpty(Request["id"]))
         {
             Guid id;
             if (Guid.TryParse(Request["id"], out id))
             {
                 var data = GetRequiredService <IRdbMetaDataService>().GetDatabase(id);
                 return(new PartialViewResult
                 {
                     ViewName = "Partials/Details",
                     ViewData = new ViewDataDictionary(DatabaseInfo.Create(data))
                 });
             }
         }
         throw new ValidationException("非法的Guid标识" + Request["id"]);
     }
     else if (!string.IsNullOrEmpty(Request["isInner"]))
     {
         return(new PartialViewResult {
             ViewName = "Partials/Details"
         });
     }
     else
     {
         return(new ViewResult {
             ViewName = "Details"
         });
     }
 }
Example #3
0
        public ActionResult GetInfo(Guid?id)
        {
            DatabaseInfo data = null;

            if (id.HasValue)
            {
                data = DatabaseInfo.Create(GetRequiredService <IRdbMetaDataService>().GetDatabase(id.Value));
            }

            return(this.JsonResult(data));
        }
Example #4
0
        public static async Task <DatabaseInfo> GetDatabaseInfoForTest(TestContext testContext)
        {
            Type                  testClass     = Type.GetType(testContext.FullyQualifiedTestClassName, true);
            MethodInfo            testMethod    = testClass.GetRuntimeMethod(testContext.TestName, new Type[0]);
            DatabaseInfoAttribute infoAttribute = testMethod.GetCustomAttribute <DatabaseInfoAttribute>();

            // Use the attribute if it exists
            if (infoAttribute != null)
            {
                string databaseName = infoAttribute.DatabaseName;
                string password     = infoAttribute.Password;
                string keyfileName  = infoAttribute.KeyFileName;

                string databaseKey = databaseName;
                int    dotIndex    = databaseName.LastIndexOf('.');
                if (dotIndex >= 0)
                {
                    databaseKey = databaseKey.Substring(0, dotIndex);
                }

                if (infoAttribute.UseDefaultCredentials)
                {
                    if (!Utils.DatabaseMap.ContainsKey(databaseKey))
                    {
                        throw new InvalidOperationException("Cannot use default credentials of undefined database: " + databaseName);
                    }

                    return(await Utils.DatabaseMap[databaseKey]);
                }

                return(await DatabaseInfo.Create(databaseName, password, keyfileName, infoAttribute.IsSample));
            }

            // Otherwise try to glean something from the method name (legacy approach)
            string key = testContext.TestName;

            if (key.StartsWith("RoundTrip_"))
            {
                key = key.Substring("RoundTrip_".Length);
            }

            if (!DatabaseMap.ContainsKey(key))
            {
                throw new InvalidOperationException("Unable to divine what database info to use...");
            }

            return(await DatabaseMap[key]);
        }
Example #5
0
        // *****************************************************************
        // ****                     Constructors                        ****
        // *****************************************************************
        public Test1()
        {
            InitializeComponent();

            // Create the database connection.
            DatabaseInfo dbInfo = DatabaseInfo.Create(DatabaseInfo.DatabaseLocation.apastor);

            m_DBReaderWriter = new DatabaseReaderWriter(dbInfo);
            m_DBReaderWriter.QueryResponse += new EventHandler(DatabaseReaderWriter_QueryResponse);


            // Request info
            //Queries.Instruments instrQ = new Queries.Instruments();
            //instrQ.InstrumentName = new InstrumentName(new Product("CME", "ZT", ProductTypes.Future), "H4");
            //m_DBReaderWriter.SubmitAsync(instrQ);
        }
Example #6
0
        // *****************************************************************
        // ****                     Constructors                        ****
        // *****************************************************************
        //
        //
        //
        public InstrumentMatrixTest()
        {
            //BRELibLog.Log.NewEntry(LogLevel.Minor, "");
            m_Log = new LogHub("BRELibLog", string.Format("{0}{1}", UV.Lib.Application.AppInfo.GetInstance().BasePath,
                                                          UV.Lib.Application.AppInfo.GetInstance().LogDirectory), true, LogLevel.ShowAllMessages);
            InitializeComponent();

            DatabaseInfo dbInfo = DatabaseInfo.Create(DatabaseInfo.DatabaseLocation.bredev);

            dbInfo.UserName        = "******";
            dbInfo.UserPW          = "test";
            m_DatabaseReaderWriter = new DatabaseReaderWriter(dbInfo);
            m_DatabaseReaderWriter.QueryResponse += new EventHandler(DatabaseReaderWriter_QueryResponse);

            this.textBoxInstrument1.Text = "CME.GE (Spread) Calendar: 1xGE Sep14:-1xJun15";
            this.textBoxInstrument2.Text = "CME.GE (Spread) Calendar: 1xGE Dec14:-1xMar15";
        }