Ejemplo n.º 1
0
        private void Open_Zanyatiya(string ID, string ID2)
        {
            Zanyatiya zanyatiya = new Zanyatiya(MySqlQueries, MySqlOperations, ID, ID2);

            zanyatiya.Text             += ID;
            zanyatiya.Zanyatiya_Closed += Load_Zanyatiya;
            zanyatiya.Show();
        }
Ejemplo n.º 2
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)));
                }
            }
        }