예제 #1
0
파일: Form1.cs 프로젝트: Golgannet/kurs
 private void numericUpDown2_ValueChanged(object sender, EventArgs e)
 {
     categories2.Clear();
     panel3.Controls.Clear();
     for (var i = 0; i < (numericUpDown2.Value); i++)
     {
         TextBox a = textBox4;
         CheckComboBoxTest.CheckedComboBox d = checkedComboBox3;
         d.DisplayMember = "name";
         d.ValueMember   = "id";
         TextBox temp1 = new TextBox();
         CheckComboBoxTest.CheckedComboBox temp2 = new CheckComboBoxTest.CheckedComboBox();
         temp1.Name  = "temp1." + i.ToString();
         temp2.Name  = "temp2." + i.ToString();
         temp1.Text  = ("смена " + (i + 1).ToString());
         temp1.Width = a.Width;
         temp2.Width = d.Width;
         foreach (var obj in d.Items)
         {
             temp2.Items.Add(obj);
         }
         temp2.DisplayMember = "name";
         temp2.ValueMember   = "id";
         temp1.Location      = new Point(a.Location.X, a.Location.Y + a.Height * i + 35 * i);
         temp2.Location      = new Point(d.Location.X, d.Location.Y + d.Height * i + 36 * i);
         panel3.Controls.Add(temp1);
         panel3.Controls.Add(temp2);
         category_halder item = new category_halder();
         item.a = temp1;
         item.d = temp2;
         categories2.Add(item);
     }
 }
예제 #2
0
파일: Form1.cs 프로젝트: Golgannet/kurs
        private void button3_Click(object sender, EventArgs e)
        {
            competitioons competition = new competitioons();

            competition.name       = textBox3.Text;
            competition.start_date = (dateTimePicker1.Value);
            competition.end_date   = (dateTimePicker2.Value);
            string        sqlQuery = "";
            SQLiteCommand command  = new SQLiteCommand();
            int           i        = 0;

            sqlQuery = "INSERT INTO  competition (name, start_date, end_date)VALUES ('" + competition.name + "','" + competition.start_date.ToString("yyyy-MM-dd") + "','" + competition.end_date.ToString("yyyy-MM-dd") + "');";
            command  = new SQLiteCommand(sqlQuery, m_dbConn);
            command.ExecuteNonQuery();
            sqlQuery = "SELECT id FROM competition WHERE id=last_insert_rowid();";
            command  = new SQLiteCommand(sqlQuery, m_dbConn);
            string id_comp = command.ExecuteScalar().ToString();

            foreach (CheckedListBox l1 in tables)
            {
                category_halder a    = categories[i];
                distantion      dist = (distantion)a.f.SelectedItem;
                sqlQuery = "INSERT INTO  `smena_info` (title, table_name, id_comp)VALUES ('" + a.a.Text + "','smena" + (i).ToString() + "','" + id_comp + "');";
                command  = new SQLiteCommand(sqlQuery, m_dbConn);
                command.ExecuteNonQuery();
                sqlQuery = "SELECT id FROM smena_info WHERE id=last_insert_rowid();";
                command  = new SQLiteCommand(sqlQuery, m_dbConn);
                string id_smena = command.ExecuteScalar().ToString();
                foreach (Object obj in l1.CheckedItems)
                {
                    table_names archer = (table_names)obj;
                    sqlQuery = "INSERT INTO  performance (id_user,id_comp,id_smena) values ('" + archer.id.ToString() + "','" + id_comp + "','" + id_smena + "');";
                    command  = new SQLiteCommand(sqlQuery, m_dbConn);
                    command.ExecuteNonQuery();
                    sqlQuery = "SELECT id FROM performance WHERE id=last_insert_rowid();";
                    command  = new SQLiteCommand(sqlQuery, m_dbConn);
                    string id_perfomanse = command.ExecuteScalar().ToString();
                    for (int j = 0; j++ < dist.rounds_col; j++)
                    {
                        sqlQuery = "INSERT INTO  `rounds` (id_distantion,id_perf)VALUES ('" + dist.id + "','" + id_perfomanse + "');";
                        command  = new SQLiteCommand(sqlQuery, m_dbConn);
                        command.ExecuteNonQuery();
                    }
                }
                i++;
            }
            if (!File.Exists("this_comp.txt"))
            {
                File.Create("this_comp.txt").Close();;
            }
            sqlQuery = "SELECT id FROM 'competition' order by id desc limit 1";
            command  = new SQLiteCommand(sqlQuery, m_dbConn);
            string id = command.ExecuteScalar().ToString();

            File.AppendAllText("this_comp.txt", id);
        }
