Beispiel #1
0
        private void ajaxBetting2()
        {
            if (this.AdminId == "")
            {
                this._response = this.JsonResult(0, "投注失败,请重新登录后再进行投注!");
            }
            else if (this.site.BetIsOpen == 1)
            {
                this._response = this.JsonResult(0, "系统正在维护,不能投注!");
            }
            else
            {
                HttpContext.Current.Response.ContentType = "application/json";
                List <ajaxBetting.RequestDataJSON> requestDataJsonList = ajaxBetting.JSONToObject <List <ajaxBetting.RequestDataJSON> >(HttpUtility.UrlDecode(new StreamReader(HttpContext.Current.Request.InputStream).ReadToEnd()));
                ajaxBetting.RequestDataJSON        requestDataJson1    = new ajaxBetting.RequestDataJSON();
                int lotteryId = requestDataJsonList[0].lotteryId;

                LotteryDAL         lotDal  = new LotteryDAL();
                FlexDAL.UserBetDAL betDal  = new FlexDAL.UserBetDAL();
                SysLotteryModel    lottery = lotDal.GetSysLotteryById(lotteryId);

                if (betDal.CheckBetTime(lotteryId) == false)
                {
                    this._response = this.JsonResult(0, string.Format("凌晨1点55分到上午10点, [{0}]暂停开奖", lottery.Title));
                    return;
                }

                int     int32 = Convert.ToInt32(this.AdminId);
                Decimal num1  = new Decimal();
                try
                {
                    string[] issueTimeAndSn = betDal.GetIssueTimeAndSN(lotteryId);
                    string   str1           = issueTimeAndSn[0];
                    DateTime dateTime       = Convert.ToDateTime(issueTimeAndSn[1]);
                    DateTime serverTime     = FlexDAL.PublicDAL.GetServerTime();
                    for (int index = 0; index < requestDataJsonList.Count; ++index)
                    {
                        ajaxBetting.RequestDataJSON requestDataJson2 = requestDataJsonList[index];
                        num1 += requestDataJson2.price * (Decimal)requestDataJson2.Num * requestDataJson2.times;
                    }
                    string str2 = betDal.CheckBet(int32, lotteryId, Convert.ToDecimal(num1), dateTime);
                    if (!string.IsNullOrEmpty(str2))
                    {
                        this._response = this.JsonResult(0, str2);
                    }
                    else
                    {
                        int num2 = 0;
                        for (int index = 0; index < requestDataJsonList.Count; ++index)
                        {
                            ajaxBetting.RequestDataJSON requestDataJson2 = requestDataJsonList[index];
                            this.doh.Reset();
                            this.doh.ConditionExpress = "Id=@Id";
                            this.doh.AddConditionParameter("@Id", (object)requestDataJson2.playId.ToString());
                            string  str3        = string.Concat(this.doh.GetField("Sys_PlaySmallType", "Title2"));
                            Decimal singelBouns = new Decimal();
                            if (lotteryId != 5001)
                            {
                                if (Convert.ToDecimal(requestDataJson2.price) < Decimal.Zero || Convert.ToDecimal(requestDataJson2.Num) < Decimal.One || Convert.ToDecimal(requestDataJson2.times) < Decimal.One)
                                {
                                    this._response = this.JsonResult(0, "投注错误!请重新投注!");
                                    return;
                                }
                                string str4 = Calculate.BetNumerice(int32, lotteryId, requestDataJson2.balls, requestDataJson2.playId.ToString(), requestDataJson2.strPos, Convert.ToInt32(requestDataJson2.Num), Convert.ToDecimal(requestDataJson2.Point), ref singelBouns);
                                if (!string.IsNullOrEmpty(str4))
                                {
                                    this._response = str4.Replace("[", "").Replace("]", "");
                                    return;
                                }
                                if (singelBouns <= Decimal.Zero)
                                {
                                    this._response = this.JsonResult(0, "投注失败,返点错误,请重新投注!");
                                    return;
                                }
                                if (Convert.ToDecimal(requestDataJson2.price) * (Decimal)Convert.ToInt32(requestDataJson2.Num) * (Decimal)Convert.ToInt32(requestDataJson2.times) >= new Decimal(1000000))
                                {
                                    this._response = this.JsonResult(0, "投注失败,单个玩法投注额不能超过100万!");
                                    return;
                                }
                            }
                            UserBetModel model = new UserBetModel();
                            model.UserId      = int32;
                            model.UserMoney   = Decimal.Zero;
                            model.LotteryId   = lotteryId;
                            model.PlayId      = Convert.ToInt32(requestDataJson2.playId.ToString());
                            model.PlayCode    = str3;
                            model.IssueNum    = str1;
                            model.SingleMoney = Convert.ToDecimal(requestDataJson2.price);
                            model.Num         = Convert.ToInt32(requestDataJson2.Num);
                            model.Detail      = requestDataJson2.balls;
                            model.Point       = Convert.ToDecimal(requestDataJson2.Point);
                            model.Bonus       = singelBouns;
                            model.Pos         = requestDataJson2.strPos;
                            model.STime       = dateTime;
                            model.STime2      = serverTime;
                            model.IsDelay     = 0;
                            model.Times       = Convert.ToDecimal(requestDataJson2.times);
                            model.ZHID        = 0;
                            num2 = !model.Pos.Equals("") ?
                                   betDal.InsertBetPos(model, "Web端") :
                                   (model.PlayCode.Equals("P_5ZH") || model.PlayCode.Equals("P_4ZH_L") || (model.PlayCode.Equals("P_4ZH_R") || model.PlayCode.Equals("P_3ZH_L")) || (model.PlayCode.Equals("P_3ZH_C") || model.PlayCode.Equals("P_3ZH_R")) ?
                                    betDal.InsertBetZH(model, "Web端") :
                                    betDal.InsertBet(model, "Web端"));
                        }
                        if (num2 > 0)
                        {
                            this._response = this.JsonResult(1, "第" + str1 + "期投注成功,请期待开奖!");
                        }
                        else
                        {
                            this._response = this.JsonResult(0, "对不起,投注失败!");
                        }
                        //this._response = this.JsonResult(1, "第" + str1 + "期投注成功,请期待开奖!");
                    }
                }
                catch (Exception ex)
                {
                    this._response = this.JsonResult(0, "对不起,投注失败!" + (object)ex);
                }
            }
        }
