示例#1
0
        /// <summary>
        /// 带事务的Update
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="trans">The trans.</param>
        /// <returns></returns>
        /// <remarks>2016/8/17 14:59:49</remarks>
        public bool Update(EuropeSeasonEntity entity, DbTransaction trans = null)
        {
            var       database       = new SqlDatabase(this.ConnectionString);
            DbCommand commandWrapper = database.GetStoredProcCommand("dbo.P_EuropeSeason_Update");

            database.AddInParameter(commandWrapper, "@Idx", DbType.Int32, entity.Idx);
            database.AddInParameter(commandWrapper, "@StartDate", DbType.Date, entity.StartDate);
            database.AddInParameter(commandWrapper, "@EndDate", DbType.Date, entity.EndDate);
            database.AddInParameter(commandWrapper, "@Status", DbType.Int32, entity.Status);
            database.AddInParameter(commandWrapper, "@RowTime", DbType.DateTime, entity.RowTime);


            int results = 0;

            if (trans != null)
            {
                results = database.ExecuteNonQuery(commandWrapper, trans);
            }
            else
            {
                results = database.ExecuteNonQuery(commandWrapper);
            }

            entity.Idx = (System.Int32)database.GetParameterValue(commandWrapper, "@Idx");

            return(Convert.ToBoolean(results));
        }
示例#2
0
        /// <summary>
        /// 将IDataReader的当前记录读取到EuropeSeasonEntity 对象
        /// </summary>
        /// <param name="reader"></param>
        /// <returns></returns>
        public EuropeSeasonEntity LoadSingleRow(IDataReader reader)
        {
            var obj = new EuropeSeasonEntity();

            obj.Idx       = (System.Int32)reader["Idx"];
            obj.StartDate = (System.DateTime)reader["StartDate"];
            obj.EndDate   = (System.DateTime)reader["EndDate"];
            obj.Status    = (System.Int32)reader["Status"];
            obj.RowTime   = (System.DateTime)reader["RowTime"];

            return(obj);
        }
示例#3
0
        private EuropeConfig(int p)
        {
            DateTime date = DateTime.Now;

            _season      = EuropeSeasonMgr.GetSeason(date);
            _gamblePoint = new Dictionary <int, GamblePointConfig>();
            _logoDic     = new Dictionary <string, int>();
            _prizeDic    = new Dictionary <int, List <ConfigEuropeprizeEntity> >();
            _winStepDic  = new Dictionary <int, int>();
            InitMatch();
            var europeGamble = CacheFactory.AppsettingCache.GetAppSetting(EnumAppsetting.EuropeGamblePoint);

            if (europeGamble.Length > 0)
            {
                var europe = europeGamble.Split('|');
                foreach (var s in europe)
                {
                    var list = s.Split(',');
                    if (list.Length > 2)
                    {
                        GamblePointConfig entity = new GamblePointConfig();
                        entity.GambleType = ConvertHelper.ConvertToInt(list[0]);
                        entity.Point      = ConvertHelper.ConvertToInt(list[1]);
                        entity.VipLevel   = ConvertHelper.ConvertToInt(list[2]);
                        _gamblePoint.Add(entity.GambleType, entity);
                    }
                }
            }
            var allPrize = ConfigEuropeprizeMgr.GetAll();

            foreach (var item in allPrize)
            {
                if (!_prizeDic.ContainsKey(item.Step))
                {
                    _prizeDic.Add(item.Step, new List <ConfigEuropeprizeEntity>());
                }
                _prizeDic[item.Step].Add(item);

                if (!_winStepDic.ContainsKey(item.WinNumber))
                {
                    _winStepDic.Add(item.WinNumber, item.Step);
                }
            }
            //_timer = new Timer();
            //_timer.Interval = 10000;
            //_timer.Elapsed += Timer_Elapsed;
            //_timer.Start();
            //_timer1 = new Timer();
            //_timer1.Interval = 600000;
            //_timer1.Elapsed += Timer_Elapsed1;
            //_timer1.Start();
        }
示例#4
0
 /// <summary>
 /// 刷新活动信息
 /// </summary>
 /// <returns></returns>
 public MessageCode RefreshActivity()
 {
     try
     {
         DateTime date = DateTime.Now;
         _season = EuropeSeasonMgr.GetSeason(date);
     }
     catch (Exception ex)
     {
         SystemlogMgr.Error("欧洲杯刷活动信息", ex);
         return(MessageCode.NbParameterError);
     }
     return(MessageCode.Success);
 }
示例#5
0
        /// <summary>
        /// GetById
        /// </summary>
        /// <param name="idx">idx</param>
        /// <returns>EuropeSeasonEntity</returns>
        /// <remarks>2016/8/17 14:59:49</remarks>
        public EuropeSeasonEntity GetById(System.Int32 idx)
        {
            var database = new SqlDatabase(this.ConnectionString);

            DbCommand commandWrapper = database.GetStoredProcCommand("P_EuropeSeason_GetById");

            database.AddInParameter(commandWrapper, "@Idx", DbType.Int32, idx);


            EuropeSeasonEntity obj = null;

            using (IDataReader reader = database.ExecuteReader(commandWrapper))
            {
                if (reader.Read())
                {
                    obj = LoadSingleRow(reader);
                }
            }
            return(obj);
        }
示例#6
0
        /// <summary>
        /// GetSeason
        /// </summary>
        /// <param name="dateTime">dateTime</param>
        /// <returns>EuropeSeasonEntity</returns>
        /// <remarks>2016/8/17 14:59:49</remarks>
        public EuropeSeasonEntity GetSeason(System.DateTime dateTime)
        {
            var database = new SqlDatabase(this.ConnectionString);

            DbCommand commandWrapper = database.GetStoredProcCommand("C_EuropeSeason_GetSeason");

            database.AddInParameter(commandWrapper, "@dateTime", DbType.Date, dateTime);


            EuropeSeasonEntity obj = null;

            using (IDataReader reader = database.ExecuteReader(commandWrapper))
            {
                if (reader.Read())
                {
                    obj = LoadSingleRow(reader);
                }
            }
            return(obj);
        }
示例#7
0
        public static bool Update(EuropeSeasonEntity europeSeasonEntity, DbTransaction trans = null, string zoneId = "")
        {
            var provider = new EuropeSeasonProvider(zoneId);

            return(provider.Update(europeSeasonEntity, trans));
        }