/// <summary>
        /// 创建方法对应的默认参数
        /// </summary>
        /// <returns></returns>
        public static int InsertHSCCRatingParam(int ldid, int ccid)
        {
            int result = -1;

            if (ldid != 0)
            {
                try
                {
                    #region 清空参数数据
                    string sql_del = "delete from L_InitialConstant_Trials where RatingID in(" + ldid + ");delete from L_GreenAmpt_Trials where  RatingID in(" + ldid + ");delete from L_SCSCurveNumber_Trials where RatingID in(" + ldid + ");delete from L_SoilMoistureAcco_Trials where RatingID in(" + ldid + "); delete from T_ClarkUnit_Trials where RatingID in(" + ldid + ");delete from T_SCSUnit_Trials where RatingID in(" + ldid + ");delete from C_SimpleCanopy_Trials where RatingID in(" + ldid + ");delete from S_SimpleSurface_Trials where RatingID in(" + ldid + ");delete from B_LinearReservoir_Trials where RatingID in(" + ldid + ");";
                    PublicDAL.ExecuteSql(sql_del);
                    #endregion
                    #region 根据洪水场次查询 流域使用方法


                    result = InsertRatingParamData(ccid, ldid, result);

                    #endregion
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                finally
                {
                }
            }
            return(result);
        }
        /// <summary>
        /// 删除率定设定,根据率定ID删除
        /// </summary>
        /// <param name="ratingid"></param>
        /// <returns></returns>
        public static int DelHSLD(string ratingid)
        {
            int result;

            try
            {
                string del_sql = "delete from hsjsld where id='" + ratingid + @"';
                                  delete from L_GreenAmpt_Trials where RatingID='" + ratingid + @"';
                                  delete from L_InitialConstant_Trials where RatingID='" + ratingid + @"';
                                  delete from L_SCSCurveNumber_Trials where RatingID='" + ratingid + @"';
                                  delete from L_SoilMoistureAcco_Trials where RatingID='" + ratingid + @"';
                                  delete from T_ClarkUnit_Trials where RatingID='" + ratingid + @"';
                                  delete from T_SCSUnit_Trials where RatingID='" + ratingid + @"'; 
                                  delete from C_SimpleCanopy_Trials where RatingID='" + ratingid + @"'; 
                                  delete from S_SimpleSurface_Trials where RatingID='" + ratingid + @"'; 
                                  delete from B_LinearReservoir_Trials where RatingID='" + ratingid + @"';   
                                  delete from R_KinematicWave_Trials where RatingID='" + ratingid + @"';
                                  delete from R_Lag_Trials where RatingID='" + ratingid + @"';
                                  delete from R_Muskingum_Trials where RatingID='" + ratingid + @"'";

                result = PublicDAL.ExecuteSql(del_sql);
            }
            catch (Exception ex)
            {
                result = 0;
                throw ex;
            }
            return(result);
        }
        /// <summary>
        /// 创建河道默认使用参数
        /// </summary>
        /// <returns></returns>
        public static int InsertHSCCRivlParam(int ldid, int ccid)
        {
            int result = -1;

            if (ldid != 0)
            {
                try
                {
                    string sql_del = "delete from R_KinematicWave_Trials where RatingID='" + ldid + "';delete from R_Muskingum_Trials where RatingID='" + ldid + "';delete from R_Lag_Trials where RatingID='" + ldid + "';";
                    PublicDAL.ExecuteSql(sql_del);

                    result = InsertRivParamlData(ldid, ccid, result);
                }

                catch (Exception ex)
                {
                    throw ex;
                }
                finally
                {
                    PublicDAL.RollbackTransaction();
                }
            }
            return(result);
        }
        /// <summary>
        /// 判断率定项是否已经存在
        /// </summary>
        /// <returns></returns>
        public static bool IsHaveLD(string name)
        {
            bool      result = false;
            string    sql    = "select name from hsjsld where name='" + name + "'";
            DataTable dt     = PublicDAL.GetData(sql);

            if (dt.Rows.Count > 0)
            {
                result = true;
            }
            return(result);
        }
        //}
        /// <summary>
        /// 更新河道使用参数
        /// </summary>
        /// <returns></returns>
        public static int InsertRivParamlData(int ldid, int ccid, int result)
        {
            string insert_routing = "";

            //运动波,
            insert_routing += "insert into R_KinematicWave_Trials(TrialsID,RatingID,manning,Min_manning,Max_manning) select hmid," + ldid + ",manning,0.0001000,1.0000000 from R_KinematicWave where ccid='" + ccid + "';";
            //马斯京根
            insert_routing += "insert into R_Muskingum_Trials(TrialsID,RatingID,muskingumk,subreaches,muskingumx,Min_muskingumk,Max_muskingumk,Min_subreaches,Max_subreaches,Min_muskingumx,Max_muskingumx) select hmid," + ldid + ",muskingumk,subreaches,muskingumx,0.001,150.0000,1,100,0.001,0.5000 from R_Muskingum where ccid='" + ccid + "';";

            //滞后演算
            insert_routing += "insert into R_Lag_Trials(TrialsID,RatingID,lagtime,Min_lagtime,Max_lagtime) select hmid," + ldid + ",lagtime,0.001,30000.0000 from R_Lag where ccid='" + ccid + "';";


            result += PublicDAL.ExecuteSql(insert_routing);


            return(result);
        }
        public static int UpdateLDCC(HSJSLD hsld)
        {
            int result = 0;

            try
            {
                string sql = "update HSJSLD set name='" + hsld.Name + "',hscc='" + hsld.HSCC + "',starttime='" + hsld.StartTime + "',endtime='" + hsld.EndTime + "',AllowError='" + hsld.AllowError + "',MaxIteration='" + hsld.MaxIteration + "',timeinterval='" + hsld.TimeInterval + "',ylinterval='" + hsld.YLInterval + "',llinterval='" + hsld.LLInterval + "',localtion='" + hsld.Localtion + "' where id=" + hsld.ID + "";

                result = PublicDAL.ExecuteSql(sql);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                PublicDAL.RollbackTransaction();
            }

            return(result);
        }
예제 #7
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;
         int     int32     = Convert.ToInt32(this.AdminId);
         Decimal num1      = new Decimal();
         try
         {
             string[] issueTimeAndSn = new Lottery.DAL.Flex.UserBetDAL().GetIssueTimeAndSN(lotteryId);
             string   str1           = issueTimeAndSn[0];
             DateTime dateTime       = Convert.ToDateTime(issueTimeAndSn[1]);
             DateTime serverTime     = 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 = new Lottery.DAL.Flex.UserBetDAL().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("") ? new Lottery.DAL.Flex.UserBetDAL().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")) ? new Lottery.DAL.Flex.UserBetDAL().InsertBetZH(model, "Web端") : new Lottery.DAL.Flex.UserBetDAL().InsertBet(model, "Web端"));
                 }
                 if (num2 > 0)
                 {
                     this._response = this.JsonResult(1, "第" + str1 + "期投注成功,请期待开奖!");
                 }
                 else
                 {
                     this._response = this.JsonResult(0, "对不起,投注失败!");
                 }
             }
         }
         catch (Exception ex)
         {
             this._response = this.JsonResult(0, "对不起,投注失败!" + (object)ex);
         }
     }
 }
