Beispiel #1
0
        /// <summary>
        /// Method, that adds multiple SubEntrepeneurs to Db
        /// </summary>
        /// <returns></returns>
        private bool AddMultipleSubentrepeneurs()
        {
            bool result = false;
            List <IndexedLegalEntity> tempList = new List <IndexedLegalEntity>();

            foreach (IndexedLegalEntity entity in ListBoxLegalEntities.SelectedItems)
            {
                Bizz.TempLegalEntity    = entity;
                Bizz.TempSubEntrepeneur = new SubEntrepeneur();
                Bizz.TempSubEntrepeneur.EnterpriseList = Bizz.TempEnterprise;
                Bizz.TempSubEntrepeneur.Entrepeneur    = entity;
                if (!Bizz.TempSubEntrepeneur.Active)
                {
                    Bizz.TempSubEntrepeneur.ToggleActive();
                }
                Bizz.TempSubEntrepeneur.Contact = new Contact((Contact)Bizz.GetEntity("Contact", "0"));
                CreateIttLetter();
                CreateOffer();
                CreateRequest();

                //Code that ads a enterprise to Enterprise List
                bool tempResult = Bizz.CreateInDbReturnBool(Bizz.TempSubEntrepeneur);

                //Code, that checks result
                if (!result)
                {
                    result = tempResult;
                }
            }

            return(result);
        }
        private void ButtonCreateClose_Click(object sender, RoutedEventArgs e)
        {
            //Code that creates a new project
            Project project = new Project(Convert.ToInt32(TextBoxCaseId.Text), TextBoxCaseName.Text, new Builder((Builder)ComboBoxBuilder.SelectedItem), new ProjectStatus((ProjectStatus)Bizz.GetEntity("ProjectStatus", "1")), new TenderForm((TenderForm)ComboBoxTenderForm.SelectedItem), new EnterpriseForm((EnterpriseForm)ComboBoxEnterpriseForm.SelectedItem), new User((User)ComboBoxExecutive.SelectedItem));
            bool    result  = Bizz.CreateInDbReturnBool(project);

            if (result)
            {
                //Show Confirmation
                MessageBox.Show("Projektet blev oprettet", "Opret Projekt", MessageBoxButton.OK, MessageBoxImage.Information);

                //Update list of projects
                Bizz.RefreshList("Projects");
                Bizz.RefreshIndexedList("IndexedActiveProjects");
                Bizz.RefreshIndexedList("IndexedProjects");

                //Close right UserControl
                Bizz.UcRightActive = false;
                UcRight.Content    = new UserControl();
            }
            else
            {
                //Show error
                MessageBox.Show("Databasen returnerede en fejl. Projektet blev ikke oprettet. Prøv igen.", "Opret Projekt", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }
        private void ButtonCopy_Click(object sender, RoutedEventArgs e)
        {
            // Code that copies the current project into a new project
            Project project = new Project(Bizz.TempProject.CaseId, Bizz.TempProject.Name, Bizz.TempProject.Builder, new ProjectStatus((ProjectStatus)Bizz.GetEntity("ProjectStatus", "1")), Bizz.TempProject.TenderForm, Bizz.TempProject.EnterpriseForm, Bizz.TempProject.Executive);
            bool    result  = Bizz.CreateInDbReturnBool(Bizz.TempProject);

            if (result)
            {
                //Show Confirmation
                MessageBox.Show("Projektet blev kopieret", "Kopier projekt", MessageBoxButton.OK, MessageBoxImage.Information);

                //Update list of projects
                Bizz.RefreshList("Projects");
                Bizz.RefreshIndexedList("IndexedActiveProjects");
                Bizz.RefreshIndexedList("IndexableProjects");

                //Close right UserControl
                Bizz.UcRightActive = false;
                UcRight.Content    = new UserControl();
            }
            else
            {
                //Show error
                MessageBox.Show("Databasen returnerede en fejl. Projektet blev ikke kopieret. Prøv igen.", "Kopier Projekt", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }