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 lotteryId1 = requestDataJsonList[0].lotteryId;   //投注信息
                int int32_1    = Convert.ToInt32(this.AdminId);      //会员Id

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

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


                Decimal num1 = new Decimal(0);
                try
                {
                    //获取当前一期时间和期号
                    string[] issueTimeAndSn = betDal.GetIssueTimeAndSN(lotteryId1);
                    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_1, lotteryId1, 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";
                            DbOperHandler doh            = this.doh;
                            string        _conditionName = "@Id";
                            int           playId1        = requestDataJson2.playId;
                            string        str3           = playId1.ToString();
                            doh.AddConditionParameter(_conditionName, (object)str3);
                            string  str4        = string.Concat(this.doh.GetField("Sys_PlaySmallType", "Title2"));
                            Decimal singelBouns = new Decimal(0);
                            if (lotteryId1 != 5001)
                            {
                                if (Convert.ToDecimal(requestDataJson2.price) < new Decimal(0) || Convert.ToDecimal(requestDataJson2.Num) < new Decimal(1) || Convert.ToDecimal(requestDataJson2.times) < new Decimal(1))
                                {
                                    this._response = this.JsonResult(0, "投注错误!请重新投注!");
                                    return;
                                }
                                int    userId     = int32_1;
                                int    lotteryId2 = lotteryId1;
                                string balls      = requestDataJson2.balls;
                                playId1 = requestDataJson2.playId;
                                string  playId2 = playId1.ToString();
                                string  strPos  = requestDataJson2.strPos;
                                int     int32_2 = Convert.ToInt32(requestDataJson2.Num);
                                Decimal Point   = Convert.ToDecimal(requestDataJson2.Point);
                                string  str5    = Calculate.BetNumerice(userId, lotteryId2, balls, playId2, strPos, int32_2, Point, ref singelBouns);
                                if (!string.IsNullOrEmpty(str5))
                                {
                                    this._response = str5.Replace("[", "").Replace("]", "");
                                    return;
                                }
                                if (singelBouns <= new Decimal(0))
                                {
                                    this._response = this.JsonResult(0, "投注失败,返点错误,请重新投注!");
                                    return;
                                }
                            }
                            UserBetModel model = new UserBetModel();
                            model.UserId      = int32_1;
                            model.UserMoney   = new Decimal(0);
                            model.LotteryId   = lotteryId1;
                            model.PlayId      = Convert.ToInt32(requestDataJson2.playId);
                            model.PlayCode    = str4;
                            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, "手机端") :
                                   (!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.InsertBet(model, "手机端") :
                                    betDal.InsertBetZH(model, "手机端"));
                        }
                        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, "对不起,投注失败!");
                }
            }
        }
        private void ajaxZHBetting()
        {
            if (this.AdminId == "")
            {
                this._response = this.JsonResult(0, "投注失败,请重新登录后再进行投注!");
            }
            else
            {
                HttpContext.Current.Response.ContentType = "application/json";
                List <ajaxBetting.RequestDataJSONZH> requestDataJsonzhList = ajaxBetting.JSONToObject <List <ajaxBetting.RequestDataJSONZH> >("[" + new StreamReader(HttpContext.Current.Request.InputStream).ReadToEnd() + "]");
                ajaxBetting.RequestDataJSONZH        requestDataJsonzh1    = new ajaxBetting.RequestDataJSONZH();
                int     int32_1 = Convert.ToInt32(this.AdminId);
                int     int32_2 = Convert.ToInt32(requestDataJsonzhList[0].lotteryId);
                int     int32_3 = Convert.ToInt32(requestDataJsonzhList[0].IsStop);
                int     int32_4 = Convert.ToInt32(requestDataJsonzhList[0].ZHNums);
                Decimal num     = Convert.ToDecimal(requestDataJsonzhList[0].ZHSums);

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

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

                try
                {
                    string[] issueTimeAndSn = betDal.GetIssueTimeAndSN(int32_2);
                    string   str1           = issueTimeAndSn[0];
                    DateTime dateTime       = Convert.ToDateTime(issueTimeAndSn[1]);
                    DateTime serverTime     = FlexDAL.PublicDAL.GetServerTime();
                    string   str2           = betDal.CheckBet(int32_1, int32_2, Convert.ToDecimal(num), dateTime);
                    if (!string.IsNullOrEmpty(str2))
                    {
                        this._response = this.JsonResult(0, str2);
                    }
                    else
                    {
                        Decimal        money   = new Decimal(0);
                        UserZhBetModel zhmodel = new UserZhBetModel();
                        zhmodel.UserId        = int32_1;
                        zhmodel.LotteryId     = int32_2;
                        zhmodel.PlayId        = 0;
                        zhmodel.StartIssueNum = str1;
                        zhmodel.TotalNums     = int32_4;
                        zhmodel.IsStop        = int32_3;
                        zhmodel.STime         = DateTime.Now;
                        List <UserBetModel>      userBetModelList = new List <UserBetModel>();
                        List <UserZhDetailModel> listZh           = new List <UserZhDetailModel>();
                        for (int index1 = 0; index1 < requestDataJsonzhList.Count; ++index1)
                        {
                            ajaxBetting.RequestDataJSONZH requestDataJsonzh2 = requestDataJsonzhList[index1];
                            this.doh.Reset();
                            this.doh.ConditionExpress = "Id=@Id";
                            DbOperHandler doh            = this.doh;
                            string        _conditionName = "@Id";
                            int           playId1        = requestDataJsonzh2.playId;
                            string        str3           = playId1.ToString();
                            doh.AddConditionParameter(_conditionName, (object)str3);
                            string str4 = string.Concat(this.doh.GetField("Sys_PlaySmallType", "Title2"));
                            if (Convert.ToDecimal(requestDataJsonzh2.price) < new Decimal(0) || Convert.ToDecimal(requestDataJsonzh2.Num) < new Decimal(1) || Convert.ToDecimal(requestDataJsonzh2.times) < new Decimal(1))
                            {
                                this._response = this.JsonResult(0, "投注错误!请重新投注!");
                                return;
                            }
                            Decimal singelBouns = new Decimal(0);
                            int     userId      = int32_1;
                            int     lotteryId   = int32_2;
                            string  balls       = requestDataJsonzh2.balls;
                            playId1 = requestDataJsonzh2.playId;
                            string  playId2 = playId1.ToString();
                            string  strPos  = requestDataJsonzh2.strPos;
                            int     int32_5 = Convert.ToInt32(requestDataJsonzh2.Num);
                            Decimal Point   = Convert.ToDecimal(requestDataJsonzh2.Point);
                            string  str5    = Calculate.BetNumerice(userId, lotteryId, balls, playId2, strPos, int32_5, Point, ref singelBouns);
                            if (!string.IsNullOrEmpty(str5))
                            {
                                this._response = str5;
                                return;
                            }
                            if (singelBouns <= new Decimal(0))
                            {
                                this._response = this.JsonResult(0, "投注失败,返点错误,请重新投注!");
                                return;
                            }
                            UserBetModel userBetModel = new UserBetModel();
                            userBetModel.UserId      = int32_1;
                            userBetModel.UserMoney   = new Decimal(0);
                            userBetModel.LotteryId   = int32_2;
                            userBetModel.PlayId      = Convert.ToInt32(requestDataJsonzh2.playId);
                            userBetModel.PlayCode    = str4;
                            userBetModel.SingleMoney = Convert.ToDecimal(requestDataJsonzh2.price);
                            userBetModel.Num         = Convert.ToInt32(requestDataJsonzh2.Num);
                            userBetModel.Detail      = requestDataJsonzh2.balls;
                            userBetModel.Point       = Convert.ToDecimal(requestDataJsonzh2.Point);
                            userBetModel.Bonus       = singelBouns;
                            userBetModel.Pos         = requestDataJsonzh2.strPos;
                            userBetModel.STime2      = serverTime;
                            userBetModel.IsDelay     = 0;
                            userBetModel.ZHID        = 0;
                            for (int index2 = 0; index2 < requestDataJsonzh2.table2.Count; ++index2)
                            {
                                ajaxBetting.RequestDataJSONZH2 requestDataJsonzH2 = requestDataJsonzh2.table2[index2];
                                if (Convert.ToInt32(requestDataJsonzH2.ZHTimes) > 0 && Convert.ToDecimal(requestDataJsonzH2.ZHIssueNum.Replace("-", "")) >= Convert.ToDecimal(str1.Replace("-", "")))
                                {
                                    UserZhDetailModel userZhDetailModel = new UserZhDetailModel();
                                    userZhDetailModel.IssueNum = requestDataJsonzH2.ZHIssueNum;
                                    userZhDetailModel.Times    = Convert.ToInt32(requestDataJsonzH2.ZHTimes);
                                    userZhDetailModel.STime    = Convert.ToDateTime(requestDataJsonzH2.ZHSTime);
                                    userZhDetailModel.Lists.Add(userBetModel);
                                    money += userBetModel.SingleMoney * (Decimal)userBetModel.Num * (Decimal)userZhDetailModel.Times;
                                    listZh.Add(userZhDetailModel);
                                }
                            }
                        }
                        zhmodel.TotalSums = money;
                        if (listZh.Count > 0)
                        {
                            if (betDal.InsertZhBet(zhmodel, listZh, money, "手机追号") > 0)
                            {
                                this._response = this.JsonResult(1, "追号成功!请等待开奖!");
                            }
                            else
                            {
                                this._response = this.JsonResult(0, "对不起,投注失败!");
                            }
                        }
                        else
                        {
                            this._response = this.JsonResult(0, "对不起,投注失败!");
                        }
                    }
                }
                catch (Exception ex)
                {
                    this._response = this.JsonResult(0, "对不起,投注失败!");
                }
            }
        }