private void DelButton_Click(object sender, EventArgs e) //кнопка для удаления пользователя { if (Users.SelectedItems.Count != 0) { string UserName = Convert.ToString(Users.SelectedItems[0].SubItems[0].Text); DialogResult result = MessageBox.Show("Вы подтверждаете удаление пользователя " + UserName + " ?", "Подтверждение удаления", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { try { sql.command.CommandText = "UPDATE Users SET login = '', name = '', password = '', role = '', departID = '', del = '1' WHERE name LIKE '" + UserName + "' "; sql.command.ExecuteNonQuery(); SQLHistory SqlH = new SQLHistory(); //Сохранение изменений в историю SqlH.SqlRequest(sql.command.CommandText); MessageBox.Show("Пользователь '" + UserName + "' успешно удален!"); } catch (SQLiteException ex) { MessageBox.Show("Error:" + ex.Message); } } Users.Items.Clear(); LoadData(); } }
private void AddBtn_Click(object sender, EventArgs e) { if (DepName != NameOfDep.Text || selectedIndexOfMajor != DepartMajor.SelectedIndex) { try { if (selectedIndexOfMajor != DepartMajor.SelectedIndex) { sql.command.CommandText = "SELECT id FROM Users WHERE del = '0' AND name LIKE '" + DepartMajor.SelectedItem + "' "; SQLiteDataReader read2 = sql.command.ExecuteReader(); while (read2.Read()) { selectedIDOfMajor = Convert.ToInt32(read2["id"]); } read2.Close(); } sql.command.CommandText = "UPDATE Department SET name ='" + NameOfDep.Text + "', majorID = '" + selectedIDOfMajor + "' WHERE id = '" + DataClass.DepartID + "' "; sql.command.ExecuteNonQuery(); SQLHistory SqlH = new SQLHistory(); //Сохранение изменений в историю SqlH.SqlRequest(sql.command.CommandText); MessageBox.Show("Данные отдела '" + NameOfDep.Text + "' успешно изменен!"); DepartmentForm departmentForm = new DepartmentForm(); departmentForm.Show(); this.Hide(); } catch (SQLiteException ex) { MessageBox.Show("Error:" + ex.Message); } } else { MessageBox.Show("Данные не изменялись!"); } }
private void FileDel(string PathToDel, int id) //TO DO { try { sql.command.CommandText = "UPDATE ExtraDoc SET name = '', docID = '', del = '1' WHERE id = '" + id + "' "; sql.command.ExecuteNonQuery(); SQLHistory SqlH = new SQLHistory(); //Сохранение изменений в историю SqlH.SqlRequest(sql.command.CommandText); } catch (SQLiteException ex) { MessageBox.Show("Error:" + ex.Message); } MessageBox.Show("Файл '" + Path.GetFileName(PathToDel) + "' успешно удален!"); File.Delete(PathToDel); LoadData(); /*this.Controls.Add(buttonToAdd); * this.Controls.Remove(this.) * this.Controls.Remove((buttonToAdd)sender); * AddButton.Visible = false;*/ FileList fileList = new FileList();//костыль this.Hide(); fileList.Show(); }
private void AddBtn_Click(object sender, EventArgs e) { int NewDepID = 0; try //Если поменяли отдел, то юзер больше ни за что не ответственный в своем старом отделе { sql.command.CommandText = "SELECT id FROM Department WHERE name LIKE '" + DepartChoose.SelectedItem + "' "; SQLiteDataReader read2 = sql.command.ExecuteReader(); while (read2.Read()) { NewDepID = Convert.ToInt32(read2["id"]); //Записываю в старую переменную от departID новый departID } read2.Close(); if (SDepartID != NewDepID) //Если отдел поменялся, то снимаем пользователя с ответственных мест в других отделах { sql.command.CommandText = "UPDATE Case1 SET majorID = 'NULL' WHERE majorID = '" + SID + "' "; sql.command.ExecuteNonQuery(); SQLHistory SqlH = new SQLHistory(); //Сохранение изменений в историю SqlH.SqlRequest(sql.command.CommandText); sql.command.CommandText = "UPDATE Document SET majorID = 'NULL' WHERE majorID = '" + SID + "' "; sql.command.ExecuteNonQuery(); SqlH.SqlRequest(sql.command.CommandText); } } catch (SQLiteException ex) { MessageBox.Show("Error:" + ex.Message); } if (SName != NameOfUser.Text || SLog != LogOfUser.Text || SPas != PasswordOfUser.Text || Role.SelectedIndex != SRole || DepIndex != DepartChoose.SelectedIndex) { try { sql.command.CommandText = "UPDATE Users SET login = '******', name = '" + NameOfUser.Text + "', password = '******', role = '" + Role.SelectedIndex + "', departID = '" + NewDepID + "' WHERE del = '0' AND id ='" + SID + "'"; sql.command.ExecuteNonQuery(); SQLHistory SqlH = new SQLHistory(); //Сохранение изменений в историю SqlH.SqlRequest(sql.command.CommandText); MessageBox.Show("Данные пользователя '" + DataClass.ChangeUserName + "' успешно изменены!"); DataClass.ChangeUserName = ""; this.Hide(); } catch (SQLiteException ex) { MessageBox.Show("Error:" + ex.Message); } } else { MessageBox.Show("Данные не изменялись."); } Settings settings = new Settings(); settings.Show(); this.Hide(); }
private void AddBtn_Click(object sender, EventArgs e) { if (NameOfCase.Text != CaseName || NumberOfCase.Text != CaseNumber || selectedIndexOfMajor != DepartMajor.SelectedIndex) { sql.command.CommandText = "SELECT id FROM Users WHERE del = '0' AND name LIKE '" + DepartMajor.SelectedItem + "' "; SQLiteDataReader read2 = sql.command.ExecuteReader(); while (read2.Read()) { IDOfMajor = Convert.ToInt32(read2["id"]); } read2.Close(); sql.command.CommandText = "UPDATE Case1 SET name ='" + NameOfCase.Text + "', number ='" + NumberOfCase.Text + "', majorID = '" + IDOfMajor + "' WHERE id = '" + DataClass.CaseID + "' "; sql.command.ExecuteNonQuery(); SQLHistory SqlH = new SQLHistory(); //Сохранение изменений в историю SqlH.SqlRequest(sql.command.CommandText); MessageBox.Show("Данные дела '" + NameOfCase.Text + "' успешно изменены!"); CaseForm caseForm = new CaseForm(); caseForm.Show(); this.Hide(); } else { MessageBox.Show("Данные не изменялись!"); } }
private void button6_Click(object sender, EventArgs e) { DialogResult result = MessageBox.Show("Вы подтверждаете удаление документа " + DockName.Text + " ?", "Подтверждение удаления", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { if (System.IO.File.Exists(FileD)) { System.IO.File.Delete(FileD); } else { MessageBox.Show("Ошибка наличия файла!"); } try { sql.command.CommandText = "SELECT id, name FROM ExtraDoc WHERE DocID='" + DataClass.DocID + "' "; SQLiteDataReader read01 = sql.command.ExecuteReader(); while (read01.Read()) { if (System.IO.File.Exists(read01["name"].ToString())) { System.IO.File.Delete(read01["name"].ToString()); } else { MessageBox.Show("Ошибка наличия файла!"); } } read01.Close(); SQLHistory SqlH = new SQLHistory(); //Сохранение изменений в историю SqlH.SqlRequest(sql.command.CommandText); sql.command.CommandText = "UPDATE ExtraDoc SET name = '', docID = '', del = '1' WHERE DocID='" + DataClass.DocID + "' "; sql.command.ExecuteNonQuery(); SqlH.SqlRequest(sql.command.CommandText); sql.command.CommandText = "UPDATE Document SET name = '', number = '', majorID = '', caseID = '', departID = '', thom = '', thomPage = '',type = '', date = '', author = '', executors = '', dateOfExecution = '',phaseOfExecution = '',resolution = '',NNPages = '',physicalLocation = '',synopsis = '',file = '',savingTime = '', isThisFileDel = '1', deleteDate = '', extraFiles = '0' WHERE id ='" + DataClass.DocID + "' "; sql.command.ExecuteNonQuery(); SqlH.SqlRequest(sql.command.CommandText); DataClass.DocID = 0; this.Hide(); CaseForm caseForm = new CaseForm(); caseForm.Show(); } catch (SQLiteException ex) { MessageBox.Show("Error:" + ex.Message); } } }
private void ToDel1_Click(object sender, EventArgs e) //не работает извлечение адреса из экстра в докс при удалении основной записи { if (fileName1.Text == "") { MessageBox.Show("Файл для удаления не найден!"); } else { DialogResult result = MessageBox.Show("Вы подтверждаете удаление файла " + FileName1 + " ?", "Подтверждение удаления", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { try { //удаление путя из бд sql.command.CommandText = " UPDATE Document SET file = '', extraFiles = '0' WHERE id = '" + DataClass.DocID + "' "; sql.command.ExecuteNonQuery(); SQLHistory SqlH = new SQLHistory(); //Сохранение изменений в историю SqlH.SqlRequest(sql.command.CommandText); MessageBox.Show("Файл '" + FileName1 + "' успешно удален!"); int q = 0; while (q < 9) { if (ExtraDoc[q] != "") { sql.command.CommandText = "UPDATE Document SET file = '" + ExtraDoc[q] + "' WHERE id = '" + DataClass.DocID + "' "; sql.command.ExecuteNonQuery(); SqlH.SqlRequest(sql.command.CommandText); //история sql.command.CommandText = "UPDATE ExtraDoc SET docID = '', name = '', del = '1' WHERE id = '" + ExtraDocID[q] + "' "; sql.command.ExecuteNonQuery(); SqlH.SqlRequest(sql.command.CommandText);//история q = 9; } q += 1; } } catch (SQLiteException ex) { MessageBox.Show("Error:" + ex.Message); } //непосредственно удаление файла //System.Diagnostics.Process.Start(@FilePath1); File.Delete(@FilePath1); FileList fileList = new FileList();//костыль this.Hide(); fileList.Show(); } LoadData(); } }
private void AddBtn_Click(object sender, EventArgs e) { if (NameOfNewUser.Text == "" || LogOfNewUser.Text == "" || PasswordOfNewUser.Text == "" || Role.SelectedItem == null || DepartChoose.SelectedItem == null) { MessageBox.Show("Заполнены не все обязательные поля!"); } else { try { int DepID = 0; sql.command.CommandText = "SELECT id FROM Department WHERE name LIKE '" + DepartChoose.SelectedItem + "' "; SQLiteDataReader read2 = sql.command.ExecuteReader(); while (read2.Read()) { DepID = Convert.ToInt32(read2["id"]); } read2.Close(); int Rol = 3; if (Role.SelectedItem.ToString() == "Администратор") { Rol = 0; } else { Rol = 1; } sql.command.CommandText = "INSERT INTO Users (login, name, password, role, departID) VALUES( '" + LogOfNewUser.Text + "','" + NameOfNewUser.Text + "','" + PasswordOfNewUser.Text + "','" + Rol + "','" + DepID + "') "; sql.command.ExecuteNonQuery(); SQLHistory SqlH = new SQLHistory(); //Сохранение изменений в историю SqlH.SqlRequest(sql.command.CommandText); MessageBox.Show("Пользователь '" + NameOfNewUser.Text + "' успешно добавлен!"); Settings settings = new Settings(); settings.Show(); this.Hide(); } catch (SQLiteException ex) { MessageBox.Show("Error:" + ex.Message); } } }
private void ToDel2_Click(object sender, EventArgs e) { FileDel(ExtraDoc[0], ExtraDocID[0]); if (ExtraDoc[1] == "") { try { sql.command.CommandText = "UPDATE Document SET extraFiles = '0' WHERE id = '" + DataClass.DocID + "' "; sql.command.ExecuteNonQuery(); SQLHistory SqlH = new SQLHistory(); //Сохранение изменений в историю SqlH.SqlRequest(sql.command.CommandText); } catch (SQLiteException ex) { MessageBox.Show("Error:" + ex.Message); } } }
private void btnCheckLogin_Click(object sender, EventArgs e) { if (NameOfNewDep.Text == "") //tbCheckLogin.Text == "" && tbCheckPassword.Text == "" { MessageBox.Show("Введите название нового отдела!"); } else { if (comboBox1.Text == "") { MessageBox.Show("Выберите имя начальника отдела!"); } else { try { sql.command.CommandText = "SELECT id FROM Users WHERE name LIKE '" + comboBox1.SelectedItem + "' AND del = '0' "; SQLiteDataReader read1 = sql.command.ExecuteReader(); int ID = 0; while (read1.Read()) { ID = Convert.ToInt32(read1["id"]); } read1.Close(); sql.command.CommandText = "INSERT INTO Department (name, majorID) VALUES( '" + NameOfNewDep.Text + "', '" + ID + "' )"; sql.command.ExecuteNonQuery(); SQLHistory SqlH = new SQLHistory(); //Сохранение изменений в историю SqlH.SqlRequest(sql.command.CommandText); MessageBox.Show(NameOfNewDep.Text + " успешно добавлен!"); //Сообщение об успешном добавлении отдела this.Hide(); //Переход к окну отделов MainForm departForm = new MainForm(); departForm.Show(); } catch (SQLiteException ex) { MessageBox.Show("Error:" + ex.Message); } } } }
private void button1_Click(object sender, EventArgs e) { DialogResult result = MessageBox.Show("Вы подтверждаете удаление отдела '" + DepName + "' ?", "Подтверждение удаления", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { try { sql.command.CommandText = "UPDATE Department SET name = '', majorID = '', del = '1' WHERE id = '" + DataClass.DepartID + "' "; sql.command.ExecuteNonQuery(); SQLHistory SqlH = new SQLHistory(); //Сохранение изменений в историю SqlH.SqlRequest(sql.command.CommandText); MessageBox.Show("Отдел '" + DepName + "' успешно удален!"); DataClass.DepartID = 0; MainForm mainForm = new MainForm(); mainForm.Show(); this.Hide(); } catch (SQLiteException ex) { MessageBox.Show("Error:" + ex.Message); } } }
private void ButtonOnClick(object sender, EventArgs eventArgs) { var button = (Button)sender; if (fileName1.Visible) //Добавляем файлы в ExtraDoc { string newLocation = ""; string folderLocation = PrintStartupPath(); var OFD = new System.Windows.Forms.OpenFileDialog(); if (OFD.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string fileToCopy = OFD.FileName; if (System.IO.File.Exists(fileToCopy)) { var onlyFileName = System.IO.Path.GetFileName(OFD.FileName); newLocation = folderLocation + @"\" + onlyFileName; System.IO.File.Copy(fileToCopy, newLocation, true); try { sql.command.CommandText = "INSERT INTO ExtraDoc (docID, name) VALUES('" + DataClass.DocID + "', '" + newLocation + "')"; sql.command.ExecuteNonQuery(); SQLHistory SqlH = new SQLHistory(); //Сохранение изменений в историю SqlH.SqlRequest(sql.command.CommandText); sql.command.CommandText = "UPDATE Document SET extraFiles = '1' WHERE id = '" + DataClass.DocID + "' "; sql.command.ExecuteNonQuery(); SqlH.SqlRequest(sql.command.CommandText); } catch (Exception ex) { MessageBox.Show("Error:" + ex.Message); } MessageBox.Show("Файл успешно добавлен!"); } else { MessageBox.Show("Такого файла нет!"); } } else { MessageBox.Show("Такой папки нет!"); } } else //Добавляем файл в Documents { string newLocation = ""; string folderLocation = PrintStartupPath(); var OFD = new System.Windows.Forms.OpenFileDialog(); if (OFD.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string fileToCopy = OFD.FileName; if (System.IO.File.Exists(fileToCopy)) { var onlyFileName = System.IO.Path.GetFileName(OFD.FileName); newLocation = folderLocation + @"\" + onlyFileName; System.IO.File.Copy(fileToCopy, newLocation, true); try { sql.command.CommandText = "UPDATE Document SET file = '" + newLocation + "' WHERE id = '" + DataClass.DocID + "' "; sql.command.ExecuteNonQuery(); SQLHistory SqlH = new SQLHistory(); //Сохранение изменений в историю SqlH.SqlRequest(sql.command.CommandText); } catch (Exception ex) { MessageBox.Show("Error:" + ex.Message); } } else { MessageBox.Show("Такого файла нет!"); } } else { MessageBox.Show("Такой папки нет!"); } } LoadData(); }
private void button6_Click(object sender, EventArgs e) { string DToDel = ""; for (int i = 0; i < DelDocs.CheckedItems.Count; i++) { //int id = Convert.ToInt32(DelDocs.CheckedItems[i].Tag); /*sql.command.CommandText = "UPDATE Photos SET ifEx = '0' WHERE id = '" + id + "' "; * sql.command.ExecuteNonQuery();*/ DToDel = DelDocs.CheckedItems[i].Text.ToString(); DialogResult result = MessageBox.Show("Вы подтверждаете удаление документа " + DToDel + " ?", "Подтверждение удаления", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { int id = 0; bool Efile = false; string file = ""; try { sql.command.CommandText = "SELECT id, file, extraFiles FROM Document WHERE name LIKE '" + DToDel + "'"; SQLiteDataReader read3 = sql.command.ExecuteReader(); while (read3.Read()) { id = Convert.ToInt32(read3["id"]); Efile = Convert.ToBoolean(read3["extraFiles"]); file = Convert.ToString(read3["file"]); } read3.Close(); } catch (SQLiteException ex) { MessageBox.Show("Error:" + ex.Message); } if (System.IO.File.Exists(file)) { System.IO.File.Delete(file); } else { MessageBox.Show("Ошибка наличия файла!"); } try { if (Efile) { sql.command.CommandText = "SELECT id, name FROM ExtraDoc WHERE DocID='" + id + "' "; SQLiteDataReader read01 = sql.command.ExecuteReader(); while (read01.Read()) { if (System.IO.File.Exists(read01["name"].ToString())) { System.IO.File.Delete(read01["name"].ToString()); } else { MessageBox.Show("Ошибка наличия файла!"); } } read01.Close(); SQLHistory Sql = new SQLHistory(); //Сохранение изменений в историю Sql.SqlRequest(sql.command.CommandText); } sql.command.CommandText = "UPDATE ExtraDoc SET name = '', docID = '', del = '1' WHERE DocID='" + id + "' "; sql.command.ExecuteNonQuery(); SQLHistory SqlH = new SQLHistory(); //Сохранение изменений в историю SqlH.SqlRequest(sql.command.CommandText); sql.command.CommandText = "UPDATE Document SET name = '', number = '', majorID = '', caseID = '', departID = '', thom = '', thomPage = '',type = '', date = '', author = '', executors = '', dateOfExecution = '',phaseOfExecution = '',resolution = '',NNPages = '',physicalLocation = '',synopsis = '',file = '',savingTime = '', isThisFileDel = '1', deleteDate = '', extraFiles = '0' WHERE id ='" + id + "' "; sql.command.ExecuteNonQuery(); SqlH.SqlRequest(sql.command.CommandText); } catch (SQLiteException ex) { MessageBox.Show("Error:" + ex.Message); } } } MessageBox.Show("Удаление прошло успешно!"); DelDocs.Items.Clear(); LoadDataToDel(); }
private void ChangeDataButton_Click(object sender, EventArgs e) { if (DockName.Text == "" || Number.Text == "" || NumberOfThom.Text == "" || NameOfMajor.SelectedItem == null || NameOfCase.SelectedItem == null || DockType.Text == "" || DateOfDoc.Text == "" || PhysicalLocation.Text == "" || DeleteDate.Text == "") { MessageBox.Show("Заполнены не все обязательные поля!"); } else { bool a = Convert.ToBoolean(String.Compare(MajorIDS, NameOfMajor.SelectedItem.ToString())); bool b = Convert.ToBoolean(String.Compare(CaseIDS, NameOfCase.SelectedItem.ToString())); if (DockName.Text != DockNameD || Number.Text != NumberD || MajorIDS != NameOfCase.SelectedItem.ToString() || a || b || NumberOfThom.Text != NumberOfThomD || DockType.Text != DockTypeD || DateOfDoc.Text != DateOfDocD || Author.Text != AuthorD || Executors.Text != ExecutorsD || DateOfExecution.Text != DateOfExecutionD || PhaseOfExecution.Text != PhaseOfExecutionD || Resolution.Text != ResolutionD || NNPages.Text != NNPagesD || PhysicalLocation.Text != PhysicalLocationD || Synopsis.Text != SynopsisD || //File.Text != FileD || SavingTime.Text != SavingTimeS || DeleteDate.Text != DeleteDateS) { try { sql.command.CommandText = "SELECT id FROM Users Where name LIKE '" + NameOfMajor.SelectedItem + "' AND del = '0'"; SQLiteDataReader read0 = sql.command.ExecuteReader(); int mID = 0; while (read0.Read()) { mID = Convert.ToInt32(read0["id"]); } read0.Close(); sql.command.CommandText = "SELECT id FROM Case1 Where name LIKE '" + NameOfCase.SelectedItem + "' AND del = '0'"; SQLiteDataReader read1 = sql.command.ExecuteReader(); int cID = 0; while (read1.Read()) { cID = Convert.ToInt32(read1["id"]); } read1.Close(); sql.command.CommandText = "UPDATE Document SET name = '" + DockName.Text.ToLower() + "', number = '" + Number.Text.ToLower() + "', majorID = '" + mID + "', caseID = '" + cID + "', thom = '" + NumberOfThom.Text.ToLower() + "', type = '" + DockType.Text.ToLower() + "', date = '" + DateOfDoc.Text.ToLower() + "', author = '" + Author.Text.ToLower() + "', executors = '" + Executors.Text.ToLower() + "', dateOfExecution = '" + DateOfExecution.Text.ToLower() + "', PhaseOfExecution = '" + PhaseOfExecution.Text.ToLower() + "', resolution = '" + Resolution.Text.ToLower() + "', NNPages = '" + NNPages.Text.ToLower() + "', physicalLocation = '" + PhysicalLocation.Text.ToLower() + "', synopsis = '" + Synopsis.Text.ToLower() + //"', file = '" + File.Text.ToLower() + "', savingTime = '" + SavingTime.Text.ToLower() + "', deleteDate = '" + DeleteDate.Text.ToLower() + "' WHERE id = '" + DataClass.DocID + "' "; sql.command.ExecuteNonQuery(); SQLHistory SqlH = new SQLHistory(); SqlH.SqlRequest(sql.command.CommandText); //Сохранение изменений в историю MessageBox.Show("Данные успешно изменены!"); if (b) // Если изменено дело документа, то нас перебрасывает в это дело { DataClass.CaseID = cID; DataClass.DocID = 0; this.Hide(); CaseForm caseForm = new CaseForm(); caseForm.Show(); } else { DataClass.DocID = 0; CaseForm caseForm = new CaseForm(); this.Hide(); caseForm.Show(); } } catch (SQLiteException ex) { MessageBox.Show("Error:" + ex.Message); } } } }
private void ChangeDataButton_Click(object sender, EventArgs e) { if (DockName.Text == "" || Number.Text == "" || NameOfMajor.SelectedItem == null || NameOfCase.SelectedItem == null || NumberOfThom.Text == "" || DockType.Text == "" || DateOfDoc.Text == "" || PhysicalLocation.Text == "" || DeleteDate.Text == "" || Adress == "") { MessageBox.Show("Заполнены не все обязательные поля!"); } else { try //Добавление нового документа { //TO DO добавление ответственного, дела и отдела!!!!!!! sql.command.CommandText = "SELECT id FROM Users Where name LIKE '" + NameOfMajor.SelectedItem + "' "; SQLiteDataReader read0 = sql.command.ExecuteReader(); int mID = 0; while (read0.Read()) { mID = Convert.ToInt32(read0["id"]); } read0.Close(); sql.command.CommandText = "SELECT id FROM Case1 WHERE name LIKE '" + NameOfCase.SelectedItem + "' "; SQLiteDataReader read1 = sql.command.ExecuteReader(); int cID = 0; while (read1.Read()) { cID = Convert.ToInt32(read1["id"]); } read1.Close(); int extrFil = 0; if (ExtraDoc[0] != "")//проверка на наличие дополнительных файлов { extrFil = 1; } sql.command.CommandText = "INSERT INTO Document (name, number, majorID, caseID, departID, thom, type, date, author, executors, dateOfExecution, PhaseOfExecution, resolution, NNPages, physicalLocation, synopsis, file, savingTime, deleteDate, extraFiles) VALUES( '" + DockName.Text.ToLower() + "','" + Number.Text.ToLower() + "','" + mID + "','" + cID + "','" + DataClass.DepartID + "','" + NumberOfThom.Text.ToLower() + "','" + DockType.Text.ToLower() + "','" + DateOfDoc.Text.ToLower() + "','" + Author.Text.ToLower() + "','" + Executors.Text.ToLower() + "','" + DateOfExecution.Text.ToLower() + "','" + PhaseOfExecution.Text.ToLower() + "','" + Resolution.Text.ToLower() + "','" + NNPages.Text.ToLower() + "','" + PhysicalLocation.Text.ToLower() + "','" + Synopsis.Text.ToLower() + "','" + Adress + "','" + SavingTime.Text.ToLower() + "','" + DeleteDate.Text.ToLower() + "','" + extrFil + "' )"; sql.command.ExecuteNonQuery(); SQLHistory SqlH = new SQLHistory(); //Сохранение изменений в историю SqlH.SqlRequest(sql.command.CommandText); if (extrFil == 1) //добавление в бд адресов дополнительных файлов, при наличии таковых { int DocID = 0; sql.command.CommandText = "SELECT id FROM Document WHERE name LIKE '" + DockName.Text.ToLower() + "' "; SQLiteDataReader read2 = sql.command.ExecuteReader(); while (read2.Read()) { DocID = Convert.ToInt32(read2["id"]); } read2.Close(); int counter = 0; while (counter < 9) { if (ExtraDoc[counter] != "") { sql.command.CommandText = "INSERT INTO ExtraDoc (docID, name) VALUES('" + DocID + "' , '" + ExtraDoc[counter] + "' )"; sql.command.ExecuteNonQuery(); SqlH.SqlRequest(sql.command.CommandText); } counter += 1; } } MessageBox.Show("Документ '" + DockName.Text + "' успешно добавлен!"); this.Hide(); CaseForm caseForm = new CaseForm(); caseForm.Show(); } catch (SQLiteException ex) { MessageBox.Show("Error:" + ex.Message); } } }