Esempio n. 1
0
        private void ajaxOper()
        {
            string betId    = base.f("ids");
            string response = new Lottery.DAL.Flex.UserBetDAL().BetCancel(betId);

            this._response = response;
        }
Esempio n. 2
0
        /// <summary>
        /// 检查投注时间
        /// </summary>
        private void ajaxCheckBetTime()
        {
            LotteryDAL lotDal = new LotteryDAL();

            FlexDAL.UserBetDAL betDal = new FlexDAL.UserBetDAL();
            string             id     = this.q("id"); //彩中编码
            int lotteryid             = 0;

            Int32.TryParse(id, out lotteryid);
            SysLotteryModel lottery = lotDal.GetSysLotteryById(lotteryid);

            if (betDal.CheckBetTime(lotteryid) == false)
            {
                this._response = this.JsonResult(0, string.Format("凌晨1点55分到上午10点, [{0}]暂停开奖", lottery.Title));
            }
            else
            {
                this._response = this.JsonResult(1, "有效开奖时间");
            }
        }
Esempio n. 3
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);
                }
            }
        }
Esempio n. 4
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();
                        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";
                            this.doh.AddConditionParameter("@Id", (object)requestDataJsonzh2.playId.ToString());
                            string str3 = string.Concat(this.doh.GetField("Sys_PlaySmallType", "Title2"));
                            if (Convert.ToDecimal(requestDataJsonzh2.price) < Decimal.Zero || Convert.ToDecimal(requestDataJsonzh2.Num) < Decimal.One || Convert.ToDecimal(requestDataJsonzh2.times) < Decimal.One)
                            {
                                this._response = this.JsonResult(0, "投注错误!请重新投注!");
                                return;
                            }
                            Decimal singelBouns = new Decimal();
                            string  str4        = Calculate.BetNumerice(int32_1, int32_2, requestDataJsonzh2.balls, requestDataJsonzh2.playId.ToString(), requestDataJsonzh2.strPos, Convert.ToInt32(requestDataJsonzh2.Num), Convert.ToDecimal(requestDataJsonzh2.Point), ref singelBouns);
                            if (!string.IsNullOrEmpty(str4))
                            {
                                this._response = str4.Replace("[", "").Replace("]", "");
                                return;
                            }
                            if (singelBouns <= Decimal.Zero)
                            {
                                this._response = this.JsonResult(0, "投注失败,返点错误,请重新投注!");
                                return;
                            }
                            UserBetModel userBetModel = new UserBetModel();
                            userBetModel.UserId      = int32_1;
                            userBetModel.UserMoney   = Decimal.Zero;
                            userBetModel.LotteryId   = int32_2;
                            userBetModel.PlayId      = Convert.ToInt32(requestDataJsonzh2.playId);
                            userBetModel.PlayCode    = str3;
                            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, "Web端追号") > 0)
                            {
                                this._response = this.JsonResult(1, "追号成功!请等待开奖!");
                            }
                            else
                            {
                                this._response = this.JsonResult(0, "对不起,投注失败!");
                            }
                        }
                        else
                        {
                            this._response = this.JsonResult(0, "对不起,投注失败!0");
                        }
                    }
                }
                catch (Exception ex)
                {
                    this._response = this.JsonResult(0, "对不起,投注失败!");
                }
            }
        }
        /// <summary>
        /// 将投注信息存放到到数据库
        /// </summary>
        /// <param name="model"></param>
        /// <param name="Source">来源:web端投注还是手机端</param>
        /// <returns></returns>
        public int InsertBet(FFModel.Account.UserBetModel model, string Source, DateTime STime, string userId, string playCode)
        {
            int logSysId = 0;

            using (SqlConnection sqlConnection = new SqlConnection(ComData.connectionString))
            {
                sqlConnection.Open();
                SqlCommand sqlCommand = new SqlCommand();
                sqlCommand.Connection = sqlConnection;
                try
                {
                    string   bet    = model.SsId;
                    DateTime STime2 = STime;

                    FlexDAL.UserBetDAL betDal         = new FlexDAL.UserBetDAL();
                    string[]           issueTimeAndSn = betDal.GetIssueTimeAndSN(model.LotteryId);
                    string             str1           = issueTimeAndSn[0];

                    Decimal Money = Convert.ToDecimal(model.SingelBouns * (Decimal)model.Num * model.Times);
                    if (new UserTotalTran().MoneyOpers(bet, userId, Money, model.LotteryId, model.PlayId, logSysId, 3, 99, string.Empty, string.Empty, "会员投注", "") <= 0)
                    {
                        return(0);
                    }
                    SqlParameter[] values = new SqlParameter[21]
                    {
                        new SqlParameter("@SsId", (object)bet),
                        new SqlParameter("@UserId", (object)userId),
                        //new SqlParameter("@UserMoney", (object) model.UserMoney),
                        new SqlParameter("@UserMoney", (object)0),
                        new SqlParameter("@LotteryId", (object)model.LotteryId),
                        new SqlParameter("@PlayId", (object)model.PlayId),
                        new SqlParameter("@IssueNum", (object)str1),
                        new SqlParameter("@SingleMoney", (object)model.Price),
                        new SqlParameter("@Num", (object)model.Num),
                        new SqlParameter("@Detail", (object)""),
                        new SqlParameter("@Total", (object)(model.Price * (Decimal)model.Num)),
                        new SqlParameter("@Point", (object)model.Point),
                        new SqlParameter("@PointMoney", (object)(model.Price * (Decimal)model.Num * model.Point / new Decimal(100))),
                        new SqlParameter("@Bonus", (object)model.SingelBouns),
                        new SqlParameter("@Pos", (object)model.StrPos),
                        new SqlParameter("@PlayCode", (object)playCode),
                        //new SqlParameter("@STime", (object) model.STime),
                        //new SqlParameter("@STime2", (object) model.STime2),
                        new SqlParameter("@STime", (object)STime),
                        new SqlParameter("@STime2", (object)STime2),
                        //new SqlParameter("@IsDelay", (object) model.IsDelay),
                        new SqlParameter("@IsDelay", (object)0),
                        new SqlParameter("@Times", (object)model.Times),
                        new SqlParameter("@ZhId", (object)"0"),
                        new SqlParameter("@Source", (object)Source)
                    };
                    sqlCommand.CommandText  = "insert into N_UserBet(SsId,UserId,UserMoney,LotteryId,PlayId,IssueNum,SingleMoney,Num,Detail,Total\r\n                                        ,Point,PointMoney,Bonus,Pos,PlayCode,STime,STime2,IsDelay,Times,ZhId,Source)\r\n                                        values(@SsId,@UserId,@UserMoney,@LotteryId,@PlayId,@IssueNum,@SingleMoney,@Num,@Detail,@Total\r\n                                        ,@Point,@PointMoney,@Bonus,@Pos,@PlayCode,@STime,@STime2,@IsDelay,@Times,@ZhId,@Source)";
                    sqlCommand.CommandText += " SELECT SCOPE_IDENTITY()";
                    sqlCommand.Parameters.AddRange(values);
                    logSysId = Convert.ToInt32(sqlCommand.ExecuteScalar());
                    sqlCommand.Parameters.Clear();
                    BetDetailDAL.SetBetDetail(STime2.ToString("yyyyMMdd"), userId, logSysId.ToString(), model.Balls.Replace("|", "#"));
                }
                catch (Exception ex)
                {
                    new LogExceptionDAL().Save("系统异常", ex.Message);
                    logSysId = 0;
                }
            }
            return(logSysId);
        }
        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, "对不起,投注失败!");
                }
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="model"></param>
        /// <param name="Source"></param>
        /// <returns></returns>
        public int InsertBetZH(FFModel.Account.UserBetModel model, string Source, DateTime STime, string userId, string playCode)
        {
            int      logSysId = 0;
            int      num1     = 0;
            DateTime STime2   = STime;

            FlexDAL.UserBetDAL betDal         = new FlexDAL.UserBetDAL();
            string[]           issueTimeAndSn = betDal.GetIssueTimeAndSN(model.LotteryId);
            string             issueNum       = issueTimeAndSn[0];

            using (SqlConnection sqlConnection = new SqlConnection(ComData.connectionString))
            {
                sqlConnection.Open();
                SqlCommand sqlCommand = new SqlCommand();
                sqlCommand.Connection = sqlConnection;
                try
                {
                    string str1 = "";
                    string str2 = "";
                    string str3 = "";
                    if (playCode == "P_5ZH")
                    {
                        str1 = "P_5ZH_WQBSG,P_5ZH_QBSG,P_5ZH_BSG,P_5ZH_SG,P_5ZH_G";
                        str2 = "1,10,100,1000,10000";
                        string[] strArray = model.Balls.Replace("_", "").Split(',');
                        int      num2     = 1;
                        int      num3     = 1;
                        int      num4     = 1;
                        int      num5     = 1;
                        int      num6     = 1;
                        for (int index = 0; index < strArray.Length; ++index)
                        {
                            num2 *= strArray[index].Length;
                        }
                        for (int index = 1; index < strArray.Length; ++index)
                        {
                            num3 *= strArray[index].Length;
                        }
                        for (int index = 2; index < strArray.Length; ++index)
                        {
                            num4 *= strArray[index].Length;
                        }
                        for (int index = 3; index < strArray.Length; ++index)
                        {
                            num5 *= strArray[index].Length;
                        }
                        for (int index = 4; index < strArray.Length; ++index)
                        {
                            num6 *= strArray[index].Length;
                        }
                        str3 = num2.ToString() + "," + (object)num3 + "," + (object)num4 + "," + (object)num5 + "," + (object)num6;
                    }
                    if (playCode == "P_4ZH_L")
                    {
                        str1 = "P_4ZH_L_WQBS,P_4ZH_L_QBS,P_4ZH_L_BS,P_4ZH_L_S";
                        str2 = "1,10,100,1000";
                        string[] strArray = model.Balls.Replace("_", "").Split(',');
                        int      num2     = 1;
                        int      num3     = 1;
                        int      num4     = 1;
                        int      num5     = 1;
                        for (int index = 0; index < strArray.Length; ++index)
                        {
                            num2 *= strArray[index].Length;
                        }
                        for (int index = 1; index < strArray.Length; ++index)
                        {
                            num3 *= strArray[index].Length;
                        }
                        for (int index = 2; index < strArray.Length; ++index)
                        {
                            num4 *= strArray[index].Length;
                        }
                        for (int index = 3; index < strArray.Length; ++index)
                        {
                            num5 *= strArray[index].Length;
                        }
                        str3 = num2.ToString() + "," + (object)num3 + "," + (object)num4 + "," + (object)num5;
                    }
                    if (playCode == "P_4ZH_R")
                    {
                        str1 = "P_4ZH_R_QBSG,P_4ZH_R_BSG,P_4ZH_R_SG,P_4ZH_R_G";
                        str2 = "1,10,100,1000";
                        string[] strArray = model.Balls.Replace("_", "").Split(',');
                        int      num2     = 1;
                        int      num3     = 1;
                        int      num4     = 1;
                        int      num5     = 1;
                        for (int index = 0; index < strArray.Length; ++index)
                        {
                            num2 *= strArray[index].Length;
                        }
                        for (int index = 1; index < strArray.Length; ++index)
                        {
                            num3 *= strArray[index].Length;
                        }
                        for (int index = 2; index < strArray.Length; ++index)
                        {
                            num4 *= strArray[index].Length;
                        }
                        for (int index = 3; index < strArray.Length; ++index)
                        {
                            num5 *= strArray[index].Length;
                        }
                        str3 = num2.ToString() + "," + (object)num3 + "," + (object)num4 + "," + (object)num5;
                    }
                    if (playCode == "P_3ZH_L")
                    {
                        str1 = "P_3ZH_L_WQB,P_3ZH_L_QB,P_3ZH_L_B";
                        str2 = "1,10,100";
                        string[] strArray = model.Balls.Replace("_", "").Split(',');
                        int      num2     = 1;
                        int      num3     = 1;
                        int      num4     = 1;
                        for (int index = 0; index < strArray.Length; ++index)
                        {
                            num2 *= strArray[index].Length;
                        }
                        for (int index = 1; index < strArray.Length; ++index)
                        {
                            num3 *= strArray[index].Length;
                        }
                        for (int index = 2; index < strArray.Length; ++index)
                        {
                            num4 *= strArray[index].Length;
                        }
                        str3 = num2.ToString() + "," + (object)num3 + "," + (object)num4;
                    }
                    if (playCode == "P_3ZH_C")
                    {
                        str1 = "P_3ZH_C_QBS,P_3ZH_C_BS,P_3ZH_C_S";
                        str2 = "1,10,100";
                        string[] strArray = model.Balls.Replace("_", "").Split(',');
                        int      num2     = 1;
                        int      num3     = 1;
                        int      num4     = 1;
                        for (int index = 0; index < strArray.Length; ++index)
                        {
                            num2 *= strArray[index].Length;
                        }
                        for (int index = 1; index < strArray.Length; ++index)
                        {
                            num3 *= strArray[index].Length;
                        }
                        for (int index = 2; index < strArray.Length; ++index)
                        {
                            num4 *= strArray[index].Length;
                        }
                        str3 = num2.ToString() + "," + (object)num3 + "," + (object)num4;
                    }
                    if (playCode == "P_3ZH_R")
                    {
                        str1 = "P_3ZH_R_BSG,P_3ZH_R_SG,P_3ZH_R_G";
                        str2 = "1,10,100";
                        string[] strArray = model.Balls.Replace("_", "").Split(',');
                        int      num2     = 1;
                        int      num3     = 1;
                        int      num4     = 1;
                        for (int index = 0; index < strArray.Length; ++index)
                        {
                            num2 *= strArray[index].Length;
                        }
                        for (int index = 1; index < strArray.Length; ++index)
                        {
                            num3 *= strArray[index].Length;
                        }
                        for (int index = 2; index < strArray.Length; ++index)
                        {
                            num4 *= strArray[index].Length;
                        }
                        str3 = num2.ToString() + "," + (object)num3 + "," + (object)num4;
                    }
                    string[] strArray1 = str1.Split(',');
                    string[] strArray2 = str2.Split(',');
                    string[] strArray3 = str3.Split(',');
                    for (int index = 0; index < strArray1.Length; ++index)
                    {
                        if (Convert.ToInt32(strArray3[index]) > 0)
                        {
                            string  bet   = model.SsId;
                            Decimal Money = Convert.ToDecimal(model.Price * (Decimal)Convert.ToInt32(strArray3[index]) * model.Times);
                            if (new UserTotalTran().MoneyOpers(bet, userId, Money, model.LotteryId, model.PlayId, logSysId, 3, 99, string.Empty, string.Empty, "会员投注", "") > 0)
                            {
                                SqlParameter[] values = new SqlParameter[21]
                                {
                                    new SqlParameter("@SsId", (object)bet),
                                    new SqlParameter("@UserId", (object)userId),
                                    //new SqlParameter("@UserMoney", (object) model.UserMoney),
                                    new SqlParameter("@UserMoney", (object)0),
                                    new SqlParameter("@LotteryId", (object)model.LotteryId),
                                    new SqlParameter("@PlayId", (object)model.PlayId),
                                    new SqlParameter("@IssueNum", (object)issueNum),
                                    new SqlParameter("@SingleMoney", (object)model.Price),
                                    new SqlParameter("@Num", (object)Convert.ToInt32(strArray3[index])),
                                    new SqlParameter("@Detail", (object)""),
                                    new SqlParameter("@Total", (object)(model.Price * (Decimal)Convert.ToInt32(strArray3[index]))),
                                    new SqlParameter("@Point", (object)model.Point),
                                    new SqlParameter("@PointMoney", (object)(model.Price * (Decimal)Convert.ToInt32(strArray3[index]) * model.Point / new Decimal(100))),
                                    new SqlParameter("@Bonus", (object)(model.SingelBouns / (Decimal)Convert.ToInt32(strArray2[index]))),
                                    new SqlParameter("@Pos", (object)""),
                                    new SqlParameter("@PlayCode", (object)strArray1[index]),
                                    new SqlParameter("@STime", (object)STime),
                                    new SqlParameter("@STime2", (object)STime2),
                                    //new SqlParameter("@IsDelay", (object) model.IsDelay),
                                    new SqlParameter("@IsDelay", (object)0),
                                    new SqlParameter("@Times", (object)model.Times),
                                    new SqlParameter("@ZhId", (object)"0"),
                                    new SqlParameter("@Source", (object)Source)
                                };
                                sqlCommand.CommandText  = "insert into N_UserBet(SsId,UserId,UserMoney,LotteryId,PlayId,IssueNum,SingleMoney,Num,Detail,Total\r\n                                        ,Point,PointMoney,Bonus,Pos,PlayCode,STime,STime2,IsDelay,Times,ZhId,Source)\r\n                                        values(@SsId,@UserId,@UserMoney,@LotteryId,@PlayId,@IssueNum,@SingleMoney,@Num,@Detail,@Total\r\n                                        ,@Point,@PointMoney,@Bonus,@Pos,@PlayCode,@STime,@STime2,@IsDelay,@Times,@ZhId,@Source)";
                                sqlCommand.CommandText += " SELECT SCOPE_IDENTITY()";
                                sqlCommand.Parameters.AddRange(values);
                                logSysId = Convert.ToInt32(sqlCommand.ExecuteScalar());
                                sqlCommand.Parameters.Clear();
                                ++num1;
                                BetDetailDAL.SetBetDetail(STime2.ToString("yyyyMMdd"), userId.ToString(), logSysId.ToString(), model.Balls.Replace("|", "#"));
                            }
                        }
                    }
                    logSysId = num1 <= 0 ? 0 : 1;
                }
                catch (Exception ex)
                {
                    new LogExceptionDAL().Save("系统异常", ex.Message);
                    logSysId = 0;
                }
            }
            return(logSysId);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="model"></param>
        /// <param name="Source"></param>
        /// <returns></returns>
        public int InsertBetPos(FFModel.Account.UserBetModel model, string Source, DateTime STime, string userId, string playCode)
        {
            int      logSysId = 0;
            int      num      = 0;
            DateTime STime2   = STime;

            FlexDAL.UserBetDAL betDal         = new FlexDAL.UserBetDAL();
            string[]           issueTimeAndSn = betDal.GetIssueTimeAndSN(model.LotteryId);
            string             issueNum       = issueTimeAndSn[0];

            using (SqlConnection sqlConnection = new SqlConnection(ComData.connectionString))
            {
                sqlConnection.Open();
                SqlCommand sqlCommand = new SqlCommand();
                sqlCommand.Connection = sqlConnection;
                try
                {
                    string   str1      = "";
                    string[] strArray1 = model.StrPos.Split(',');
                    string   str2      = playCode + "_";
                    switch (playCode)
                    {
                    case "R_4FS":
                    case "R_4DS":
                    case "R_4ZX24":
                    case "R_4ZX12":
                    case "R_4ZX6":
                    case "R_4ZX4":
                        if (model.StrPos != "")
                        {
                            int count = Regex.Matches(model.StrPos, "1").Count;
                            if (count == 4)
                            {
                                str1 = str1 + str2 + (strArray1[0].Equals("1") ? "W" : "") + (strArray1[1].Equals("1") ? "Q" : "") + (strArray1[2].Equals("1") ? "B" : "") + (strArray1[3].Equals("1") ? "S" : "") + (strArray1[4].Equals("1") ? "G" : "") + ",";
                            }
                            if (count == 5)
                            {
                                string[] strArray2 = "W,Q,B,S,G".Split(',');
                                for (int index1 = 0; index1 < strArray2.Length; ++index1)
                                {
                                    for (int index2 = index1 + 1; index2 < strArray2.Length; ++index2)
                                    {
                                        for (int index3 = index2 + 1; index3 < strArray2.Length; ++index3)
                                        {
                                            for (int index4 = index3 + 1; index4 < strArray2.Length; ++index4)
                                            {
                                                str1 = str1 + str2 + strArray2[index1] + strArray2[index2] + strArray2[index3] + strArray2[index4] + ",";
                                            }
                                        }
                                    }
                                }
                                break;
                            }
                            break;
                        }
                        break;

                    case "R_3FS":
                    case "R_3DS":
                    case "R_3Z3":
                    case "R_3Z6":
                    case "R_3HX":
                    case "R_3HE":
                    case "R_3ZHE":
                    case "R_3KD":
                    case "R_3ZBD":
                    case "R_3QTWS":
                    case "R_3QTTS":
                    case "R_3Z3DS":
                    case "R_3Z6DS":
                        if (model.StrPos != "")
                        {
                            int count = Regex.Matches(model.StrPos, "1").Count;
                            if (count == 3)
                            {
                                str1 = str1 + str2 + (strArray1[0].Equals("1") ? "W" : "") + (strArray1[1].Equals("1") ? "Q" : "") + (strArray1[2].Equals("1") ? "B" : "") + (strArray1[3].Equals("1") ? "S" : "") + (strArray1[4].Equals("1") ? "G" : "") + ",";
                            }
                            if (count >= 4)
                            {
                                string   str3      = "" + (strArray1[0].Equals("1") ? "W," : "") + (strArray1[1].Equals("1") ? "Q," : "") + (strArray1[2].Equals("1") ? "B," : "") + (strArray1[3].Equals("1") ? "S," : "") + (strArray1[4].Equals("1") ? "G," : "");
                                string[] strArray2 = str3.Substring(0, str3.Length - 1).Split(',');
                                for (int index1 = 0; index1 < strArray2.Length; ++index1)
                                {
                                    for (int index2 = index1 + 1; index2 < strArray2.Length; ++index2)
                                    {
                                        for (int index3 = index2 + 1; index3 < strArray2.Length; ++index3)
                                        {
                                            str1 = str1 + str2 + strArray2[index1] + strArray2[index2] + strArray2[index3] + ",";
                                        }
                                    }
                                }
                                break;
                            }
                            break;
                        }
                        break;

                    case "R_2FS":
                    case "R_2DS":
                    case "R_2Z2":
                    case "R_2HE":
                    case "R_2ZHE":
                    case "R_2ZDS":
                    case "R_2KD":
                    case "R_2ZBD":
                        if (model.StrPos != "")
                        {
                            int count = Regex.Matches(model.StrPos, "1").Count;
                            if (count == 2)
                            {
                                str1 = str1 + str2 + (strArray1[0].Equals("1") ? "W" : "") + (strArray1[1].Equals("1") ? "Q" : "") + (strArray1[2].Equals("1") ? "B" : "") + (strArray1[3].Equals("1") ? "S" : "") + (strArray1[4].Equals("1") ? "G" : "") + ",";
                            }
                            if (count >= 3)
                            {
                                string   str3      = "" + (strArray1[0].Equals("1") ? "W," : "") + (strArray1[1].Equals("1") ? "Q," : "") + (strArray1[2].Equals("1") ? "B," : "") + (strArray1[3].Equals("1") ? "S," : "") + (strArray1[4].Equals("1") ? "G," : "");
                                string[] strArray2 = str3.Substring(0, str3.Length - 1).Split(',');
                                for (int index1 = 0; index1 < strArray2.Length; ++index1)
                                {
                                    for (int index2 = index1 + 1; index2 < strArray2.Length; ++index2)
                                    {
                                        str1 = str1 + str2 + strArray2[index1] + strArray2[index2] + ",";
                                    }
                                }
                                break;
                            }
                            break;
                        }
                        break;
                    }
                    string[] strArray3 = str1.Substring(0, str1.Length - 1).Split(',');
                    for (int index = 0; index < strArray3.Length; ++index)
                    {
                        string  bet   = model.SsId;
                        Decimal Money = Convert.ToDecimal(model.Price * (Decimal)model.Num * model.Times / (Decimal)strArray3.Length);
                        if (new UserTotalTran().MoneyOpers(bet, userId, Money, model.LotteryId, model.PlayId, logSysId, 3, 99, string.Empty, string.Empty, "会员投注", "") > 0)
                        {
                            SqlParameter[] values = new SqlParameter[21]
                            {
                                new SqlParameter("@SsId", (object)bet),
                                new SqlParameter("@UserId", (object)userId),
                                //new SqlParameter("@UserMoney", (object) model.UserMoney),
                                new SqlParameter("@UserMoney", (object)0),
                                new SqlParameter("@LotteryId", (object)model.LotteryId),
                                new SqlParameter("@PlayId", (object)model.PlayId),
                                new SqlParameter("@IssueNum", (object)issueNum),
                                new SqlParameter("@SingleMoney", (object)model.Price),
                                new SqlParameter("@Num", (object)(model.Num / strArray3.Length)),
                                new SqlParameter("@Detail", (object)""),
                                new SqlParameter("@Total", (object)(model.Price * (Decimal)model.Num / (Decimal)strArray3.Length)),
                                new SqlParameter("@Point", (object)model.Point),
                                new SqlParameter("@PointMoney", (object)(model.Price * (Decimal)model.Num * model.Point / (Decimal)strArray3.Length / new Decimal(100))),
                                new SqlParameter("@Bonus", (object)model.SingelBouns),
                                new SqlParameter("@Pos", (object)""),
                                new SqlParameter("@PlayCode", (object)strArray3[index]),
                                new SqlParameter("@STime", (object)STime),
                                new SqlParameter("@STime2", (object)STime2),
                                //new SqlParameter("@IsDelay", (object) model.IsDelay),
                                new SqlParameter("@IsDelay", (object)0),
                                new SqlParameter("@Times", (object)model.Times),
                                new SqlParameter("@ZhId", (object)"0"),
                                new SqlParameter("@Source", (object)Source)
                            };
                            sqlCommand.CommandText  = "insert into N_UserBet(SsId,UserId,UserMoney,LotteryId,PlayId,IssueNum,SingleMoney,Num,Detail,Total\r\n                                        ,Point,PointMoney,Bonus,Pos,PlayCode,STime,STime2,IsDelay,Times,ZhId,Source)\r\n                                        values(@SsId,@UserId,@UserMoney,@LotteryId,@PlayId,@IssueNum,@SingleMoney,@Num,@Detail,@Total\r\n                                        ,@Point,@PointMoney,@Bonus,@Pos,@PlayCode,@STime,@STime2,@IsDelay,@Times,@ZhId,@Source)";
                            sqlCommand.CommandText += " SELECT SCOPE_IDENTITY()";
                            sqlCommand.Parameters.AddRange(values);
                            logSysId = Convert.ToInt32(sqlCommand.ExecuteScalar());
                            sqlCommand.Parameters.Clear();
                            ++num;
                            BetDetailDAL.SetBetDetail(STime2.ToString("yyyyMMdd"), userId, logSysId.ToString(), model.Balls.Replace("|", "#"));
                        }
                    }
                    logSysId = num < strArray3.Length ? 0 : 1;
                }
                catch (Exception ex)
                {
                    new LogExceptionDAL().Save("系统异常", ex.Message);
                    logSysId = 0;
                }
            }
            return(logSysId);
        }
Esempio n. 9
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);
         try
         {
             string[] issueTimeAndSn = new Lottery.DAL.Flex.UserBetDAL().GetIssueTimeAndSN(int32_2);
             string   str1           = issueTimeAndSn[0];
             DateTime dateTime       = Convert.ToDateTime(issueTimeAndSn[1]);
             DateTime serverTime     = PublicDAL.GetServerTime();
             string   str2           = new Lottery.DAL.Flex.UserBetDAL().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 (new Lottery.DAL.Flex.UserBetDAL().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, "对不起,投注失败!");
         }
     }
 }
