Ejemplo n.º 1
0
 private Caike_Body GetBJDCList(string matchDateCode = "")
 {
     try
     {
         var BJDC_url = "Trade/DrawInfo/jingjiDraw.aspx?lotteryType=20011";
         if (!string.IsNullOrEmpty(matchDateCode))
         {
             BJDC_url += "&matchDateCode=" + matchDateCode;
         }
         var url    = Url_Caike + BJDC_url;
         int page   = 1;
         var result = new Caike_Body()
         {
             matchDates = new List <Caike_matchDates>()
         };
         while (true)
         {
             var str = CommonHelper.Post(url, "action=loaddata&" + "pageIndex=" + page, Encoding.UTF8, CollectionUrlEnum.url_caike);
             if (!string.IsNullOrEmpty(str))
             {
                 var model = JsonHelper.Deserialize <CaikeCommonCollection>(str);
                 if (model != null)
                 {
                     result.matchDates = model.body.matchDates;
                     result.records.AddRange(model.body.records);
                     if (!model.body.hasNext)
                     {
                         return(result);
                     }
                     else
                     {
                         page++;
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message + ":" + ex.StackTrace);
         return(null);
     }
 }
Ejemplo n.º 2
0
 public int AddCaiKeBJDC(Caike_Body caike_Body, string matchDateCode)
 {
     try
     {
         int m = 0;
         caike_Body.records.ForEach((record) =>
         {
             bjdc_result _Result = new bjdc_result
             {
                 MatchId     = matchDateCode + record.matchNo,
                 MatchDate   = "",
                 MatchNumber = record.matchNo,
                 HomeTeam    = record.homeTeam,
                 GuestTeam   = record.guestTeam,
                 HalfScore   = record.hScoreText.Replace("-", ":"),
                 FullScore   = record.scoreText.Substring(record.scoreText.IndexOf(">") + 1, record.scoreText.Substring(record.scoreText.IndexOf(">") + 1).IndexOf("<")).Replace("-", ":"),
                 LeagueName  = record.leagueName,
                 AvgEu_SP    = "123456",
                 Url_Type    = (int)CollectionUrlEnum.url_caike
             };
             int i = 0;
             record.details.ForEach((detail) =>
             {
                 if (detail.name != "" && detail.name != "-" && detail.value != "" && detail.value != "-")
                 {
                     if (i == 0)
                     {
                         _Result.LetBall      = detail.name.Substring(detail.name.IndexOf("(") + 1, detail.name.IndexOf(")") - detail.name.IndexOf("(") - 1);
                         _Result.RQSPF_Result = detail.name.Substring(detail.name.IndexOf("(") + 1, detail.name.IndexOf(")") - detail.name.IndexOf("(") - 1);
                         _Result.RQSPF_SP     = detail.value;
                         i++;
                     }
                     else if (i == 1)
                     {
                         _Result.ZJQ_Result = Convert2Number(detail.name.Replace("球", "")).ToString();
                         _Result.ZJQ_SP     = detail.value;
                         i++;
                     }
                     else if (i == 2)
                     {
                         _Result.SXDS_Result = detail.name;
                         _Result.SXDS_SP     = detail.value;
                         i++;
                     }
                     else if (i == 3)
                     {
                         _Result.BF_SP = detail.name;
                         i++;
                     }
                     else if (i == 4)
                     {
                         _Result.BQC_Result = detail.name;
                         _Result.BQC_SP     = detail.value;
                         i++;
                     }
                 }
             });
             if (!string.IsNullOrEmpty(_Result.RQSPF_Result) && _Result.RQSPF_Result != "-" &&
                 !string.IsNullOrEmpty(_Result.ZJQ_Result) && _Result.ZJQ_Result != "-" &&
                 !string.IsNullOrEmpty(_Result.FullScore) && _Result.FullScore != "-" &&
                 !string.IsNullOrEmpty(_Result.SXDS_Result) && _Result.SXDS_Result != "-" &&
                 !string.IsNullOrEmpty(_Result.BQC_Result) && _Result.BQC_Result != "-")
             {
                 _Result.IsFinish = true;
             }
             else
             {
                 _Result.IsFinish = false;
             }
             var model = db.Queryable <bjdc_result>().Where(x => x.MatchId == _Result.MatchId).First();
             if (model == null)
             {
                 db.Insertable(_Result).ExecuteCommand();
                 m++;
             }
             else
             {
                 if (!model.IsFinish)
                 {
                     db.Updateable(_Result).ExecuteCommand();
                 }
             }
         });
         var lottery = db.Queryable <sys_lottery>().Where(x => x.LotteryCode == "zqdc").First();
         caike_Body.matchDates.ForEach((matchDate) =>
         {
             if (matchDate.code == matchDateCode)
             {
                 sys_issue _sys_Issue   = new sys_issue();
                 _sys_Issue.LotteryId   = lottery.Lottery_Id;
                 _sys_Issue.IssueNo     = matchDate.code;
                 _sys_Issue.LotteryCode = lottery.LotteryCode;
                 _sys_Issue.CreateTime  = DateTime.Now;
                 var Model = db.Queryable <sys_issue>().Where(x => x.LotteryId == _sys_Issue.LotteryId && x.LotteryCode == _sys_Issue.LotteryCode && x.IssueNo == _sys_Issue.IssueNo).First();
                 if (Model == null)
                 {
                     db.Insertable(_sys_Issue).ExecuteCommand();
                 }
             }
         });
         return(m);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Ejemplo n.º 3
0
 public int AddCaikeJCZQ(Caike_Body caike_Body, string matchDateCode, DateTime dateTime)
 {
     try
     {
         int m = 0;
         caike_Body.records.ForEach((record) =>
         {
             jczq_result _Result = new jczq_result
             {
                 MatchId     = matchDateCode + record.matchNo,
                 MatchDate   = "",
                 MatchNumber = record.matchNo,
                 HomeTeam    = record.homeTeam,
                 GuestTeam   = record.guestTeam,
                 HalfScore   = record.hScoreText,
                 FullScore   = record.scoreText.Substring(record.scoreText.IndexOf(">") + 1, record.scoreText.Substring(record.scoreText.IndexOf(">") + 1).IndexOf("<")).Replace("-", ":"),
                 LeagueName  = record.leagueName,
                 Url_Type    = (int)CollectionUrlEnum.url_caike
             };
             int i = 0;
             record.details.ForEach((detail) =>
             {
                 if (detail.name != "" && detail.name != "-" && detail.value != "" && detail.value != "-")
                 {
                     if (i == 0)
                     {
                         _Result.RQSPF_Result = detail.name.Substring(0, 1);
                         _Result.LetBall      = detail.name.Substring(detail.name.IndexOf("(") + 1, detail.name.IndexOf(")") - detail.name.IndexOf("(") - 1);
                         _Result.RQSPF_SP     = detail.value;
                         i++;
                     }
                     else if (i == 1)
                     {
                         _Result.SPF_Result = detail.name;
                         _Result.SPF_SP     = detail.value;
                         i++;
                     }
                     else if (i == 2)
                     {
                         _Result.BF_SP = detail.value;
                         i++;
                     }
                     else if (i == 3)
                     {
                         _Result.ZJQ_Result = detail.name.Replace("球", "");
                         _Result.ZJQ_SP     = detail.value;
                         i++;
                     }
                     else if (i == 4)
                     {
                         _Result.BQC_Result = detail.name;
                         _Result.BQC_SP     = detail.value;
                         i++;
                     }
                 }
             });
             _Result.AvgEu_SP   = "123456";
             _Result.JCDate     = dateTime.ToString("yyyy-MM-dd");
             _Result.CreateTime = DateTime.Now;
             var Model          = db.Queryable <jczq_result>().Where(x => x.MatchId == _Result.MatchId).First();
             if (Model == null)
             {
                 db.Insertable(_Result).ExecuteCommand();
                 m++;
             }
         });
         return(m);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Ejemplo n.º 4
0
 public int AddCaiKeJCLQ(Caike_Body caike_Body, string matchDateCode, DateTime dateTime)
 {
     try
     {
         int m = 0;
         caike_Body.records.ForEach((record) =>
         {
             jclq_result _Result = new jclq_result
             {
                 MatchId     = matchDateCode + record.matchNo,
                 MatchDate   = "",
                 MatchNumber = record.matchNo,
                 HomeTeam    = record.homeTeam,
                 GuestTeam   = record.guestTeam,
                 LeagueName  = record.leagueName,
                 FullScore   = record.scoreText.Substring(record.scoreText.IndexOf(">") + 1, record.scoreText.Substring(record.scoreText.IndexOf(">") + 1).IndexOf("<")).Replace("-", ":"),
                 AvgEu_SP    = "123456",
                 JCDate      = dateTime.ToString("yyyy-MM-dd"),
                 CreateTime  = DateTime.Now,
                 Url_Type    = (int)CollectionUrlEnum.url_caike
             };
             int i = 0;
             record.details.ForEach((detail) =>
             {
                 if (detail.name != "" && detail.name != "-" && detail.value != "" && detail.value != "-")
                 {
                     if (i == 0)
                     {
                         _Result.SF_Result = detail.name;
                         i++;
                     }
                     else if (i == 1)
                     {
                         _Result.RFSF_Result = detail.name.Substring(0, detail.name.IndexOf("(") - 1);
                         _Result.LetBall     = detail.name.Substring(detail.name.IndexOf("(") + 1, detail.name.IndexOf(")") - detail.name.IndexOf("(") - 1);
                         i++;
                     }
                     else if (i == 2)
                     {
                         var SFC                = detail.name.Replace("胜", "").Replace("负", "");
                         _Result.SFC_Result     = _Result.RFSF_Result + SFC;
                         _Result.GG_SFC_Result  = _Result.RFSF_Result + SFC;
                         _Result.GG_RFSF_Result = "让分" + _Result.RFSF_Result;
                         i++;
                     }
                     else if (i == 3)
                     {
                         _Result.YSZF          = detail.name.Substring(detail.name.IndexOf("(") + 1, detail.name.IndexOf(")") - detail.name.IndexOf("(") - 1);
                         _Result.DXF_Result    = detail.name.Split("(")[0];
                         _Result.GG_DXF_Result = detail.name.Split("(")[0] + "分";
                         i++;
                     }
                 }
             });
             var Model = db.Queryable <jclq_result>().Where(x => x.MatchId == _Result.MatchId).First();
             if (Model == null)
             {
                 db.Insertable(_Result).ExecuteCommand();
                 m++;
             }
         });
         return(m);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }