Example #1
0
        /// <summary>
        /// 组装查询语句
        /// </summary>
        /// <param name="type">枚举码</param>
        /// <param name="arg"></param>
        /// <returns></returns>
        private string GetSeleteSQL(SCCLottery type, HistoryLotteryArgEnyity arg)
        {
            StringBuilder builder = new StringBuilder();
            string        res     = String.Empty;

            int    total     = type.GetEnumText().TryToInt32();
            string tableName = type.GetSCCLotteryTableName();

            for (int i = 1; i <= total; i++)
            {
                builder.Append("[OpenCode" + i + "],");
            }

            if (arg.TotalRecord > 0)
            {
                res = string.Format(GetLotterySqlByTableNameWithTop, arg.TotalRecord, StringHelper.DelLastChar(builder.ToString(), ","), tableName);
            }
            else if (!string.IsNullOrEmpty(arg.StartTime))
            {
                string time = arg.StartTime.CheckDateTime()
                    ? arg.StartTime
                    : DateTimeHelper.Now.AddDays(-7).ToString("yyyy-MM-dd");

                res = string.Format(GetLotterySqlByTableNameWithStartTime, StringHelper.DelLastChar(builder.ToString(), ","), tableName, time);
            }
            else
            {
                res = string.Format(GetLotterySqlByTableNameWithTop, "20", StringHelper.DelLastChar(builder.ToString(), ","), tableName);
            }

            return(res);
        }
Example #2
0
        /// <summary>
        /// 新增彩种开奖数据
        /// </summary>
        /// <param name="lottery">彩种名称</param>
        /// <param name="model">开奖数据模型</param>
        /// <returns></returns>
        public bool AddOpen21Code(SCCLottery lottery, OpenCode21Model model)
        {
            var TableName = lottery.GetSCCLotteryTableName();
            var sqlString = string.Format(AddItemSql, TableName);

            DbParameter[] param = new DbParameter[] {
                new SqlParameter("@Term", model.Term),
                new SqlParameter("@OpenCode1", model.OpenCode1),
                new SqlParameter("@OpenCode2", model.OpenCode2),
                new SqlParameter("@OpenCode3", model.OpenCode3),
                new SqlParameter("@OpenCode4", model.OpenCode4),
                new SqlParameter("@OpenCode5", model.OpenCode5),
                new SqlParameter("@OpenCode6", model.OpenCode6),
                new SqlParameter("@OpenCode7", model.OpenCode7),
                new SqlParameter("@OpenCode8", model.OpenCode8),
                new SqlParameter("@OpenCode9", model.OpenCode9),
                new SqlParameter("@OpenCode10", model.OpenCode10),
                new SqlParameter("@OpenCode11", model.OpenCode11),
                new SqlParameter("@OpenCode12", model.OpenCode12),
                new SqlParameter("@OpenCode13", model.OpenCode13),
                new SqlParameter("@OpenCode14", model.OpenCode14),
                new SqlParameter("@OpenCode15", model.OpenCode15),
                new SqlParameter("@OpenCode16", model.OpenCode16),
                new SqlParameter("@OpenCode17", model.OpenCode17),
                new SqlParameter("@OpenCode18", model.OpenCode18),
                new SqlParameter("@OpenCode19", model.OpenCode19),
                new SqlParameter("@OpenCode20", model.OpenCode20),
                new SqlParameter("@OpenCode21", model.OpenCode21),
                new SqlParameter("@OpenTime", model.OpenTime),
                new SqlParameter("@ID", Guid.NewGuid().ToString().Replace("-", ""))
            };
            var result = this.BaseRepository(DatabaseLinksEnum.LotteryNumber).ExecuteBySql(sqlString, param);

            return(result > 0);
        }
Example #3
0
        public ActionResult GetTodaysLottery()
        {
            Dictionary <string, SCCConfig> dict = GetTodayLotteryDict();
            List <TodaysLotteryViewEntity> obj  = new List <TodaysLotteryViewEntity>();

            foreach (KeyValuePair <string, SCCConfig> pair in dict)
            {
                SCCConfig  config = pair.Value;
                SCCLottery type   = (SCCLottery)Enum.Parse(typeof(SCCLottery), config.EnumCode, true);
                //当前彩种今天真实开始开奖时间
                DateTime todayRealStartOpentime = (DateTimeHelper.Now.ToString("yyyy-MM-dd") + " " + config.StartHour + ":" + config.StartMinute).TryToDateTime();
                //如果当前时间大于当前彩种今天真实开始开奖时间,则忽略
                if (DateTimeHelper.Now < todayRealStartOpentime)
                {
                    string lastTerm = qgfc3Dbll.GetNewTermByTableName(type.GetSCCLotteryTableName());
                    obj.Add(new TodaysLotteryViewEntity
                    {
                        LotteryName = config.LotteryName,
                        Term        = lastTerm,
                        OpenTime    = todayRealStartOpentime,
                        MainUrl     = config.MainUrl,
                        EnumCode    = config.EnumCode
                    });
                }
            }
            obj = obj.OrderBy(o => o.OpenTime).ToList();
            return(Success("操作成功", obj.ToJson()));
        }
Example #4
0
        /// <summary>
        /// 获取最新一条记录
        /// </summary>
        /// <param name="lottery">彩种名称</param>
        /// <returns></returns>
        public OpenCode7Model GetLastItem(SCCLottery lottery)
        {
            var TableName = lottery.GetSCCLotteryTableName();
            var sqlString = string.Format(LastItemSql, TableName);

            var ds = this.BaseRepository(DatabaseLinksEnum.LotteryNumber).FindTable(sqlString);

            if (ds != null && ds.DataSet.Tables.Count > 0 && ds.DataSet.Tables[0].Rows.Count > 0)
            {
                var result = BaseServices.LoadData <OpenCode7Model>(ds.DataSet.Tables[0].Rows[0]);
                return(result);
            }
            return(null);
        }
Example #5
0
        /// <summary>
        /// 新增彩种开奖数据
        /// </summary>
        /// <param name="lottery">彩种名称</param>
        /// <param name="model">开奖数据模型</param>
        /// <returns></returns>
        public bool AddOpen3Code(SCCLottery lottery, OpenCode3Model model)
        {
            var TableName = lottery.GetSCCLotteryTableName();
            var sqlString = string.Format(AddItemSql, TableName);

            DbParameter[] param = new DbParameter[] {
                new SqlParameter("@Term", model.Term),
                new SqlParameter("@OpenCode1", model.OpenCode1),
                new SqlParameter("@OpenCode2", model.OpenCode2),
                new SqlParameter("@OpenCode3", model.OpenCode3),
                new SqlParameter("@OpenTime", model.OpenTime),
                new SqlParameter("@ID", Guid.NewGuid().ToString().Replace("-", ""))
            };
            var result = this.BaseRepository(DatabaseLinksEnum.LotteryNumber).ExecuteBySql(sqlString, param);

            return(result > 0);
        }