예제 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            int  a      = 0;
            bool finish = true;

            foreach (DataGridViewRow row in dataGridView1.Rows)
            {
                if (int.TryParse(row.Cells[2].Value.ToString(), out a) == true || row.Cells[2].Value.ToString() == "")
                {
                    if (a < 10)
                    {
                        MySqlOperations.Insert_Update_Delete(MySqlQueries.Update_Otmetki, row.Cells[0].Value.ToString(), row.Cells[2].Value.ToString());
                    }
                    else
                    {
                        MessageBox.Show("В качестве отметки для " + row.Cells[1].Value.ToString() + " было выставлено число, превышающее 10.", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        finish = false;
                    }
                }
                else
                {
                    MessageBox.Show("В качестве отметки для " + row.Cells[1].Value.ToString() + " было выставлено не число.", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    finish = false;
                }
            }
            MySqlOperations.Insert_Update_Delete(MySqlQueries.Update_Homework, ID_Homework, richTextBox1.Text);
            if (finish)
            {
                this.Close();
            }
        }
예제 #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (MySqlOperations.Select_Text(MySqlQueries.Exists_Klassy, null, numericUpDown1.Value.ToString(), comboBox1.Text) == "0")
     {
         MySqlOperations.Insert_Update_Delete(MySqlQueries.Insert_Klassy, null, numericUpDown1.Value.ToString(), comboBox1.Text, numericUpDown2.Value.ToString());
         this.Close();
     }
     else
     {
         MessageBox.Show("Класс " + numericUpDown1.Value.ToString() + comboBox1.Text + " уже присутствует в базе.", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
예제 #3
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (dateTimePicker2.Value < dateTimePicker3.Value)
     {
         string date  = dateTimePicker1.Value.Year.ToString() + '-' + dateTimePicker1.Value.Month.ToString() + '-' + dateTimePicker1.Value.Day.ToString();
         string time1 = dateTimePicker2.Value.Hour.ToString() + ':' + dateTimePicker2.Value.Minute.ToString();
         string time2 = dateTimePicker3.Value.Hour.ToString() + ':' + dateTimePicker3.Value.Minute.ToString();
         MySqlOperations.Insert_Update_Delete(MySqlQueries.Insert_Fakultativy, null, MySqlOperations.Select_Text(MySqlQueries.Select_ID_Predmety_ComboBox, null, comboBox1.Text), MySqlOperations.Select_Text(MySqlQueries.Select_ID_Prepod_ComboBox, null, comboBox3.Text), date, MySqlOperations.Select_Text(MySqlQueries.Select_ID_Auditorii_ComboBox, null, comboBox2.Text), time1, time2);
         this.Close();
     }
     else
     {
         MessageBox.Show("Факультатив не может начаться позже времени его окончания.", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
예제 #4
0
 private void button4_Click(object sender, EventArgs e)
 {
     if (MySqlOperations.Select_Text(MySqlQueries.Exists_Raspisanie, null, MySqlOperations.Select_Text(MySqlQueries.Select_ID_Klassy_ComboBox, null, comboBox1.Text), comboBox2.Text) == "0")
     {
         MySqlOperations.Insert_Update_Delete(MySqlQueries.Insert_Raspisanie, null, MySqlOperations.Select_Text(MySqlQueries.Select_ID_Klassy_ComboBox, null, comboBox1.Text), comboBox2.Text);
         ID = MySqlOperations.Select_Text(MySqlQueries.Select_Last_ID);
         button4.Enabled   = false;
         button3.Text      = "Закрыть";
         groupBox1.Visible = true;
         MySqlOperations.Select_DataGridView(MySqlQueries.Select_Uroki_Raspisaniya, dataGridView1);
         dataGridView1.Columns[0].Visible = false;
     }
     else
     {
         MessageBox.Show("Для " + comboBox1.Text + " класса уже присутствует расписание на " + comboBox2.Text + ".", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
예제 #5
0
 private void Delete_String()
 {
     foreach (DataGridViewRow row in dataGridView1.SelectedRows)
     {
         if (identify == "auditorii")
         {
             MySqlOperations.Insert_Update_Delete(MySqlQueries.Delete_Auditorii, row.Cells[0].Value.ToString());
         }
         if (identify == "predmety")
         {
             MySqlOperations.Insert_Update_Delete(MySqlQueries.Delete_Predmety, row.Cells[0].Value.ToString());
         }
         if (identify == "fakultativy")
         {
             MySqlOperations.Insert_Update_Delete(MySqlQueries.Delete_Fakultativy, row.Cells[0].Value.ToString());
         }
         if (identify == "klassy")
         {
             MySqlOperations.Insert_Update_Delete(MySqlQueries.Delete_Klassy, row.Cells[0].Value.ToString());
         }
         if (identify == "prepod")
         {
             MySqlOperations.Insert_Update_Delete(MySqlQueries.Delete_Prepod, row.Cells[0].Value.ToString());
         }
         if (identify == "ucheniki")
         {
             MySqlOperations.Insert_Update_Delete(MySqlQueries.Delete_Ucheniki, row.Cells[0].Value.ToString());
         }
         if (identify == "raspisanie")
         {
             MySqlOperations.Insert_Update_Delete(MySqlQueries.Delete_Raspisanie, row.Cells[0].Value.ToString());
         }
     }
 }
예제 #6
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (textBox1.Text != "")
     {
         if (MySqlOperations.Select_Text(MySqlQueries.Exists_Auditorii, null, textBox1.Text) == "0")
         {
             MySqlOperations.Insert_Update_Delete(MySqlQueries.Insert_Auditorii, null, textBox1.Text);
             this.Close();
         }
         else
         {
             MessageBox.Show("Аудитория №" + textBox1.Text + " уже присутствует в базе.", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
     else
     {
         MessageBox.Show("Поля не заполнены", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
예제 #7
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (textBox1.Text != "" && textBox2.Text != "" && textBox3.Text != "" && textBox4.Text != "" && textBox5.Text != "")
     {
         if (MySqlOperations.Select_Text(MySqlQueries.Exists_Prepod, null, textBox4.Text, textBox5.Text) != "1")
         {
             MySqlOperations.Insert_Update_Delete(MySqlQueries.Insert_Prepod, null, textBox1.Text, textBox2.Text, textBox3.Text, MySqlOperations.Select_Text(MySqlQueries.Select_ID_Predmety_ComboBox, null, comboBox1.Text), textBox4.Text, textBox5.Text);
             this.Close();
         }
         else
         {
             MessageBox.Show("Введенный вами Логин и(или) Пароль уже заняты.", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
     else
     {
         MessageBox.Show("Поля не заполнены.", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
예제 #8
0
        private void Insert_Zanyatiya(DataGridView dataGridView)
        {
            DateTime Now  = DateTime.Now;
            string   date = Now.Year.ToString() + '-' + Now.Month.ToString() + '-' + Now.Day.ToString();

            if (Exists == true)
            {
                if (MySqlOperations.Select_Text(MySqlQueries.Exists_Zanyatiya, null, dataGridView.SelectedRows[0].Cells[0].Value.ToString(), date, ID_Prepoda) == "0")
                {
                    if (MessageBox.Show("Хотите заполнить занятие?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        MySqlOperations.Insert_Update_Delete(MySqlQueries.Insert_Zanyatiya, null, dataGridView.SelectedRows[0].Cells[0].Value.ToString(), date, ID_Prepoda);
                        string    ID_Zanyatiya = MySqlOperations.Select_Text(MySqlQueries.Select_Last_ID);
                        DataTable dataTable    = MySqlOperations.Select_DataTable(MySqlQueries.Select_ID_Ucheniki_Klassa, null, dataGridView.SelectedRows[0].Cells[1].Value.ToString());
                        foreach (DataRow row in dataTable.Rows)
                        {
                            MySqlOperations.Insert_Update_Delete(MySqlQueries.Insert_Otmetki, null, row[0].ToString(), ID_Zanyatiya, "");
                        }
                        do
                        {
                            Now = Now.AddDays(1);
                        }while (MySqlOperations.Select_Text(MySqlQueries.Exists_Zanyatiya_Today, ID_Prepoda, Now.ToString("dddd", new CultureInfo("ru-RU")).Substring(0, 1).ToUpper() + Now.ToString("dddd", new CultureInfo("ru-RU")).Remove(0, 1).ToLower()) != "1");
                        MySqlOperations.Insert_Update_Delete(MySqlQueries.Insert_Homework, null, ID_Zanyatiya, Now.Year.ToString() + '-' + Now.Month.ToString() + '-' + Now.Day.ToString(),
                                                             MySqlOperations.Select_Text(MySqlQueries.Select_Urok_Homework, ID_Prepoda, Now.ToString("dddd", new CultureInfo("ru-RU")).Substring(0, 1).ToUpper() + Now.ToString("dddd", new CultureInfo("ru-RU")).Remove(0, 1).ToLower(),
                                                                                         MySqlOperations.Select_Text(MySqlQueries.Select_ID_Klassy_ComboBox, null, dataGridView.SelectedRows[0].Cells[1].Value.ToString())));
                        string    ID_Homework = MySqlOperations.Select_Text(MySqlQueries.Select_Last_ID);
                        Zanyatiya zanyatiya   = new Zanyatiya(MySqlQueries, MySqlOperations, ID_Zanyatiya, ID_Homework);
                        zanyatiya.Text             += ID_Zanyatiya;
                        zanyatiya.Zanyatiya_Closed += Load_Zanyatiya;
                        zanyatiya.Show();
                    }
                }
                else if (MessageBox.Show("Хотите отредактровать занятие?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    Open_Zanyatiya(MySqlOperations.Select_Text(MySqlQueries.Select_ID_Zanyatiya, null, dataGridView.SelectedRows[0].Cells[0].Value.ToString(), date, ID_Prepoda),
                                   MySqlOperations.Select_Text(MySqlQueries.Select_ID_Homework, MySqlOperations.Select_Text(MySqlQueries.Select_ID_Zanyatiya, null, dataGridView.SelectedRows[0].Cells[0].Value.ToString(), date, ID_Prepoda)));
                }
            }
        }