Esempio n. 10
0
 private void ajaxZHBetting()
 {
     if (this.AdminId == "")
     {
         this._response = base.JsonResult(0, "投注失败,请重新登录后再进行投注!");
     }
     else
     {
         HttpContext.Current.Response.ContentType = "application/json";
         HttpRequest  request      = HttpContext.Current.Request;
         StreamReader streamReader = new StreamReader(request.InputStream);
         string       str          = streamReader.ReadToEnd();
         string       jsonText     = "[" + str + "]";
         List <ajaxBetting.RequestDataJSONZH> list = ajaxBetting.JSONToObject <List <ajaxBetting.RequestDataJSONZH> >(jsonText);
         ajaxBetting.RequestDataJSONZH        requestDataJSONZH = new ajaxBetting.RequestDataJSONZH();
         int     userId    = Convert.ToInt32(this.AdminId);
         int     lotteryId = Convert.ToInt32(list[0].lotteryId);
         int     isStop    = Convert.ToInt32(list[0].IsStop);
         int     totalNums = Convert.ToInt32(list[0].ZHNums);
         decimal num       = Convert.ToDecimal(list[0].ZHSums);
         try
         {
             string[] issueTimeAndSN = new Lottery.DAL.Flex.UserBetDAL().GetIssueTimeAndSN(lotteryId);
             string   text           = issueTimeAndSN[0];
             DateTime sTime          = Convert.ToDateTime(issueTimeAndSN[1]);
             DateTime serverTime     = PublicDAL.GetServerTime();
             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
             {
                 num = 0m;
                 UserZhBetModel userZhBetModel = new UserZhBetModel();
                 userZhBetModel.UserId        = userId;
                 userZhBetModel.LotteryId     = lotteryId;
                 userZhBetModel.PlayId        = 0;
                 userZhBetModel.StartIssueNum = text;
                 userZhBetModel.TotalNums     = totalNums;
                 userZhBetModel.IsStop        = isStop;
                 userZhBetModel.STime         = DateTime.Now;
                 List <UserBetModel>      list2 = new List <UserBetModel>();
                 List <UserZhDetailModel> list3 = new List <UserZhDetailModel>();
                 for (int i = 0; i < list.Count; i++)
                 {
                     requestDataJSONZH = list[i];
                     this.doh.Reset();
                     this.doh.ConditionExpress = "Id=@Id";
                     this.doh.AddConditionParameter("@Id", requestDataJSONZH.playId.ToString());
                     string playCode = string.Concat(this.doh.GetField("Sys_PlaySmallType", "Title2"));
                     if (Convert.ToDecimal(requestDataJSONZH.price) < 0m || Convert.ToDecimal(requestDataJSONZH.Num) < 1m || Convert.ToDecimal(requestDataJSONZH.times) < 1m)
                     {
                         this._response = base.JsonResult(0, "投注错误!请重新投注!");
                         return;
                     }
                     decimal num2  = 0m;
                     string  text3 = Calculate.BetNumerice(userId, lotteryId, requestDataJSONZH.balls, requestDataJSONZH.playId.ToString(), requestDataJSONZH.strPos, Convert.ToInt32(requestDataJSONZH.Num), Convert.ToDecimal(requestDataJSONZH.Point), ref num2);
                     if (!string.IsNullOrEmpty(text3))
                     {
                         this._response = text3;
                         return;
                     }
                     if (num2 <= 0m)
                     {
                         this._response = base.JsonResult(0, "投注失败,返点错误,请重新投注!");
                         return;
                     }
                     UserBetModel userBetModel = new UserBetModel();
                     userBetModel.UserId      = userId;
                     userBetModel.UserMoney   = 0m;
                     userBetModel.LotteryId   = lotteryId;
                     userBetModel.PlayId      = Convert.ToInt32(requestDataJSONZH.playId);
                     userBetModel.PlayCode    = playCode;
                     userBetModel.SingleMoney = Convert.ToDecimal(requestDataJSONZH.price);
                     userBetModel.Num         = Convert.ToInt32(requestDataJSONZH.Num);
                     userBetModel.Detail      = requestDataJSONZH.balls;
                     userBetModel.Point       = Convert.ToDecimal(requestDataJSONZH.Point);
                     userBetModel.Bonus       = num2;
                     userBetModel.Pos         = requestDataJSONZH.strPos;
                     userBetModel.STime2      = serverTime;
                     userBetModel.IsDelay     = 0;
                     userBetModel.ZHID        = 0;
                     for (int j = 0; j < requestDataJSONZH.table2.Count; j++)
                     {
                         ajaxBetting.RequestDataJSONZH2 requestDataJSONZH2 = requestDataJSONZH.table2[j];
                         if (Convert.ToInt32(requestDataJSONZH2.ZHTimes) > 0 && Convert.ToDecimal(requestDataJSONZH2.ZHIssueNum.Replace("-", "")) >= Convert.ToDecimal(text.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);
                             num += userBetModel.SingleMoney * userBetModel.Num * userZhDetailModel.Times;
                             list3.Add(userZhDetailModel);
                         }
                     }
                 }
                 userZhBetModel.TotalSums = num;
                 if (list3.Count > 0)
                 {
                     int num3 = new Lottery.DAL.Flex.UserBetDAL().InsertZhBet(userZhBetModel, list3, num, "手机追号");
                     if (num3 > 0)
                     {
                         this._response = base.JsonResult(1, "追号成功!请等待开奖!");
                     }
                     else
                     {
                         this._response = base.JsonResult(0, "对不起,投注失败!");
                     }
                 }
                 else
                 {
                     this._response = base.JsonResult(0, "对不起,投注失败!");
                 }
             }
         }
         catch
         {
             this._response = base.JsonResult(0, "对不起,投注失败!");
         }
     }
 }
Esempio n. 11
0
 private void ajaxBetting2()
 {
     if (this.AdminId == "")
     {
         this._response = base.JsonResult(0, "投注失败,请重新登录后再进行投注!");
     }
     else if (this.site.BetIsOpen == 1)
     {
         this._response = base.JsonResult(0, "系统正在维护,不能投注!");
     }
     else
     {
         HttpContext.Current.Response.ContentType = "application/json";
         HttpRequest  request      = HttpContext.Current.Request;
         StreamReader streamReader = new StreamReader(request.InputStream);
         string       str          = streamReader.ReadToEnd();
         string       jsonText     = HttpUtility.UrlDecode(str);
         List <ajaxBetting.RequestDataJSON> list            = ajaxBetting.JSONToObject <List <ajaxBetting.RequestDataJSON> >(jsonText);
         ajaxBetting.RequestDataJSON        requestDataJSON = new ajaxBetting.RequestDataJSON();
         int     lotteryId = list[0].lotteryId;
         int     userId    = Convert.ToInt32(this.AdminId);
         decimal num       = 0m;
         try
         {
             string[] issueTimeAndSN = new Lottery.DAL.Flex.UserBetDAL().GetIssueTimeAndSN(lotteryId);
             string   text           = issueTimeAndSN[0];
             DateTime sTime          = Convert.ToDateTime(issueTimeAndSN[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 i = 0; i < list.Count; i++)
                 {
                     requestDataJSON = list[i];
                     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) < 0m || Convert.ToDecimal(requestDataJSON.Num) < 1m || Convert.ToDecimal(requestDataJSON.times) < 1m)
                         {
                             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 <= 0m)
                         {
                             this._response = base.JsonResult(0, "投注失败,返点错误,请重新投注!");
                             return;
                         }
                     }
                     UserBetModel userBetModel = new UserBetModel();
                     userBetModel.UserId      = userId;
                     userBetModel.UserMoney   = 0m;
                     userBetModel.LotteryId   = lotteryId;
                     userBetModel.PlayId      = Convert.ToInt32(requestDataJSON.playId);
                     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, "手机端");
                         }
                         else
                         {
                             num2 = new Lottery.DAL.Flex.UserBetDAL().InsertBet(userBetModel, "手机端");
                         }
                     }
                     else
                     {
                         num2 = new Lottery.DAL.Flex.UserBetDAL().InsertBetPos(userBetModel, "手机端");
                     }
                 }
                 if (num2 > 0)
                 {
                     this._response = base.JsonResult(1, "第" + text + "期投注成功,请期待开奖!");
                 }
                 else
                 {
                     this._response = base.JsonResult(0, "对不起,投注失败!");
                 }
             }
         }
         catch
         {
             this._response = base.JsonResult(0, "对不起,投注失败!");
         }
     }
 }