Exemple #1
0
        private void TatamiBut_Click(object sender, EventArgs e)
        {
            this.Hide();
            TatamiForm tatamiForm = new TatamiForm();

            tatamiForm.Show();
        }
Exemple #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            DataBase DB = new DataBase();
            DataSet  bd = DB.DGView("SELECT * FROM participants;");

            for (int i = 0; i < 4; i++)
            {
                string command = String.Format("DROP TABLE Group{0}", i + 1);
                DB.SendCommand(command);
            }
            object[,] BDTable = new object[bd.Tables[0].Rows.Count, bd.Tables[0].Columns.Count];
            foreach (DataTable dt in bd.Tables)
            {
                int i = 0;
                foreach (DataRow row in dt.Rows)
                {
                    int b     = 0;
                    var cells = row.ItemArray;
                    foreach (object cell in cells)
                    {
                        BDTable[i, b] = cell;
                        ++b;
                    }
                    ++i;
                }
            }
            object[,] GroupM   = sort(BDTable, "m");
            object[,] GroupF   = sort(BDTable, "f");
            object[][,] SLFSLM = new object[][, ] {
                sort(GroupF, "8", dateTimePicker1.Value.Date),
                sort(GroupF, "10", dateTimePicker1.Value.Date),
                sort(GroupM, "8", dateTimePicker1.Value.Date),
                sort(GroupM, "10", dateTimePicker1.Value.Date)
            };
            object[][][,] HL = new object[4][][, ];
            for (int i = 0; i < SLFSLM.Length; i++)
            {
                if (SLFSLM[i].GetLength(0) != 0)
                {
                    HL[i] = MinMax(SLFSLM[i]);
                }
            }
            for (int i = 0; i < HL.Length; i++)
            {
                if (HL[i] != null)
                {
                    int count = 0;
                    for (int b = 0; b < HL[i].Length; b++)
                    {
                        if (HL[i][b].GetLength(0) > 1)
                        {
                            ++count;
                        }
                    }
                    object[][,] temp = new object[count][, ];
                    count            = 0;
                    for (int b = 0; b < HL[i].Length; b++)
                    {
                        if (HL[i][b].GetLength(0) > 1)
                        {
                            temp[count] = HL[i][b];
                            ++count;
                        }
                    }
                    HL[i] = temp;
                }
            }
            for (int i = 0; i < HL.Length; i++)
            {
                string command = String.Format("CREATE TABLE Group{0} (idLg INT NOT NULL, idSg INT NOT NULL);", i + 1);
                //string command = String.Format("DROP TABLE Group{0}", i + 1);
                DB.SendCommand(command);
                if (HL[i] != null)
                {
                    for (int b = 0; b < HL[i].Length; b++)
                    {
                        for (int c = 0; c < HL[i][b].GetLength(0); c++)
                        {
                            command = String.Format("INSERT INTO Group{0} VALUES('{1}', '{2}');", i + 1, b, HL[i][b][c, 0]);
                            DB.SendCommand(command);
                        }
                    }
                }
            }
            this.Hide();
            TatamiForm tatamiForm = new TatamiForm();

            tatamiForm.Show();
        }