예제 #3
0
파일: Form1.cs 프로젝트: Golgannet/kurs
 private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
 {
     categories.Clear();
     panel1.Controls.Clear();
     for (var i = 0; i < Convert.ToInt32(comboBox2.Text); i++)
     {
         TextBox  a     = textBox2;
         ComboBox b     = comboBox3;
         ComboBox c     = comboBox4;
         ComboBox f     = comboBox1;
         TextBox  temp1 = new TextBox();
         ComboBox temp2 = new ComboBox();
         ComboBox temp3 = new ComboBox();
         ComboBox temp4 = new ComboBox();
         temp1.Name  = "temp1." + i.ToString();
         temp2.Name  = "temp2." + i.ToString();
         temp3.Name  = "temp3." + i.ToString();
         temp4.Name  = "temp4." + i.ToString();
         temp1.Width = a.Width;
         temp4.Width = f.Width;
         foreach (var obj in b.Items)
         {
             temp2.Items.Add(obj);
         }
         foreach (var obj in c.Items)
         {
             temp3.Items.Add(obj);
         }
         foreach (var obj in f.Items)
         {
             temp4.Items.Add(obj);
         }
         temp4.SelectedItem  = comboBox1.Items[1];
         temp2.SelectedItem  = comboBox3.Items[0];
         temp1.Location      = new Point(a.Location.X, a.Location.Y + a.Height * i + 25 * i);
         temp2.Location      = new Point(b.Location.X, b.Location.Y + b.Height * i + 24 * i);
         temp3.Location      = new Point(c.Location.X, c.Location.Y + c.Height * i + 24 * i);
         temp4.Location      = new Point(f.Location.X, f.Location.Y + f.Height * i + 24 * i);
         temp2.DropDownStyle = ComboBoxStyle.DropDownList;
         temp3.DropDownStyle = ComboBoxStyle.DropDownList;
         panel1.Controls.Add(temp1);
         panel1.Controls.Add(temp2);
         panel1.Controls.Add(temp3);
         panel1.Controls.Add(temp4);
         category_halder item = new category_halder();
         item.a = temp1;
         item.b = temp2;
         item.c = temp3;
         item.f = temp4;
         temp4.DropDownStyle = f.DropDownStyle;
         temp4.ValueMember   = "id";
         temp4.DisplayMember = "name";
         categories.Add(item);
     }
 }
예제 #4
0
파일: Form1.cs 프로젝트: Golgannet/kurs
        private void button8_Click(object sender, EventArgs e)
        {
            this_smena.Clear();
            category_halder category = categories2[tabControl3.SelectedIndex - 1];
            string          antibugg;

            foreach (string categ in category.d.Text.Split(','))
            {
                antibugg = categ;
                if (categ[0] == ' ')
                {
                    antibugg = categ.Remove(0, 1);
                }
                foreach (archer_comp archer in this_comp)
                {
                    this_smena.Add(archer);
                }
            }

            double sheild_col = Convert.ToInt32(numericUpDown1.Value);
            int    l          = Convert.ToInt32(numericUpDown1.Value);
            double archer_col = this_smena.Count();

            numericUpDown1.Minimum = Convert.ToDecimal(archer_col / 8);
            if (archer_col % 8 != 0)
            {
                numericUpDown1.Minimum++;
            }
            //archer_comp archer = this_smena[k];
            //archer.stand += letters2[j];
            string[]      letters  = { "A", "B", "C", "D", "E", "F", "G", "H" };
            List <string> letters2 = new List <string>()
            {
            };
            Random rnd = new Random();

            smena_ubdate();
        }
