Пример #1
0
 private void Button_Click_1(object sender, RoutedEventArgs e)
 {
     String project_name = this.projectNameField.Text;
     //MessageBox.Show(project_name);
     itemWindow itemWin = new itemWindow();
     itemWin.ProjectNameValue = project_name;
     itemWin.ShowDialog();
 }
Пример #2
0
        private void deleteButton_Click(object sender, RoutedEventArgs e)
        {
            SQLiteConnection conn = new SQLiteConnection(dbConnectionString);
            try
            {

                if (this.typeBox.Text == "task")
                {
                    MessageBoxResult result = MessageBox.Show("Are you sure you want to Delete this Task?", "Delete Confirmation", MessageBoxButton.YesNo);

                    if (result == MessageBoxResult.Yes)
                    {
                        conn.Open();
                        string query = "delete from tasks where task_name = '" + this.nameBox.Text + "' and proj_id = (select project_id from projects where project_name = '" + this.projNameBox.Text + "')";

                        SQLiteCommand createCommand = new SQLiteCommand(query, conn);
                        createCommand.ExecuteNonQuery();
                        MessageBox.Show("Item has been deleted!");
                        conn.Close();
                        this.Close();
                        string projectName = this.projNameBox.Text;
                        itemWindow update = new itemWindow();
                        update.ProjectNameValue = projectName;
                        update.ShowDialog();

                        this.Close();
                    }

                }
                else if (this.typeBox.Text == "subtask")
                {
                    MessageBoxResult result = MessageBox.Show("Are you sure you want to Delete this subtask?", "Delete Confirmation", MessageBoxButton.YesNo);

                    if (result == MessageBoxResult.Yes)
                    {
                        conn.Open();
                        string query = "delete from subtasks where subtask_name = '" + this.nameBox.Text + "';";

                        SQLiteCommand createCommand = new SQLiteCommand(query, conn);
                        createCommand.ExecuteNonQuery();
                        MessageBox.Show("Item has been deleted!");
                        conn.Close();
                        this.Close();
                        string projectName = this.projNameBox.Text;
                        itemWindow update = new itemWindow();
                        update.ProjectNameValue = projectName;
                        update.ShowDialog();

                        this.Close();
                    }
                }
                else
                {
                    MessageBox.Show("test");
                }

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }