private void BackToMainScreen_Click(object sender, EventArgs e) { ManageProjects form = new ManageProjects(); this.Close(); form.Show(); }
private void GoToProjectForm_Click_1(object sender, EventArgs e) { ManageProjects form = new ManageProjects(); form.Show(); this.Hide(); }
private void SaveProject_Click(object sender, EventArgs e) { try { if (TitleTextBox.Text == "" || DescriptionTextBox.Text == "") { throw new ArgumentException(); } if (value1 == "add") { SqlConnection connection = new SqlConnection(connString); connection.Open(); string addProject = string.Format("INSERT INTO Project(Title, Description) values('{0}', '{1}')", TitleTextBox.Text, DescriptionTextBox.Text); SqlCommand cmd = new SqlCommand(addProject, connection); cmd.ExecuteNonQuery(); connection.Close(); } else if (value1 == "edit") { SqlConnection connection = new SqlConnection(connString); connection.Open(); string update = string.Format("UPDATE Project SET Title = '{0}', Description = '{1}' " + "WHERE Id = '{2}'", TitleTextBox.Text, DescriptionTextBox.Text, id); SqlCommand cmd = new SqlCommand(update, connection); cmd.ExecuteNonQuery(); connection.Close(); } ManageProjects form = new ManageProjects(); this.Close(); form.Show(); } catch (Exception ex) { MessageBox.Show("Please enter title and description"); } }