Пример #1
0
 public bool Update(GameActInfo game, ref string msg)
 {
     msg = "未知错误";
     try
     {
         DbCommand sqlStringCommand = this.database.GetSqlStringCommand("UPDATE[Hishop_Game]   SET [GameType] = @GameType , [GameName] = @GameName  , [BeginDate] = @BeginDate , [EndDate] = @EndDate , [Decription] = @Decription , [MemberGrades] = @MemberGrades , [usePoint] = @usePoint , [GivePoint] = @GivePoint , [bOnlyNotWinner] = @bOnlyNotWinner , [attendTimes] = @attendTimes , [ImgUrl] = @ImgUrl , [status] = @status , [unWinDecrip] = @unWinDecrip , [CreateStep] = @CreateStep  where GameId=@ID");
         this.database.AddInParameter(sqlStringCommand, "GameType", DbType.Int32, (int)game.GameType);
         this.database.AddInParameter(sqlStringCommand, "GameName", DbType.String, game.GameName);
         this.database.AddInParameter(sqlStringCommand, "BeginDate", DbType.DateTime, game.BeginDate);
         this.database.AddInParameter(sqlStringCommand, "EndDate", DbType.DateTime, game.EndDate);
         this.database.AddInParameter(sqlStringCommand, "Decription", DbType.String, game.Decription);
         this.database.AddInParameter(sqlStringCommand, "MemberGrades", DbType.String, game.MemberGrades);
         this.database.AddInParameter(sqlStringCommand, "usePoint", DbType.Int32, game.usePoint);
         this.database.AddInParameter(sqlStringCommand, "GivePoint", DbType.Int32, game.GivePoint);
         this.database.AddInParameter(sqlStringCommand, "bOnlyNotWinner", DbType.Boolean, game.bOnlyNotWinner);
         this.database.AddInParameter(sqlStringCommand, "attendTimes", DbType.Int32, game.attendTimes);
         this.database.AddInParameter(sqlStringCommand, "ImgUrl", DbType.String, game.ImgUrl);
         this.database.AddInParameter(sqlStringCommand, "status", DbType.Int32, game.status);
         this.database.AddInParameter(sqlStringCommand, "unWinDecrip", DbType.String, game.unWinDecrip);
         this.database.AddInParameter(sqlStringCommand, "CreateStep", DbType.Int32, game.CreateStep);
         this.database.AddInParameter(sqlStringCommand, "ID", DbType.Int32, game.GameId);
         object obj2 = this.database.ExecuteScalar(sqlStringCommand);
         return(true);
     }
     catch (Exception exception)
     {
         msg = exception.Message;
         return(false);
     }
 }
Пример #2
0
 public int Create(GameActInfo game, ref string msg)
 {
     msg = "未知错误";
     try
     {
         DbCommand sqlStringCommand = this.database.GetSqlStringCommand("INSERT INTO [Hishop_Game]([GameType],[GameName],[BeginDate],[EndDate],[Decription],[MemberGrades], [usePoint],[GivePoint],[bOnlyNotWinner],[attendTimes],[ImgUrl],[status],[unWinDecrip],[CreateStep]) VALUES (@GameType,@GameName,@BeginDate,@EndDate,@Decription,@MemberGrades,@usePoint,@GivePoint,@bOnlyNotWinner, @attendTimes,@ImgUrl,@status,@unWinDecrip,@CreateStep) SELECT CAST(scope_identity() AS int)");
         this.database.AddInParameter(sqlStringCommand, "GameType", DbType.Int32, (int)game.GameType);
         this.database.AddInParameter(sqlStringCommand, "GameName", DbType.String, game.GameName);
         this.database.AddInParameter(sqlStringCommand, "BeginDate", DbType.DateTime, game.BeginDate);
         this.database.AddInParameter(sqlStringCommand, "EndDate", DbType.DateTime, game.EndDate);
         this.database.AddInParameter(sqlStringCommand, "Decription", DbType.String, game.Decription);
         this.database.AddInParameter(sqlStringCommand, "MemberGrades", DbType.String, game.MemberGrades);
         this.database.AddInParameter(sqlStringCommand, "usePoint", DbType.Int32, game.usePoint);
         this.database.AddInParameter(sqlStringCommand, "GivePoint", DbType.Int32, game.GivePoint);
         this.database.AddInParameter(sqlStringCommand, "bOnlyNotWinner", DbType.Boolean, game.bOnlyNotWinner);
         this.database.AddInParameter(sqlStringCommand, "attendTimes", DbType.Int32, game.attendTimes);
         this.database.AddInParameter(sqlStringCommand, "ImgUrl", DbType.String, game.ImgUrl);
         this.database.AddInParameter(sqlStringCommand, "status", DbType.Int32, game.status);
         this.database.AddInParameter(sqlStringCommand, "unWinDecrip", DbType.String, game.unWinDecrip);
         this.database.AddInParameter(sqlStringCommand, "CreateStep", DbType.Int32, game.CreateStep);
         int num = (int)this.database.ExecuteScalar(sqlStringCommand);
         msg = "";
         return(num);
     }
     catch (Exception exception)
     {
         msg = exception.Message;
         return(0);
     }
 }
