Beispiel #1
0
        private void ButtonCreate_Click(object sender, RoutedEventArgs e)
        {
            //Code that creates a new project
            if (CBZ.TempProject.EnterpriseList == false)
            {
                CBZ.TempProject.ToggleEnterpriseList();
                CBZ.UpdateInDb(CBZ.TempProject);
                CBZ.RefreshIndexedList("Projects");
            }

            bool result = false;
            int  id     = CBZ.CreateInDb(CBZ.TempEnterprise);

            if (id >= 1)
            {
                result = true;
            }

            if (result)
            {
                //Show Confirmation
                MessageBox.Show("Entrepriselisten blev oprettet", "Entrepriser", MessageBoxButton.OK, MessageBoxImage.Information);

                //Reset Boxes
                TextBoxCaseName.Text              = "";
                TextBoxName.Text                  = "";
                TextBoxElaboration.Text           = "";
                TextBoxOfferList.Text             = "";
                ComboBoxCraftGroup1.SelectedIndex = 0;
                ComboBoxCraftGroup2.SelectedIndex = 0;
                ComboBoxCraftGroup3.SelectedIndex = 0;
                ComboBoxCraftGroup4.SelectedIndex = 0;

                //Update Enterprise list
                CBZ.RefreshList("Enterprises");
                CBZ.TempEnterprise.Name        = "";
                CBZ.TempEnterprise.Elaboration = "";
                CBZ.TempEnterprise.OfferList   = "";
                CBZ.TempEnterprise.CraftGroup1 = new CraftGroup((CraftGroup)CBZ.GetCraftGroup(0));
                CBZ.TempEnterprise.CraftGroup2 = new CraftGroup((CraftGroup)CBZ.GetCraftGroup(0));
                CBZ.TempEnterprise.CraftGroup3 = new CraftGroup((CraftGroup)CBZ.GetCraftGroup(0));
                CBZ.TempEnterprise.CraftGroup4 = new CraftGroup((CraftGroup)CBZ.GetCraftGroup(0));
            }
            else
            {
                //Show error
                MessageBox.Show("Databasen returnerede en fejl. Entrepriselisten blev ikke oprettet. Prøv igen.", "Entrepriser", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }