Hidistro.SqlDal/Promotions/GameDao.cs

(开头部分) 22KB

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

namespace Hidistro.SqlDal.Promotions
{
    using Hidistro.Core;
    using Hidistro.Core.Entities;
    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;
    using System.Runtime.InteropServices;
    using System.Text;

    public class GameDao
    {
        private Database _database = null;

        public GameDao()
        {
            this._database = DatabaseFactory.CreateDatabase();
        }

        public bool Create(GameInfo model, out int gameId)
        {
            gameId = -1;
            StringBuilder builder = new StringBuilder();
            builder.Append("INSERT INTO [Hishop_PromotionGame]\r\n                       ([GameType]\r\n                       ,[GameTitle]\r\n                       ,[Description]\r\n                       ,[BeginTime]\r\n                       ,[EndTime]\r\n                       ,[ApplyMembers]\r\n                       ,[NeedPoint]\r\n                       ,[GivePoint]\r\n                       ,[OnlyGiveNotPrizeMember]\r\n                       ,[PlayType]\r\n                       ,[NotPrzeDescription]\r\n                       ,[GameUrl]\r\n                       ,[GameQRCodeAddress]\r\n                       ,[Status],[KeyWork])\r\n                        VALUES ");
            builder.Append("(@GameType\r\n                       ,@GameTitle\r\n                       ,@Description\r\n                       ,@BeginTime\r\n                       ,@EndTime\r\n                       ,@ApplyMembers\r\n                       ,@NeedPoint\r\n                       ,@GivePoint\r\n                       ,@OnlyGiveNotPrizeMember\r\n                       ,@PlayType\r\n                       ,@NotPrzeDescription\r\n                       ,@GameUrl\r\n                       ,@GameQRCodeAddress\r\n                       ,@Status,@KeyWork);");
            builder.Append("select @@identity;");
            DbCommand sqlStringCommand = this._database.GetSqlStringCommand(builder.ToString());
            this._database.AddInParameter(sqlStringCommand, "@GameType", DbType.Int32, (int) model.GameType);
            this._database.AddInParameter(sqlStringCommand, "@GameTitle", DbType.String, model.GameTitle);
            this._database.AddInParameter(sqlStringCommand, "@Description", DbType.String, model.Description);
            this._database.AddInParameter(sqlStringCommand, "@BeginTime", DbType.DateTime, model.BeginTime);
            this._database.AddInParameter(sqlStringCommand, "@EndTime", DbType.DateTime, model.EndTime);
            this._database.AddInParameter(sqlStringCommand, "@ApplyMembers", DbType.String, model.ApplyMembers);
            this._database.AddInParameter(sqlStringCommand, "@NeedPoint", DbType.Int32, model.NeedPoint);
            this._database.AddInParameter(sqlStringCommand, "@GivePoint", DbType.Int32, model.GivePoint);
            this._database.AddInParameter(sqlStringCommand, "@OnlyGiveNotPrizeMember", DbType.Boolean, model.OnlyGiveNotPrizeMember);
            this._database.AddInParameter(sqlStringCommand, "@PlayType", DbType.Int32, (int) model.PlayType);
            this._database.AddInParameter(sqlStringCommand, "@NotPrzeDescription", DbType.String, model.NotPrzeDescription);
            this._database.AddInParameter(sqlStringCommand, "@GameUrl", DbType.String, model.GameUrl);
            this._database.AddInParameter(sqlStringCommand, "@GameQRCodeAddress", DbType.String, model.GameQRCodeAddress);
            this._database.AddInParameter(sqlStringCommand, "@Status", DbType.Int32, 0);
            this._database.AddInParameter(sqlStringCommand, "@KeyWork", DbType.String, model.KeyWork);
            try
            {
                object obj2 = this._database.ExecuteScalar(sqlStringCommand);
                if ((obj2 != null) && !int.TryParse(obj2.ToString(), out gameId))
                {
                    gameId = -1;
                }
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return (gameId > 0);
        }
后面还有 333 行代码,购买后查看完整代码

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

AI 解读 AI

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

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