Пример #3
0
        private void SaveGameStep2()
        {
            string str  = this.txt_grades.Text.Trim();
            string val  = this.txt_uPoint.Text.Trim();
            string str3 = this.txt_gPoint.Text.Trim();
            int    i    = 0;
            int    num2 = 0;

            if (string.IsNullOrEmpty(str))
            {
                this.ShowMsg("请选择适用会员等级!", false);
            }
            else if (!val.bInt(ref i))
            {
                this.ShowMsg("请输入正确的消耗积分!", false);
            }
            else
            {
                if (string.IsNullOrEmpty(str3))
                {
                    str3 = "0";
                }
                if (!str3.bInt(ref num2))
                {
                    this.ShowMsg("请输入正确的赠送积分!", false);
                }
                else
                {
                    GameActInfo game = GameActHelper.Get(_gameId);
                    game.MemberGrades   = str;
                    game.usePoint       = i;
                    game.GivePoint      = num2;
                    game.bOnlyNotWinner = this.onlyChk.Checked;
                    if (this.rd1.Checked)
                    {
                        game.attendTimes = 0;
                    }
                    else if (this.rd2.Checked)
                    {
                        game.attendTimes = 1;
                    }
                    else if (this.rd3.Checked)
                    {
                        game.attendTimes = 2;
                    }
                    else if (this.rd4.Checked)
                    {
                        game.attendTimes = 3;
                    }
                    game.CreateStep = 3;
                    string msg = "";
                    GameActHelper.Update(game, ref msg);
                    base.Response.Redirect("AddGameAct.aspx?id=" + _gameId + "&step=3");
                }
            }
        }
Пример #4
0
        private void SaveGameStep2()
        {
            string text      = this.txt_grades.Text.Trim();
            string val       = this.txt_uPoint.Text.Trim();
            string text2     = this.txt_gPoint.Text.Trim();
            int    usePoint  = 0;
            int    givePoint = 0;

            if (string.IsNullOrEmpty(text))
            {
                this.ShowMsg("请选择适用会员等级!", false);
                return;
            }
            if (!val.bInt(ref usePoint))
            {
                this.ShowMsg("请输入正确的消耗积分!", false);
                return;
            }
            if (string.IsNullOrEmpty(text2))
            {
                text2 = "0";
            }
            if (!text2.bInt(ref givePoint))
            {
                this.ShowMsg("请输入正确的赠送积分!", false);
                return;
            }
            GameActInfo gameActInfo = GameActHelper.Get(AddGameAct._gameId);

            gameActInfo.MemberGrades   = text;
            gameActInfo.usePoint       = usePoint;
            gameActInfo.GivePoint      = givePoint;
            gameActInfo.bOnlyNotWinner = this.onlyChk.Checked;
            if (this.rd1.Checked)
            {
                gameActInfo.attendTimes = 0;
            }
            else if (this.rd2.Checked)
            {
                gameActInfo.attendTimes = 1;
            }
            else if (this.rd3.Checked)
            {
                gameActInfo.attendTimes = 2;
            }
            else if (this.rd4.Checked)
            {
                gameActInfo.attendTimes = 3;
            }
            gameActInfo.CreateStep = 3;
            string text3 = "";

            GameActHelper.Update(gameActInfo, ref text3);
            base.Response.Redirect("AddGameAct.aspx?id=" + AddGameAct._gameId + "&step=3");
        }
Пример #5
0
        public GameActInfo GetGame(int Id)
        {
            GameActInfo result = null;

            System.Data.Common.DbCommand sqlStringCommand = this.database.GetSqlStringCommand("SELECT * FROM Hishop_Game WHERE GameId = @ID");
            this.database.AddInParameter(sqlStringCommand, "ID", System.Data.DbType.Int32, Id);
            using (System.Data.IDataReader dataReader = this.database.ExecuteReader(sqlStringCommand))
            {
                result = ReaderConvert.ReaderToModel <GameActInfo>(dataReader);
            }
            return(result);
        }
Пример #6
0
        private int AddGame()
        {
            string text  = this.txt_name.Text.Trim();
            string text2 = this.txt_decrip.Text.Trim();

            System.DateTime date     = this.calendarStartDate.SelectedDate.Value.Date;
            System.DateTime dateTime = this.calendarEndDate.SelectedDate.Value.Date.AddDays(1.0).AddSeconds(-1.0);
            if (string.IsNullOrEmpty(text) || text.Length > 30)
            {
                this.ShowMsg("请输入正确的游戏名,不超过30个字符!", false);
                return(0);
            }
            if (text2.Length > 600)
            {
                this.ShowMsg("游戏说明不能超过600个字符!", false);
                return(0);
            }
            if (dateTime < date)
            {
                this.ShowMsg("结束时间不能早于开始时间!", false);
                return(0);
            }
            GameActInfo gameActInfo = new GameActInfo();

            if (AddGameAct._gameId != 0)
            {
                gameActInfo = GameActHelper.Get(AddGameAct._gameId);
            }
            gameActInfo.GameName   = text;
            gameActInfo.Decription = text2;
            gameActInfo.BeginDate  = date;
            gameActInfo.EndDate    = dateTime;
            gameActInfo.CreateStep = 2;
            string text3 = "";
            int    result;

            if (AddGameAct._gameId != 0)
            {
                GameActHelper.Update(gameActInfo, ref text3);
                result = gameActInfo.GameId;
            }
            else
            {
                result = GameActHelper.Create(gameActInfo, ref text3);
            }
            return(result);
        }
Пример #7
0
        private int AddGame()
        {
            string   str   = this.txt_name.Text.Trim();
            string   str2  = this.txt_decrip.Text.Trim();
            DateTime date  = this.calendarStartDate.SelectedDate.Value.Date;
            DateTime time2 = this.calendarEndDate.SelectedDate.Value.Date.AddDays(1.0).AddSeconds(-1.0);

            if (string.IsNullOrEmpty(str) || (str.Length > 30))
            {
                this.ShowMsg("请输入正确的游戏名,不超过30个字符!", false);
                return(0);
            }
            if (str2.Length > 600)
            {
                this.ShowMsg("游戏说明不能超过600个字符!", false);
                return(0);
            }
            if (time2 < date)
            {
                this.ShowMsg("结束时间不能早于开始时间!", false);
                return(0);
            }
            GameActInfo game = new GameActInfo();

            if (_gameId != 0)
            {
                game = GameActHelper.Get(_gameId);
            }
            game.GameName   = str;
            game.Decription = str2;
            game.BeginDate  = date;
            game.EndDate    = time2;
            game.CreateStep = 2;
            string msg = "";

            if (_gameId != 0)
            {
                GameActHelper.Update(game, ref msg);
                return(game.GameId);
            }
            return(GameActHelper.Create(game, ref msg));
        }
Пример #8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     this.saveBtn.Click    += new EventHandler(this.saveBtn_Click);
     this.save_Step2.Click += new EventHandler(this.save_Step2_Click);
     this.back_Step2.Click += new EventHandler(this.back_Step2_Click);
     this.save_Step3.Click += new EventHandler(this.save_Step3_Click);
     this.back_Step3.Click += new EventHandler(this.back_Step3_Click);
     string[] allKeys = base.Request.Params.AllKeys;
     this.txt_decrip.MaxLength = 600;
     if (allKeys.Contains <string>("id") && base.Request["id"].ToString().bInt(ref _gameId))
     {
         GameActInfo info = GameActHelper.Get(_gameId);
         if (info == null)
         {
             this.ShowMsg("没有这个游戏~", false);
             return;
         }
         _step              = info.CreateStep;
         this._gameType     = info.GameType;
         this.txt_name.Text = info.GameName;
         this.calendarStartDate.SelectedDate = new DateTime?(info.BeginDate);
         this.calendarEndDate.SelectedDate   = new DateTime?(info.EndDate);
         this.txt_decrip.Text = info.Decription;
         this.txt_gPoint.Text = info.GivePoint.ToString();
         this.txt_uPoint.Text = info.usePoint.ToString();
         this._grade          = info.MemberGrades;
         this.onlyChk.Checked = info.bOnlyNotWinner;
         if (info.attendTimes == 0)
         {
             this.rd1.Checked = true;
         }
         else if (info.attendTimes == 1)
         {
             this.rd2.Checked = true;
         }
         else if (info.attendTimes == 2)
         {
             this.rd3.Checked = true;
         }
         else if (info.attendTimes == 3)
         {
             this.rd4.Checked = true;
         }
     }
     if (allKeys.Contains <string>("step"))
     {
         int i = 0;
         if (base.Request["step"].ToString().bInt(ref i))
         {
             _step = i;
         }
     }
     if (_step > 4)
     {
         _step = 4;
     }
     if (_step == 3)
     {
         IList <GameActPrizeInfo> prizesModel = GameActHelper.GetPrizesModel(_gameId);
         if ((prizesModel != null) && (prizesModel.Count > 0))
         {
             foreach (GameActPrizeInfo info2 in prizesModel)
             {
                 info2.PointRate   = Math.Round(info2.PointRate);
                 info2.CouponRate  = Math.Round(info2.CouponRate);
                 info2.ProductRate = Math.Round(info2.ProductRate);
             }
             this._json = JsonConvert.SerializeObject(prizesModel);
         }
     }
 }
Пример #9
0
 public static bool Update(GameActInfo game, ref string msg)
 {
     return(_game.Update(game, ref msg));
 }
Пример #10
0
 public static int Create(GameActInfo game, ref string msg)
 {
     return(_game.Create(game, ref msg));
 }