コード例 #1
0
 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("Данные не изменялись!");
     }
 }
コード例 #2
0
ファイル: AddDoc.cs プロジェクト: strievskiy-n/MyDiplomaApp
        private void pictureBackBtn_Click(object sender, EventArgs e) //кнопка назад
        {
            this.Hide();
            CaseForm caseForm = new CaseForm();

            caseForm.Show();
        }
コード例 #3
0
        private void pictureBackBtn_Click(object sender, EventArgs e)
        {
            CaseForm caseForm = new CaseForm();

            caseForm.Show();
            this.Hide();
        }
コード例 #4
0
ファイル: DocForm.cs プロジェクト: strievskiy-n/MyDiplomaApp
        private void button3_Click(object sender, EventArgs e)
        {
            DataClass.DocID    = 0;
            DataClass.BackPage = "";
            this.Hide();
            CaseForm caseForm = new CaseForm();

            caseForm.Show();
        }
コード例 #5
0
ファイル: DocForm.cs プロジェクト: strievskiy-n/MyDiplomaApp
        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);
                }
            }
        }
コード例 #6
0
ファイル: DocForm.cs プロジェクト: strievskiy-n/MyDiplomaApp
 private void pictureBackBtn_Click(object sender, EventArgs e) //кнопка назад
 {
     if (DataClass.BackPage == "")
     {
         DataClass.DocID = 0;
         this.Hide();
         CaseForm caseForm = new CaseForm();
         caseForm.Show();
     }
     if (DataClass.BackPage != "")
     {
         DataClass.DocID    = 0;
         DataClass.CaseID   = 0;
         DataClass.DepartID = 0;
         DataClass.BackPage = "";
         Search search = new Search();
         search.Show();
         this.Hide();
     }
 }
コード例 #7
0
        private void ButtonOnClick(object sender, EventArgs eventArgs)
        {
            var button = (Button)sender;

            if (button != null)
            {
                if (Convert.ToInt32(button.Name) == 144) //Если нажата кнопка "+"
                {
                    this.Hide();
                    AddCase addcase = new AddCase();
                    addcase.Show();
                    //MessageBox.Show("Прощай " + button.Name);
                }
                else //если нажаты кнопки дел
                {
                    DataClass.CaseID = Convert.ToInt32(button.Name); //Записываем номер дела к которому переходим
                    this.Hide();
                    CaseForm caseForm = new CaseForm();
                    caseForm.Show();
                }
            }
        }
コード例 #8
0
ファイル: DocForm.cs プロジェクト: strievskiy-n/MyDiplomaApp
        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);
                    }
                }
            }
        }
コード例 #9
0
ファイル: AddDoc.cs プロジェクト: strievskiy-n/MyDiplomaApp
        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);
                }
            }
        }