Beispiel #2
0
        private void ajaxBetting2()
        {
            if (this.AdminId == "")
            {
                this._response = base.JsonResult(0, "投注失败,请重新登录后再进行投注!");
                return;
            }
            if (this.site.BetIsOpen == 1)
            {
                this._response = base.JsonResult(0, "系统正在维护,不能投注!");
                return;
            }
            HttpContext.Current.Response.ContentType = "application/json";
            List <ajaxBetting.RequestDataJSON> list = ajaxBetting.JSONToObject <List <ajaxBetting.RequestDataJSON> >(HttpUtility.UrlDecode(new StreamReader(HttpContext.Current.Request.InputStream).ReadToEnd()));

            ajaxBetting.RequestDataJSON requestDataJSON = new ajaxBetting.RequestDataJSON();
            int     lotteryId = list[0].lotteryId;
            int     userId    = Convert.ToInt32(this.AdminId);
            decimal num       = 0m;

            try
            {
                string[] expr_B0    = new Lottery.DAL.Flex.UserBetDAL().GetIssueTimeAndSN(lotteryId);
                string   text       = expr_B0[0];
                DateTime sTime      = Convert.ToDateTime(expr_B0[1]);
                DateTime serverTime = PublicDAL.GetServerTime();
                for (int i = 0; i < list.Count; i++)
                {
                    requestDataJSON = list[i];
                    num            += requestDataJSON.price * requestDataJSON.Num * requestDataJSON.times;
                }
                string text2 = new Lottery.DAL.Flex.UserBetDAL().CheckBet(userId, lotteryId, Convert.ToDecimal(num), sTime);
                if (!string.IsNullOrEmpty(text2))
                {
                    this._response = base.JsonResult(0, text2);
                }
                else
                {
                    int num2 = 0;
                    for (int j = 0; j < list.Count; j++)
                    {
                        requestDataJSON = list[j];
                        this.doh.Reset();
                        this.doh.ConditionExpress = "Id=@Id";
                        this.doh.AddConditionParameter("@Id", requestDataJSON.playId.ToString());
                        string  playCode = string.Concat(this.doh.GetField("Sys_PlaySmallType", "Title2"));
                        decimal num3     = 0m;
                        if (lotteryId != 5001)
                        {
                            if (Convert.ToDecimal(requestDataJSON.price) < decimal.Zero || Convert.ToDecimal(requestDataJSON.Num) < decimal.One || Convert.ToDecimal(requestDataJSON.times) < decimal.One)
                            {
                                this._response = base.JsonResult(0, "投注错误!请重新投注!");
                                return;
                            }
                            string text3 = Calculate.BetNumerice(userId, lotteryId, requestDataJSON.balls, requestDataJSON.playId.ToString(), requestDataJSON.strPos, Convert.ToInt32(requestDataJSON.Num), Convert.ToDecimal(requestDataJSON.Point), ref num3);
                            if (!string.IsNullOrEmpty(text3))
                            {
                                this._response = text3.Replace("[", "").Replace("]", "");
                                return;
                            }
                            if (num3 <= decimal.Zero)
                            {
                                this._response = base.JsonResult(0, "投注失败,返点错误,请重新投注!");
                                return;
                            }
                            if (Convert.ToDecimal(requestDataJSON.price) * Convert.ToInt32(requestDataJSON.Num) * Convert.ToInt32(requestDataJSON.times) >= 1000000m)
                            {
                                this._response = base.JsonResult(0, "投注失败,单个玩法投注额不能超过100万!");
                                return;
                            }
                        }
                        UserBetModel userBetModel = new UserBetModel();
                        userBetModel.UserId      = userId;
                        userBetModel.UserMoney   = decimal.Zero;
                        userBetModel.LotteryId   = lotteryId;
                        userBetModel.PlayId      = Convert.ToInt32(requestDataJSON.playId.ToString());
                        userBetModel.PlayCode    = playCode;
                        userBetModel.IssueNum    = text;
                        userBetModel.SingleMoney = Convert.ToDecimal(requestDataJSON.price);
                        userBetModel.Num         = Convert.ToInt32(requestDataJSON.Num);
                        userBetModel.Detail      = requestDataJSON.balls;
                        userBetModel.Point       = Convert.ToDecimal(requestDataJSON.Point);
                        userBetModel.Bonus       = num3;
                        userBetModel.Pos         = requestDataJSON.strPos;
                        userBetModel.STime       = sTime;
                        userBetModel.STime2      = serverTime;
                        userBetModel.IsDelay     = 0;
                        userBetModel.Times       = Convert.ToDecimal(requestDataJSON.times);
                        userBetModel.ZHID        = 0;
                        if (userBetModel.Pos.Equals(""))
                        {
                            if (userBetModel.PlayCode.Equals("P_5ZH") || userBetModel.PlayCode.Equals("P_4ZH_L") || userBetModel.PlayCode.Equals("P_4ZH_R") || userBetModel.PlayCode.Equals("P_3ZH_L") || userBetModel.PlayCode.Equals("P_3ZH_C") || userBetModel.PlayCode.Equals("P_3ZH_R"))
                            {
                                num2 = new Lottery.DAL.Flex.UserBetDAL().InsertBetZH(userBetModel, "Web端");
                            }
                            else
                            {
                                num2 = new Lottery.DAL.Flex.UserBetDAL().InsertBet(userBetModel, "Web端");
                            }
                        }
                        else
                        {
                            num2 = new Lottery.DAL.Flex.UserBetDAL().InsertBetPos(userBetModel, "Web端");
                        }
                    }
                    if (num2 > 0)
                    {
                        this._response = base.JsonResult(1, "第" + text + "期投注成功,请期待开奖!");
                    }
                    else
                    {
                        this._response = base.JsonResult(0, "对不起,投注失败!");
                    }
                }
            }
            catch (Exception arg)
            {
                this._response = base.JsonResult(0, "对不起,投注失败!" + arg);
            }
        }