Exemple #1
0
        string GeJVRTRead(string strDateTarg, string codeJyo, string numRace, string codeRT, int size)
        {
            clsUmatanOdds cUmatanOdds = new clsUmatanOdds();

            string retbuff;

            if (cCommon.checkClose() != 0)
            {
                return(null);
            }
            if (cCommon.checkInit() != 0)
            {
                return(null);
            }
            if (!cCommon.isJVRTOpen(codeRT, strDateTarg + codeJyo + numRace))
            {
                _form1.axJVLink1.JVClose();
                return(null);
            }
            retbuff = cCommon.loopJVRead(size, count, false);
            if (retbuff == "" || retbuff == "END")
            {
                _form1.axJVLink1.JVClose();
                return(null);
            }

            return(retbuff);
        }
        int GetStockDataDetailData1(string strDateTarg, string placeTarg, string racenumTarg)
        {
            DateTime datetimeTarg;
            DateTime dateTime;

            datetimeTarg = DateTime.Parse(strDateTarg.Insert(4, "/").Insert(7, "/"));

            TimeSpan timeSpan = new TimeSpan(1, 0, 0, 0);
            string   strDate  =
                (datetimeTarg - timeSpan).ToString("yyyyMMdd");
            bool   isFind = false;
            string retbuff;
            long   cntLoop = 0;

            size  = 840000;
            count = 256;
            int option = DateTime.Now >
                         datetimeTarg.AddYears(1) ? 4 : 1;

            _form1.prgJVRead.Value = 0;
            if (!cCommon.isJVOpen("RACE", strDate, option))
            {
                return(-1);
            }
            do
            {
                retbuff = cCommon.loopJVRead(size, count, true);
                if (retbuff == "" || retbuff == "END")
                {
                    break;
                }
                Console.WriteLine(retbuff.Substring(11, 8).Insert(4, "/").Insert(7, "/"));
                dateTime = DateTime.Parse(retbuff.Substring(11, 8).Insert(4, "/").Insert(7, "/"));
                if (isFind && dateTime > datetimeTarg)
                {
                    break;
                }
                //票数1
                if (retbuff.Substring(0, 2) == "H1")
                {
                    //setDataH1(retbuff, strDateTarg, placeTarg, racenumTarg);
                    if (listUmatanOddsH1 == null)
                    {
                        listUmatanOddsH1 = cCommon.setDataH1(retbuff, strDateTarg,
                                                             placeTarg, racenumTarg);
                    }
                }
                //オッズ(単複枠)
                if (retbuff.Substring(0, 2) == "O1")
                {
                    //setDataO1(retbuff, strDateTarg, placeTarg, racenumTarg);
                    if (listUmatanOddsO1 == null)
                    {
                        listUmatanOddsO1 = cCommon.setDataO1(retbuff, strDateTarg,
                                                             placeTarg, racenumTarg);
                    }
                }
                //オッズ(馬単)
                if (retbuff.Substring(0, 2) == "O4")
                {
                    //setDataO4(retbuff, strDateTarg, placeTarg, racenumTarg);
                    if (listUmatanOdds == null)
                    {
                        listUmatanOdds = cCommon.setDataO4(retbuff, strDateTarg,
                                                           placeTarg, racenumTarg);
                    }
                }
                //3連単オッズ
                if (retbuff.Substring(0, 2) == "O6")
                {
                    //if (setDataO6(retbuff, strDateTarg, placeTarg, racenumTarg))
                    //    isFind = true;
                    if (listOddsSanrentan == null)
                    {
                        listOddsSanrentan = cCommon.setDataO6(retbuff, strDateTarg,
                                                              placeTarg, racenumTarg);
                    }
                    if (listOddsSanrentan != null)
                    {
                        isFind = true;
                    }
                }
                cntLoop++;
            }while (cntLoop <= 100000);
            _form1.prgJVRead.Maximum++;
            _form1.prgJVRead.Value =
                _form1.prgJVRead.Maximum;
            _form1.prgJVRead.Maximum--;

            int retJVClose = _form1.axJVLink1.JVClose();

            if (retJVClose != 0)
            {
                cLog.writeLog("[GetStockDataDetailData1]JVClose エラー:" +
                              retJVClose);
            }

            if (listUmatanOddsH1.Count == 0 ||
                listUmatanOddsO1.Count == 0 ||
                listUmatanOdds.Count == 0 ||
                listOddsSanrentan.Count == 0)
            {
                return(-1);
            }

            return(1);
        }