예제 #8
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();
                 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 (new Lottery.DAL.Flex.UserBetDAL().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, "对不起,投注失败!");
         }
     }
 }
예제 #9
0
 public static string appsecret()
 {
     return(PublicDAL.Appsecret());
 }
예제 #10
0
 public static string appid()
 {
     return(PublicDAL.Appid());
 }
예제 #11
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, "对不起,投注失败!");
         }
     }
 }
예제 #12
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, "对不起,投注失败!");
         }
     }
 }
        /// <summary>
        /// 插入参数数据
        /// </summary>
        /// <param name="ccid"></param>
        /// <param name="result"></param>
        /// <param name="dt_hsccwata"></param>
        /// <returns></returns>
        private static int InsertRatingParamData(int ccid, int ldid, int result)
        {
            #region 写入植被截留参数(canopy)
            string sql_canopy = "";

            sql_canopy = "insert into C_SimpleCanopy_Trials(TrialsID,RatingID,InitialStroage,Max_InitialStroage,Min_InitialStroage,MaxStroage,Max_MaxStroage,Min_MaxStroage) select hmid," + ldid + ",InitialStroage,100.00,0.001,MaxStroage,1500.0000,0.0010 from C_SimpleCanopy where ccid='" + ccid + "'";


            result += PublicDAL.ExecuteSql(sql_canopy);

            #endregion

            #region 写入洼蓄参数(surface)
            string sql_surface = "";

            sql_surface = "insert into S_SimpleSurface_Trials(TrialsID,RatingID,InitialStroage,Max_InitialStroage,Min_InitialStroage,MaxStroage,Max_MaxStroage,Min_MaxStroage) select hmid," + ldid + ",InitialStroage,100.00,0.001,MaxStroage,1500.0000,0.0010 from S_SimpleSurface where ccid='" + ccid + "'";



            result += PublicDAL.ExecuteSql(sql_surface);


            #endregion

            #region 写入扣损参数(loss)
            string sql_loss = "";

            //初损后损
            sql_loss += "insert into L_InitialConstant_Trials(initialloss,constantrate,TrialsID,RatingID,Max_Initialloss,Min_Initialloss,Max_Constantrate,Min_Constantrate)  select initialloss,constantrate,hmid," + ldid + ",1000.0000,0.0010,300.0000,0.001 from L_InitialConstant where ccid='" + ccid + "';";

            //格林安普
            sql_loss += "insert into L_GreenAmpt_Trials(Initialcontent,Saturatedcontent,Suction,Conductivity,TrialsID,RatingID,Max_Initialcontent,Min_Initialcontent,Max_Saturatedcontent,Min_Saturatedcontent,Max_Suction,Min_Suction,Max_Conductivity,Min_Conductivity) select Initialcontent,Saturatedcontent,Suction,Conductivity,hmid," + ldid + ",0.5000,0.001,0.6000,0.001,4000.0000,0.001,250.0000,0.001 from L_GreenAmpt where ccid='" + ccid + "';";

            //SCS指数法
            sql_loss += "insert into L_SCSCurveNumber_Trials(TrialsID,RatingID,InitialAbstraction, CurveNumber,Max_InitialAbstraction,Min_InitialAbstraction,Max_CurveNumber,Min_CurveNumber) select hmid," + ldid + ", InitialAbstraction, CurveNumber,500.0000,0.001,99.00,35 from L_SCSCurveNumber where ccid='" + ccid + "';";

            //土壤湿度考虑法
            sql_loss += "insert into L_SoilMoistureAcco_Trials(TrialsID,RatingID,Soil,Groundwater1,Groundwater2,MaxInfiltration,SoilStorage,TensionStorage,SoilPercolation,GW1Storage,GW1Percolation,GW1Coefficient,GW2Storage,GW2Percolation,GW2Coefficient,Max_Soil,Min_Soil,Max_Groundwater1,Min_Groundwater1,Max_Groundwater2,Min_Groundwater2,Max_MaxInfiltration,Min_MaxInfiltration,Max_SoilStorage,Min_SoilStorage,Max_TensionStorage,Min_TensionStorage,Max_SoilPercolation,Min_SoilPercolation,Max_GW1Storage,Min_GW1Storage,Max_GW1Percolation,Min_GW1Percolation,Max_GW1Coefficient,Min_GW1Coefficient,Max_GW2Storage,Min_GW2Storage,Max_GW2Percolation,Min_GW2Percolation,Max_GW2Coefficient,Min_GW2Coefficient) select hmid," + ldid + ",Soil,Groundwater1,Groundwater2,MaxInfiltration,SoilStorage,TensionStorage,SoilPercolation,GW1Storage,GW1Percolation,GW1Coefficient,GW2Storage,GW2Percolation,GW2Coefficient,100.00,0.001,100.00,0.001,100.00,0.001,500.0000,0.01,1500.0000,0.01,1500.0000,0.01,500.0000,0.01,1500.0000,0.01,500.0000,0.01,10000.0000,0.01,1500.0000,0.01,500.0000,0.01,10000.0000,0.01 from L_SoilMoistureAcco where ccid='" + ccid + "';";

            result += PublicDAL.ExecuteSql(sql_loss);
            #endregion

            #region 写入汇流参数(transform)
            string sql_transform = "";
            //SCS单位线
            sql_transform += "insert into T_SCSUnit_Trials(lagtime,TrialsID,RatingID,Max_LagTime,Min_LagTime) select lagtime,hmid," + ldid + ",30000.000,0.0010 from T_SCSUnit where ccid='" + ccid + "';";


            //用户自定义单位线



            //克拉克单位线
            sql_transform += "insert into T_ClarkUnit_Trials(Concentrationtime,Storagecoefficient,TrialsID,RatingID,Max_Concentrationtime,Min_Concentrationtime,Max_Storagecoefficient,Min_Storagecoefficient) select Concentrationtime,Storagecoefficient,hmid," + ldid + ",1000.0000,0.0167,1000.0000,0.01 from T_ClarkUnit where ccid='" + ccid + "';";


            result += PublicDAL.ExecuteSql(sql_transform);
            #endregion

            #region 写入基流参数(baseflow)
            string sql_baseflow = "";


            //无

            //单月常数


            //线性水库
            sql_baseflow = "insert into B_LinearReservoir_Trials(TrialsID,RatingID,GW1Initial, GW1Coefficient, GW1Reservoirs,Max_GW1Initial,Min_GW1Initial,Max_GW1Coefficient,Min_GW1Coefficient,Max_GW1Reservoirs,Min_GW1Reservoirs) select hmid," + ldid + ", GW1Initial, GW1Coefficient, GW1Reservoirs,100000.0000,0.0000,10000.0000,0.0090,100,1 from B_LinearReservoir where ccid='" + ccid + "'";


            result += PublicDAL.ExecuteSql(sql_baseflow);


            #endregion



            PublicDAL.CommitTransacton();


            return(result);
        }