Example #1
0
        private void btnGetJVData_Click(object sender, EventArgs e)
        {
            //var sw = new System.Diagnostics.Stopwatch();
            //sw.Start();
            cLog.writeLog("btnGetJVData_Click");

            DateTime datetimeTarg = dateTimePicker1.Value;
            string   strDateTarg  = datetimeTarg.ToString("yyyyMMdd");
            string   strPlace;
            string   strRace;

            if (this.textBox1.Text == "")
            {
                System.Media.SystemSounds.Asterisk.Play();
                MessageBox.Show("出力ファイルを保存するフォルダを選択してください。");
                cOperateForm.enableButton();
                return;
            }

            try
            {
                strPlace = listBox1.SelectedItem.ToString();
            }
            catch
            {
                System.Media.SystemSounds.Asterisk.Play();
                MessageBox.Show("会場を選択してください。");
                cOperateForm.enableButton();
                return;
            }
            try
            {
                strRace = listBox2.SelectedItem.ToString();
            }
            catch
            {
                System.Media.SystemSounds.Asterisk.Play();
                MessageBox.Show("レースを選択してください。");
                cOperateForm.enableButton();
                return;
            }

            UmatanOdds cUmatanOdds = new UmatanOdds(cCommon, cOperateForm, this);

            cUmatanOdds.getUmatanOdds(strDateTarg, strPlace, strRace);

            // 保持用
            string    codeJyo = cCommon.JyogyakuCord(strPlace.Substring(0, 2));
            clsDbInfo cDbInfo = new clsDbInfo();

            cDbInfo.strdate = strDateTarg;
            cDbInfo.nameJyo = strPlace;
            cDbInfo.racenum = strRace;
            cDbInfo.raceId  = strDateTarg + codeJyo + strRace;
            cDatabase.putHistory(cDbInfo);

            //sw.Stop();
            //TimeSpan ts = sw.Elapsed;
            //rtbData.Text = $"{ts}";
        }
Example #2
0
        public void getUmatanOdds(string strDateTarg, string placeTarg, string racenumTarg)
        {
            cLog.writeLog("getUmatanOdds");
            cOperateForm.disableButton();

            string pathTarg;
            string nameFileTarg;

            pathTarg  = _form1.textBox1.Text;
            placeTarg = placeTarg.Replace("競馬場", "");

            //strDateTarg = "20201206"; //20201206 20210105
            //placeTarg = "中山";
            //racenumTarg = "01";

            // CSV初期化
            var encoding = Encoding.GetEncoding("shift_jis");

            cCSV.CreateCSVarrdata();

            // 追加項目を記入
            writeHeadData(cCSV);

            // 速報開催情報(一括)の呼び出し
            int retval = checkJVRTOpen(strDateTarg);

            if (retval < -1)
            {
                return;
            }

            if (retval == -1)
            {
                cUmatanOddsStock.GetStockDataDetailData(cCSV, strDateTarg, placeTarg, racenumTarg);
            }
            else
            {
                cUmatanOddsRT.GetRTDataDetailData(cCSV, strDateTarg, placeTarg, racenumTarg);
            }

            // ファイル出力
            racenumTarg  = Strings.StrConv(racenumTarg, VbStrConv.Wide);
            nameFileTarg = "馬単オッズ_" + strDateTarg + "_" + placeTarg + racenumTarg + ".csv";
            cCSV.CreateCSVdataAll();
            File.WriteAllText(pathTarg + "\\" + nameFileTarg, cCSV.dataCsvAll, encoding);

            _form1.axJVLink1.JVClose();
            System.Media.SystemSounds.Asterisk.Play();
            cOperateForm.enableButton();

            _form1.rtbData.Text = nameFileTarg + "\n" +
                                  "取得完了しました。";
        }