Пример #1
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");
                }
            }
        }
Пример #2
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");
        }
Пример #3
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);
        }
Пример #4
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));
        }
Пример #5
0
 protected void save_Step3_Click(object sender, EventArgs e)
 {
     try
     {
         string str = this.txt_json.Text.Trim();
         if (str.Length <= 0)
         {
             this.ShowMsg("请设定奖品信息!", false);
         }
         else
         {
             List <GameActPrizeInfo> list = new List <GameActPrizeInfo>();
             JArray  array = (JArray)JsonConvert.DeserializeObject(str);
             decimal num   = 0M;
             if (array.Count > 0)
             {
                 for (int i = 0; i < array.Count; i++)
                 {
                     GameActPrizeInfo item = new GameActPrizeInfo();
                     int prizeId           = int.Parse(array[i]["prizeId"].ToString());
                     if (prizeId != 0)
                     {
                         item = GameActHelper.GetPrize(_gameId, prizeId);
                     }
                     else
                     {
                         item.Id = 0;
                     }
                     item.PrizeName     = array[i]["prizeName"].ToString();
                     item.PrizeType     = (ePrizeType)int.Parse(array[i]["prizeType"].ToString());
                     item.GrivePoint    = int.Parse(array[i]["point"].ToString());
                     item.PointNumber   = int.Parse(array[i]["pointNumber"].ToString());
                     item.PointRate     = int.Parse(array[i]["pointRate"].ToString());
                     item.GiveCouponId  = int.Parse(array[i]["coupon"].ToString());
                     item.CouponNumber  = int.Parse(array[i]["couponNumber"].ToString());
                     item.CouponRate    = int.Parse(array[i]["couponRate"].ToString());
                     item.GiveProductId = int.Parse(array[i]["product"].ToString());
                     item.ProductNumber = int.Parse(array[i]["productNumber"].ToString());
                     item.ProductRate   = int.Parse(array[i]["productRate"].ToString());
                     item.sort          = i + 1;
                     item.GameId        = _gameId;
                     num += (item.PointRate + item.CouponRate) + item.ProductRate;
                     list.Add(item);
                 }
             }
             if (num > 100M)
             {
                 this.ShowMsg("中奖率总和不能大于100!", false);
             }
             else
             {
                 foreach (GameActPrizeInfo info2 in list)
                 {
                     if (info2.Id != 0)
                     {
                         GameActHelper.UpdatePrize(info2);
                     }
                     else
                     {
                         GameActHelper.InsertPrize(info2);
                     }
                 }
             }
         }
     }
     catch (Exception)
     {
         this.ShowMsg("保存奖品失败!", false);
     }
 }
Пример #6
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);
         }
     }
 }
Пример #7
0
 protected void save_Step3_Click(object sender, System.EventArgs e)
 {
     try
     {
         string text = this.txt_json.Text.Trim();
         if (text.Length <= 0)
         {
             this.ShowMsg("请设定奖品信息!", false);
         }
         else
         {
             System.Collections.Generic.List <GameActPrizeInfo> list = new System.Collections.Generic.List <GameActPrizeInfo>();
             JArray  jArray = (JArray)JsonConvert.DeserializeObject(text);
             decimal d      = 0m;
             if (jArray.Count > 0)
             {
                 for (int i = 0; i < jArray.Count; i++)
                 {
                     GameActPrizeInfo gameActPrizeInfo = new GameActPrizeInfo();
                     int num = int.Parse(jArray[i]["prizeId"].ToString());
                     if (num != 0)
                     {
                         gameActPrizeInfo = GameActHelper.GetPrize(AddGameAct._gameId, num);
                     }
                     else
                     {
                         gameActPrizeInfo.Id = 0;
                     }
                     gameActPrizeInfo.PrizeName     = jArray[i]["prizeName"].ToString();
                     gameActPrizeInfo.PrizeType     = (ePrizeType)int.Parse(jArray[i]["prizeType"].ToString());
                     gameActPrizeInfo.GrivePoint    = int.Parse(jArray[i]["point"].ToString());
                     gameActPrizeInfo.PointNumber   = int.Parse(jArray[i]["pointNumber"].ToString());
                     gameActPrizeInfo.PointRate     = int.Parse(jArray[i]["pointRate"].ToString());
                     gameActPrizeInfo.GiveCouponId  = int.Parse(jArray[i]["coupon"].ToString());
                     gameActPrizeInfo.CouponNumber  = int.Parse(jArray[i]["couponNumber"].ToString());
                     gameActPrizeInfo.CouponRate    = int.Parse(jArray[i]["couponRate"].ToString());
                     gameActPrizeInfo.GiveProductId = int.Parse(jArray[i]["product"].ToString());
                     gameActPrizeInfo.ProductNumber = int.Parse(jArray[i]["productNumber"].ToString());
                     gameActPrizeInfo.ProductRate   = int.Parse(jArray[i]["productRate"].ToString());
                     gameActPrizeInfo.sort          = i + 1;
                     gameActPrizeInfo.GameId        = AddGameAct._gameId;
                     d += gameActPrizeInfo.PointRate + gameActPrizeInfo.CouponRate + gameActPrizeInfo.ProductRate;
                     list.Add(gameActPrizeInfo);
                 }
             }
             if (d > 100m)
             {
                 this.ShowMsg("中奖率总和不能大于100!", false);
             }
             else
             {
                 foreach (GameActPrizeInfo current in list)
                 {
                     if (current.Id != 0)
                     {
                         GameActHelper.UpdatePrize(current);
                     }
                     else
                     {
                         GameActHelper.InsertPrize(current);
                     }
                 }
             }
         }
     }
     catch (System.Exception)
     {
         this.ShowMsg("保存奖品失败!", false);
     }
 }