Hidistro.SqlDal/Promotions/GamePrizeDao.cs

(开头部分) 5KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

namespace Hidistro.SqlDal.Promotions
{
    using Hidistro.Entities;
    using Hidistro.Entities.Promotions;
    using Microsoft.Practices.EnterpriseLibrary.Data;
    using System;
    using System.Collections.Generic;
    using System.Data;
    using System.Data.Common;

    public class GamePrizeDao
    {
        private Database _db = null;

        public GamePrizeDao()
        {
            this._db = DatabaseFactory.CreateDatabase();
        }

        public bool Create(GamePrizeInfo model)
        {
            string query = "INSERT INTO [Hishop_PromotionGamePrizes]\r\n                    ([GameId]\r\n                    ,[PrizeGrade]\r\n                    ,[PrizeType]\r\n                    ,[GivePoint]\r\n                    ,[GiveCouponId]\r\n                    ,[GiveShopBookId]\r\n                    ,[PrizeCount]\r\n                    ,[PrizeRate]\r\n                    ,[GriveShopBookPicUrl])\r\n                  VALUES\r\n                    ( @GameId\r\n                    ,@PrizeGrade\r\n                    ,@PrizeType\r\n                    ,@GivePoint\r\n                    ,@GiveCouponId\r\n                    ,@GiveShopBookId\r\n                    ,@PrizeCount\r\n                    ,@PrizeRate\r\n                    ,@GriveShopBookPicUrl);";
            DbCommand sqlStringCommand = this._db.GetSqlStringCommand(query);
            this._db.AddInParameter(sqlStringCommand, "@GameId", DbType.Int32, model.GameId);
            this._db.AddInParameter(sqlStringCommand, "@PrizeGrade", DbType.Int32, (int) model.PrizeGrade);
            this._db.AddInParameter(sqlStringCommand, "@PrizeType", DbType.Int32, (int) model.PrizeType);
            this._db.AddInParameter(sqlStringCommand, "@GivePoint", DbType.Decimal, model.GivePoint);
            this._db.AddInParameter(sqlStringCommand, "@GiveCouponId", DbType.String, model.GiveCouponId);
            this._db.AddInParameter(sqlStringCommand, "@GiveShopBookId", DbType.String, model.GiveShopBookId);
            this._db.AddInParameter(sqlStringCommand, "@PrizeCount", DbType.Int32, model.PrizeCount);
            this._db.AddInParameter(sqlStringCommand, "@PrizeRate", DbType.Int32, model.PrizeRate);
            this._db.AddInParameter(sqlStringCommand, "@GriveShopBookPicUrl", DbType.String, model.GriveShopBookPicUrl);
            return (this._db.ExecuteNonQuery(sqlStringCommand) > 0);
        }

        public IList<GamePrizeInfo> GetGamePrizeListsByGameId(int gameId)
        {
            string query = "Select * From [Hishop_PromotionGamePrizes] where GameId=@GameId ";
            DbCommand sqlStringCommand = this._db.GetSqlStringCommand(query);
            this._db.AddInParameter(sqlStringCommand, "@GameId", DbType.Int32, gameId);
            using (IDataReader reader = this._db.ExecuteReader(sqlStringCommand))
            {
                return ReaderConvert.ReaderToList<GamePrizeInfo>(reader);
            }
        }

        public GamePrizeInfo GetModelByPrizeGradeAndGameId(PrizeGrade grade, int gameId)
        {
            string query = "Select * From [Hishop_PromotionGamePrizes] where PrizeGrade=@PrizeGrade and GameId=@GameId ";
            DbCommand sqlStringCommand = this._db.GetSqlStringCommand(query);
            this._db.AddInParameter(sqlStringCommand, "@PrizeGrade", DbType.Int32, (int) grade);
            this._db.AddInParameter(sqlStringCommand, "@GameId", DbType.Int32, gameId);
            using (IDataReader reader = this._db.ExecuteReader(sqlStringCommand))
            {
                return ReaderConvert.ReaderToModel<GamePrizeInfo>(reader);
            }
        }

        public bool Update(GamePrizeInfo model)
        {
后面还有 15 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。