private void downloadD2_Click(object sender, EventArgs e) { if (dataGridView2.RowCount == 0) { return; } int row = dataGridView2.CurrentRow.Index; int id = Convert.ToInt32(dataGridView2[0, row].Value); ScientificResearch scientificResearch = new ScientificResearch(new double[] { 2, 3, 4, 5, 6 }, new double[] { 8 }, new double[] { 8 }, new double[] { 2, 3, 4, 5, 6 }); scientificResearch.SetInObjectFromDataBase(id); scientificResearch.SetInWord(); }
private void finish_Click(object sender, EventArgs e) { if (!Data.IsFilled(fields)) { MessageBox.Show("Заполните пустые поля!", "Внимание"); return; } scientificResearch.period = maskedTextBoxPeriod.Text; scientificResearch.levels = scientificResearch.SetFromTables(scientificResearch.levels, tables); scientificResearch.documents = scientificResearch.SetFromTables(scientificResearch.documents, tablesB); scientificResearch.grants = scientificResearch.SetFromTables(scientificResearch.grants, tablesC); scientificResearch.performances = scientificResearch.SetFromTables(scientificResearch.performances, tablesA); OleDbCommand command = new OleDbCommand("INSERT INTO Scientific (Период, Статус, Уровень1,Уровень2,Уровень3,Уровень4,Уровень5, УровеньВ1, УровеньС1, УровеньА1, УровеньА2, УровеньА3, УровеньА4, УровеньА5, Результат)" + "VALUES(@Период, @Статус, @Уровень1,@Уровень2,@Уровень3,@Уровень4,@Уровень5, @УровеньВ1, @УровеньС1, @УровеньА1, @УровеньА2, @УровеньА3, @УровеньА4, @УровеньА5, @Результат)", Data.OleDbConnection); command.Parameters.AddWithValue("Период", scientificResearch.period.ToString()); command.Parameters.AddWithValue("Статус", scientificResearch.status.ToString()); command.Parameters.AddWithValue("Уровень1", scientificResearch.levels[0].SetEventsInDataBase()); command.Parameters.AddWithValue("Уровень2", scientificResearch.levels[1].SetEventsInDataBase()); command.Parameters.AddWithValue("Уровень3", scientificResearch.levels[2].SetEventsInDataBase()); command.Parameters.AddWithValue("Уровень4", scientificResearch.levels[3].SetEventsInDataBase()); command.Parameters.AddWithValue("Уровень5", scientificResearch.levels[4].SetEventsInDataBase()); command.Parameters.AddWithValue("УровеньВ1", scientificResearch.documents[0].SetEventsInDataBase()); command.Parameters.AddWithValue("УровеньС1", scientificResearch.grants[0].SetEventsInDataBase()); command.Parameters.AddWithValue("УровеньА1", scientificResearch.performances[0].SetEventsInDataBase()); command.Parameters.AddWithValue("УровеньА2", scientificResearch.performances[1].SetEventsInDataBase()); command.Parameters.AddWithValue("УровеньА3", scientificResearch.performances[2].SetEventsInDataBase()); command.Parameters.AddWithValue("УровеньА4", scientificResearch.performances[3].SetEventsInDataBase()); command.Parameters.AddWithValue("УровеньА5", scientificResearch.performances[4].SetEventsInDataBase()); command.Parameters.AddWithValue("Результат", scientificResearch.result.ToString()); command.ExecuteNonQuery(); int id = 0; command = new OleDbCommand("SELECT @@IDENTITY AS id", Data.OleDbConnection); OleDbDataReader sqlReaderA = null; sqlReaderA = command.ExecuteReader(); while (sqlReaderA.Read()) { id = Convert.ToInt32(sqlReaderA["id"]); } if (sqlReaderA != null) { sqlReaderA.Close(); } scientificResearch.human.SetInDataBase(id); scientificResearch.SetInWord(); if (!Data.panel.Controls.Contains(Tables.Instance)) //если нет в массиве то добавляем { Data.panel.Controls.Add(Tables.Instance); Tables.Instance.Dock = DockStyle.Fill; Tables.Instance.BringToFront(); } else { Tables.Instance.BringToFront(); } }