/// <summary> /// This function will handle what to do when the app delete button is clicked /// </summary> /// <param name="sender">This is the paramater for sender</param> /// <param name="e">This is the paramater for EventAtgs</param> private void appDeleteButton_Click(object sender, EventArgs e) { DataLayer.Apps selectedApp = (DataLayer.Apps)listBoxApps.SelectedValue; DataLayer.App apps = new DataLayer.App(); int getAppID = selectedApp.AppID; int checkedAppForBug = apps.CheckAppsForBugs(getAppID); DialogResult result = MessageBox.Show("Are You Sure You Want To Delete Application?", "Warning", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning); if (result == DialogResult.Yes) { if (checkedAppForBug == 0) { try { apps.DeleteApplication(getAppID); //reload the log table to display new log data List <DataLayer.Apps> appsList = apps.GetList(); appsList.Insert(0, new DataLayer.Apps() { AppName = "<Add New>" }); listBoxApps.DataSource = appsList; // apps.GetList(); listBoxApps.DisplayMember = "AppName"; appsComboBox.DataSource = appsList; // apps.GetList(); appsComboBox.DisplayMember = "AppName"; } catch (SqlException sqlex) { DisplayErrorMessage(sqlex.Message); } } else { MessageBox.Show("You Can Not Delete Apps With Bugs"); } } else if (result == DialogResult.No) { //code for No } else if (result == DialogResult.Cancel) { //code for Cancel } }
/// <summary> /// This was a test function to make sure that the application lists will always update on the bug page /// Even if a new app is added or an app is deleted /// </summary> /// <param name="sender">This is the paramater for sender</param> /// <param name="e">This is the paramater for EventAtgs</param> private void bugsTab_Click(object sender, EventArgs e) { DataLayer.Apps selectedApp = (DataLayer.Apps)listBoxApps.SelectedValue; DataLayer.App apps = new DataLayer.App(); List <DataLayer.Apps> appsList = apps.GetList(); appsList.Insert(0, new DataLayer.Apps() { AppName = "<Add New>" }); appsComboBox.DataSource = appsList; // apps.GetList(); appsComboBox.DisplayMember = "AppName"; }
/// <summary> /// This function will handle what to do when the index is changed on the apps list box /// </summary> /// <param name="sender">This is the paramater for sender</param> /// <param name="e">This is the paramater for EventAtgs</param> private void listBoxApps_SelectedIndexChanged(object sender, EventArgs e) { DataLayer.Apps selectedApp = (DataLayer.Apps)listBoxApps.SelectedValue; if (selectedApp.AppID != 0) { appIdTextBox.Text = selectedApp.AppID.ToString(); appNameTextBox.Text = selectedApp.AppName; appVersionTextBox.Text = selectedApp.AppVersion.ToString(); appDescTextBox.Text = selectedApp.AppDesc; } else { appIdTextBox.Text = null; appNameTextBox.Text = null; appVersionTextBox.Text = null; appDescTextBox.Text = null; } }