Exemple #1
0
        private int GetMasterDataYS()
        {
            int ret;
            int LibRet = 0;

            ret = JV_FORM.JvForm_JvInit();
            JVData_Struct.JV_YS_SCHEDULE jVData = new JVData_Struct.JV_YS_SCHEDULE();

            if (ret != 0)
            {
                return(ret);
            }

            int    rdCount       = 0;
            int    dlCount       = 0;
            String lastTimeCount = "";

            ret = JV_FORM.JvForm_JvOpen("YSCH", "20180101000000", 1, ref rdCount, ref dlCount, ref lastTimeCount);

            /* JvOpenのエラーハンドリング */
            if (ret != 0)
            {
                if (ret == -202)
                {
                    JV_FORM.JvForm_JvClose();
                    ret = JV_FORM.JvForm_JvOpen("YSCH", "20180101000000", 1, ref rdCount, ref dlCount, ref lastTimeCount);
                    if (ret != 0)
                    {
                        JV_FORM.JvForm_JvClose();
                        return(0); /* エラー */
                    }
                }
                else
                {
                    JV_FORM.JvForm_JvClose();
                    return(0); /* エラー */
                }
            }

            String buff  = "";
            int    size  = 20000;
            String fname = "";


            progressBar1.Value = 0;
            ret = 1;
            db.DeleteCsv("YS");

            String tmp = "";

            while (ret >= 1)
            {
                ret = JV_FORM.JvForm_JvRead(ref buff, out size, out fname);

                if (buff == "")
                {
                    continue;
                }

                if (ret > 0)
                {
                    progressBar1.Maximum = ret;
                    progressBar1.Value++;

                    switch (buff.Substring(0, 2))
                    {
                    case "YS":
                        jVData.SetDataB(ref buff);
                        tmp += jVData.id.Year + jVData.id.MonthDay + ",";
                        tmp += jVData.id.Kaiji + ",";
                        tmp += jVData.id.JyoCD + ",";
                        tmp += jVData.id.Kaiji + ",";
                        tmp += jVData.crlf;
                        db   = new dbConnect(jVData.id.Year + jVData.id.MonthDay, "YS", ref tmp, ref ret);
                        break;
                    }
                }

                if (ret == 0)
                {
                    break;
                }
            }
            JV_FORM.JvForm_JvClose();
            return(1);
        }
Exemple #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            MainWindow         main   = new MainWindow();
            DataGridViewColumn column = new DataGridViewColumn();
            String             Date   = DataClass.getRaceDate() + DataClass.getRaceCource() + DataClass.getRaceNum();
            List <String>      tmp    = new List <string>();
            String             str    = "";
            String             covData;
            int ret = 0;

            db = new dbConnect();

            /* タイム型データマイニング */
            if (db.TextReader_aCell("TM", DataClass.GET_RA_KEY() + "01", DataClass.getRaceDate(), 4, ref str) != 1)
            {
                /* データなし */
                db.DeleteCsv("TM");
                ret = main.InitRealTimeDataMaining(Date);

                if (ret != 1)
                {
                    return;
                }
            }

            if (db.TextReader_aCell("DM", DataClass.GET_RA_KEY() + "01", DataClass.getRaceDate(), 4, ref str) != 1)
            {
                /* データなし */
                db.DeleteCsv("DM");
                ret = main.InitRealBattleDataMaining(Date);

                if (ret != 1)
                {
                    return;
                }
            }

            int MaxTimeDM      = 0;
            int MaxBattleDM    = 99999;
            int SecondTimeDM   = 0;
            int SecondBattleDM = 99999;
            int ThaadTimeDM    = 0;
            int ThaadBattleDM  = 99999;

            int Count = 0;

            Date = DataClass.getRaceDate();

            dataGridView1.Columns["TM"].Visible = true;
            dataGridView1.Columns["DM"].Visible = true;

            for (int i = 1; i <= MAX_TOSU; i++)
            {
                covData = String.Format("{0:00}", i);

                /* タイム型データマイニング */
                if (db.TextReader_aCell("TM", DataClass.GET_RA_KEY() + covData, Date, 4, ref str) == 0)
                {
                    Count = i;
                    break;
                }

                dataGridView1.Rows[i - 1].Cells[3].Value = Int32.Parse(str);

                if (MaxTimeDM < Int32.Parse(str))
                {
                    SecondTimeDM = MaxTimeDM;
                    ThaadTimeDM  = SecondTimeDM;
                    MaxTimeDM    = Int32.Parse(str);
                }
                else if (SecondTimeDM < Int32.Parse(str))
                {
                    ThaadTimeDM  = SecondTimeDM;
                    SecondTimeDM = Int32.Parse(str);
                }
                else if (ThaadTimeDM < Int32.Parse(str))
                {
                    ThaadTimeDM = Int32.Parse(str);
                }

                /* 対戦型データマイニング */
                if (db.TextReader_aCell("DM", DataClass.GET_RA_KEY() + covData, Date, 4, ref str) == 0)
                {
                    break;
                }

                dataGridView1.Rows[i - 1].Cells[4].Value = Int32.Parse(str).ToString();

                if (MaxBattleDM > Int32.Parse(str))
                {
                    SecondBattleDM = MaxBattleDM;
                    ThaadBattleDM  = SecondBattleDM;
                    MaxBattleDM    = Int32.Parse(str);
                }
                else if (SecondBattleDM > Int32.Parse(str))
                {
                    ThaadBattleDM  = SecondBattleDM;
                    SecondBattleDM = Int32.Parse(str);
                }
                else if (ThaadBattleDM > Int32.Parse(str))
                {
                    ThaadBattleDM = Int32.Parse(str);
                }
            }

            /* 表の色付け */
            for (int j = 1; j < Count; j++)
            {
                if (MaxTimeDM == (int)dataGridView1.Rows[j - 1].Cells[3].Value)
                {
                    dataGridView1[3, j - 1].Style.BackColor = Color.Pink;
                }
                else if (SecondTimeDM == (int)dataGridView1.Rows[j - 1].Cells[3].Value)
                {
                    dataGridView1[3, j - 1].Style.BackColor = Color.PowderBlue;
                }
                else if (ThaadTimeDM == (int)dataGridView1.Rows[j - 1].Cells[3].Value)
                {
                    dataGridView1[3, j - 1].Style.BackColor = Color.LightCyan;
                }

                if (MaxBattleDM == Int32.Parse(dataGridView1.Rows[j - 1].Cells[4].Value.ToString()))
                {
                    dataGridView1[4, j - 1].Style.BackColor = Color.Pink;
                }
                else if (SecondBattleDM == Int32.Parse(dataGridView1.Rows[j - 1].Cells[4].Value.ToString()))
                {
                    dataGridView1[4, j - 1].Style.BackColor = Color.PowderBlue;
                }
                else if (ThaadBattleDM == Int32.Parse(dataGridView1.Rows[j - 1].Cells[4].Value.ToString()))
                {
                    dataGridView1[4, j - 1].Style.BackColor = Color.LightCyan;
                }
            }
        }