private void Button_Click_1(object sender, RoutedEventArgs e) { SQLiteConnection conn = new SQLiteConnection(dbConnectionString); try { conn.Open(); string query = "insert into projects(proj_mgr, project_name, start_date, end_date, description) values((select users.id from users where user_name = '" + this.pmBox.SelectedItem + "'), '" + this.projNameField.Text + "', '" + this.startField.Text + "', '" + this.endField.Text + "', '" + this.descriptionField.Text + "')"; string query2 = "insert into milestones(milestone_name, milestone_desc, milestone_start, milestone_end, project_id) values('" + this.projNameField.Text + " Start', 'Start Milestone', '" + this.startField + "','test', (select project_id from projects where project_name = '" + this.projNameField.Text + "'));"; MessageBox.Show(query2); SQLiteCommand createCommand = new SQLiteCommand(query, conn); SQLiteCommand createCommand2 = new SQLiteCommand(query2, conn); createCommand.ExecuteNonQuery(); MessageBox.Show("Project Was Added!"); projListBox.Items.Clear(); fill_projListBox(); createCommand2.ExecuteNonQuery(); string project_name = this.projNameField.Text; MainView main = new MainView(project_name); main.ShowDialog(); this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void projectField_SelectionChanged(object sender, SelectionChangedEventArgs e) { String project_name = this.projectField.SelectedItem.ToString(); MainView mainView = new MainView(project_name); mainView.ShowDialog(); }