Exemplo n.º 1
0
        /// <summary>
        /// Deletes an app from the database.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1Delete_Click(object sender, EventArgs e)
        {
            if (listBox1Applications.SelectedIndex > 0)
            {
                dataLayer.Application app = (dataLayer.Application)listBox1Applications.SelectedItem;

                if (app.Delete())
                {
                    MessageBox.Show(this, "App Deleted.", "Success");
                    PopulateApplicationPage();
                    // clear controls
                    labelVal1ApplicationId.Text  = "";
                    textBox1ApplicationName.Text = "";
                    textBox1CurrentVersion.Text  = "";
                    textBox1Description.Text     = "";
                    UpdateBugList(); // update bug list to not show this app
                }
                else
                {
                    MessageBox.Show(this, "Cannot delete app, bug data exists.", "Error");
                }
            }
        }