private void ButtonCopy_Click(object sender, RoutedEventArgs e) { bool result = false; // Code that copies the current project into a new project Project project = new Project(CBZ.TempProject.Case, CBZ.TempProject.Builder, new ProjectStatus((ProjectStatus)CBZ.GetProjectStatus(1)), CBZ.TempProject.TenderForm, CBZ.TempProject.EnterpriseForm, CBZ.TempProject.Executive, CBZ.TempProject.Details, CBZ.TempProject.EnterpriseList, CBZ.TempProject.Copy); int id = CBZ.CreateInDb(project); if (id >= 1) { result = true; } if (result) { //Show Confirmation MessageBox.Show("Projektet blev kopieret", "Projekter", MessageBoxButton.OK, MessageBoxImage.Information); //Update list of projects CBZ.RefreshIndexedList("Projects"); //Close right UserControl CBZ.UcMainEdited = false; UcMain.Content = new UserControl(); } else { //Show error MessageBox.Show("Databasen returnerede en fejl. Projektet blev ikke kopieret. Prøv igen.", "Projekter", MessageBoxButton.OK, MessageBoxImage.Information); } }