예제 #5
0
파일: Form1.cs 프로젝트: Golgannet/kurs
 public void smena_ubdate()
 {
     foreach (category_halder category in categories2)
     {
         category_halder category1 = categories2[tabControl3.SelectedIndex - 1];
         string          antibugg;
         DataGridView    l1 = smena_tables[tabControl3.SelectedIndex - 1];
         foreach (string categ in category.d.Text.Split(','))
         {
             l1.Rows.Add("", "", categ);
             antibugg = categ;
             if (categ[0] == ' ')
             {
                 antibugg = categ.Remove(0, 1);
             }
             foreach (archer_comp archer in this_comp)
             {
                 if (archer.description == antibugg)
                 {
                     l1.Rows.Add(
                         archer.stand,
                         archer.plase,
                         archer.fio,
                         archer.age.ToString("dd:MM:yyyy"),
                         archer.rang,
                         archer.region,
                         archer.vedomstvo,
                         archer.sp_organization,
                         archer.round,
                         archer.tens,
                         archer.x,
                         archer.summ);
                 }
             }
             l1.Rows.Add();
         }
     }
 }
예제 #6
0
파일: Form1.cs 프로젝트: Golgannet/kurs
        private void Form1_Load(object sender, EventArgs e)
        {
            //checkedComboBox1.Items.Add(12);
            //checkedComboBox1.Items.Add(18);
            //checkedComboBox1.Items.Add(30);
            //checkedComboBox1.Items.Add(40);
            //checkedComboBox1.Items.Add(50);
            //checkedComboBox1.Items.Add(60);
            //checkedComboBox1.Items.Add(70);
            //checkedComboBox1.Items.Add(90);
            //checkedComboBox1.Items.Add("M1");
            int i5 = 1;

            foreach (DataGridViewColumn obj in dataGridView3.Columns)
            {
                i5++;
                DataGridViewColumn col = new DataGridViewColumn();
                col.Width        = obj.Width;
                col.CellTemplate = new DataGridViewTextBoxCell();
                col.HeaderText   = obj.HeaderText;
                col.Name         = "col" + i5.ToString();
                dataGridView2.Columns.Add(col);
            }
            category_halder item = new category_halder();

            item.a = textBox2;
            item.b = comboBox3;
            item.c = comboBox4;
            item.f = comboBox1;
            categories.Add(item);

            m_sqlCmd   = new SQLiteCommand();
            dbFileName = "sample.sqlite";
            //lbStatusText.Text = "Disconnected";
            if (!File.Exists(dbFileName))
            {
                SQLiteConnection.CreateFile(dbFileName);
            }
            try
            {
                m_dbConn = new SQLiteConnection("Data Source=" + dbFileName + ";Version=3;");
                m_dbConn.Open();
            }
            catch (SQLiteException ex)
            {
                MessageBox.Show("Error: " + ex.Message);
            }
            Form2 example2 = new Form2();

            if (!example2.cost)
            {
                example2.ShowDialog();
                this.Show();
            }
            if (File.Exists("this_comp.txt"))
            {
                FileStream   file1  = new FileStream("this_comp.txt", FileMode.Open);
                StreamReader reader = new StreamReader(file1);
                string       id     = (reader.ReadToEnd());
                reader.Close();
                if (id != "")
                {
                    splitContainer2.Enabled = false;
                }
                else
                {
                    string           sqlQuery = "select * from  distantions";
                    SQLiteCommand    command  = new SQLiteCommand(sqlQuery, m_dbConn);
                    SQLiteDataReader dist     = command.ExecuteReader();
                    while (dist.Read())
                    {
                        distantion categ = new distantion();
                        categ.id                = dist["id"].ToString();
                        categ.name              = dist["title"].ToString();
                        categ.rounds_col        = Convert.ToInt32(dist["rounds_col"]);
                        comboBox1.ValueMember   = "id";
                        comboBox1.DisplayMember = "name";
                        comboBox1.Items.Add(categ);
                    }
                    comboBox1.ValueMember   = "id";
                    comboBox1.DisplayMember = "name";
                    comboBox1.SelectedItem  = comboBox3.Items[0];
                }
            }
            competition_list();
        }