Exemple #3
0
        bool getDbDataJvLink(DateTime datetimeTarg, List <string> listdbDate)
        {
            JVData_Struct.JV_RA_RACE     jvRaRace    = new JVData_Struct.JV_RA_RACE();
            JVData_Struct.JV_SE_RACE_UMA jvSeRaceUma = new JVData_Struct.JV_SE_RACE_UMA();
            string   retbuff;
            long     cntLoop     = 0;
            bool     isExistData = false;
            int      size        = 40000;
            int      count       = 256;
            int      option;
            string   strDate;
            double   bunbo;
            DateTime DateTimeStart;

            if (listdbDate.Count > 0)
            {
                strDate       = listdbDate[listdbDate.Count - 1];
                DateTimeStart = DateTime.Parse(listdbDate[listdbDate.Count - 1].Insert(4, "/").Insert(7, "/"));
                option        = 1;
            }
            else
            {
                TimeSpan timeSpan = new TimeSpan(365 * 4, 0, 0, 0); //365*4
                strDate       = (datetimeTarg - timeSpan).ToString("yyyyMMdd");
                DateTimeStart = datetimeTarg - timeSpan;
                option        = 4;
            }
            bunbo = (datetimeTarg - DateTimeStart).TotalDays;

            _form1.prgJVRead.Maximum = 100;
            _form1.prgJVRead.Value   = 0;
            if (!cCommon.isJVOpen("RACE", strDate, option))
            {
                return(false);
            }

            do
            {
                retbuff = cCommon.loopJVRead(size, count, true);
                if (retbuff == "" || retbuff == "END")
                {
                    break;
                }
                if (retbuff.Substring(0, 2) == "RA")
                {
                    jvRaRace.SetDataB(ref retbuff);

                    // 中央競馬以外は除外
                    int intJyoCD;
                    if (!int.TryParse(jvRaRace.id.JyoCD, out intJyoCD))
                    {
                        continue;
                    }
                    else if (intJyoCD < 1 || intJyoCD > 10)
                    {
                        continue;
                    }

                    // プログレスバー更新
                    DateTime dateTimeJv = DateTime.Parse((retbuff.Substring(11, 8)).Insert(4, "/").Insert(7, "/"));
                    if (dateTimeJv > datetimeTarg)
                    {
                        continue;
                    }
                    double bunshi = (dateTimeJv - DateTimeStart).TotalDays;
                    if (bunshi < 0)
                    {
                        bunshi = 0;
                    }
                    _form1.prgJVRead.Value = (int)(bunshi / bunbo * 100);
                    if (_form1.prgJVRead.Value < _form1.prgJVRead.Maximum)
                    {
                        _form1.prgJVRead.Value++;
                        _form1.prgJVRead.Value--;
                    }
                    _form1.rtbData.Text = jvRaRace.id.Year + jvRaRace.id.MonthDay;
                    _form1.rtbData.Refresh();

                    // DBにデータがある場合は除外
                    if (isExistDateList(listdbDate, jvRaRace.id.Year + jvRaRace.id.MonthDay))
                    {
                        isExistData = true;
                        //_form1.axJVLink1.JVSkip();
                        continue;
                    }

                    isExistData = false;

                    // テキストボックス更新
                    string codeName = this.objCodeConv.GetCodeName("2001", jvRaRace.id.JyoCD, 1);
                    _form1.rtbData.Text = jvRaRace.id.Year +
                                          jvRaRace.id.MonthDay + " " +
                                          codeName + " " +
                                          "取得中";
                    _form1.rtbData.Refresh();

                    listRaceInfo.Add(new clsDbInfo()
                    {
                        strdate = jvRaRace.id.Year + jvRaRace.id.MonthDay,
                        nameJyo = codeName,
                        racenum = jvRaRace.id.RaceNum,
                        raceId  = jvRaRace.id.Year + jvRaRace.id.MonthDay +
                                  jvRaRace.id.JyoCD + jvRaRace.id.RaceNum,
                    });
                }
                else if (retbuff.Substring(0, 2) == "SE")
                {
                    if (isExistData)
                    {
                        _form1.axJVLink1.JVSkip();
                        continue;
                    }
                    jvSeRaceUma.SetDataB(ref retbuff);

                    // 中央競馬以外は除外
                    int intJyoCD;
                    if (!int.TryParse(jvSeRaceUma.id.JyoCD, out intJyoCD))
                    {
                        continue;
                    }
                    else if (intJyoCD < 1 || intJyoCD > 10)
                    {
                        continue;
                    }

                    string codeName = objCodeConv.GetCodeName("2001", jvSeRaceUma.id.JyoCD, 1);
                    foreach (clsDbInfo RaceInfo in listRaceInfo)
                    {
                        if (RaceInfo.strdate ==
                            jvSeRaceUma.id.Year + jvSeRaceUma.id.MonthDay &&
                            RaceInfo.nameJyo == codeName &&
                            RaceInfo.racenum == jvSeRaceUma.id.RaceNum)
                        {
                            listdbInfo.Add(new clsDbInfo()
                            {
                                strdate = RaceInfo.strdate,
                                nameJyo = RaceInfo.nameJyo,
                                racenum = RaceInfo.racenum,
                                Bamei   = jvSeRaceUma.Bamei.Trim(),
                                Umaban  = jvSeRaceUma.Umaban,
                                raceId  = RaceInfo.raceId,
                            });
                            break;
                        }
                    }
                }
                else
                {
                    _form1.axJVLink1.JVSkip();
                }
                cntLoop++;
            }while (cntLoop <= 1000000);
            _form1.prgJVRead.Maximum++;
            _form1.prgJVRead.Value =
                _form1.prgJVRead.Maximum;
            _form1.prgJVRead.Maximum--;

            int retJVClose = _form1.axJVLink1.JVClose();

            if (retJVClose != 0)
            {
                return(false);
            }

            return(true);
        }