示例#1
0
文件: MarketUpdate.cs 项目: BFMS/BFMS
 public void AddMarket(MarketCatalogue market)
 {
     if (!markets.ContainsKey(market.MarketId))
     {
         lock (markets)
         {
             markets.TryAdd(market.MarketId, market);
             if (Config.IsDBLogging)
             {
                 dba.InsertMarketCat(new List<MarketCatalogue>() { market });
             }
         }
         if (markets.Count == 1)
         {
             run.Set();
         }
     }
 }
示例#2
0
文件: Market.cs 项目: BFMS/BFMS
 public Market(MarketCatalogue mc)
 {
     MarketId = mc.MarketId;
     EventName = mc.Event.Venue;
     Name = mc.MarketName;
     Type = mc.Description.MarketType;
     LocalStartDate = mc.LocalStartTime.Date;
     LocalStartTime = mc.LocalStartTime;
     Runners = new List<MarketItem>();
     mc.CheckRunnerStatus();
     foreach (RunnerDescription runner in mc.Runners)
     {
         if (runner.Status == RunnerStatus.ACTIVE)
         {
             MarketItem mi = new MarketItem(runner);
             Runners.Add(mi);
         }
     }
 }
示例#3
0
文件: DBAPI.cs 项目: BFMS/BFMS
        public List<MarketCatalogue> GetMarkets()
        {
            List<MarketCatalogue> lmc = new List<MarketCatalogue>();
            try
            {
                using (var ctx = new bfmsEntities())
                {

                    //ctx.Database.Connection.Open();
                    //var ctx = new bfmsEntities();

                    var MarketCatList = (from cat in ctx.marketcatalogues
                                         join desc in ctx.marketdescriptions on cat.MarketId equals desc.MarketId
                                         orderby cat.LocalStartTime
                                         select new { cat, desc }).ToList();

                    string lastMarketId = "";
                    MarketCatalogue mc = null;
                    foreach (var row in MarketCatList)
                    {
                        if (lastMarketId != row.cat.MarketId)
                        {
                            mc = new MarketCatalogue();
                            mc.MarketId = row.cat.MarketId;
                            mc.MarketName = row.cat.MarketName;
                            mc.Description = new MarketDescription();
                            mc.Description.MarketTime = row.cat.LocalStartTime ?? DateTime.Now;
                            mc.Description.Clarifications = row.desc.Clarifications;
                            mc.Event = new Event();
                            mc.Event.Name = row.cat.MarketDescr;
                            //mc.EventType = (string)rdr["EventType"];
                            mc.IsMarketDataDelayed = "False".Equals(row.cat.IsMarketDataDelayed) ? false : true;

                            mc.Runners = new List<RunnerDescription>();
                            lmc.Add(mc);
                            lastMarketId = mc.MarketId;
                        }

                        //RunnerDescription rd = new RunnerDescription();
                        //rd.SelectionId = (int)row["SelectionId"];
                        //rd.RunnerName = (string)row["Name"];
                        //mc.Runners.Add(rd);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;

            }

            return lmc;
        }