Exemple #1
0
        private void ButtonCreateClose_Click(object sender, RoutedEventArgs e)
        {
            //Code that creates a new project
            if (Bizz.TempProject.EnterpriseList == false)
            {
                Bizz.TempProject.ToggleEnterpriseList();
                Bizz.UpdateInDb(Bizz.TempProject);
                Bizz.RefreshList("Projects");
                Bizz.RefreshIndexedList("IndexedActiveProjects");
                Bizz.RefreshIndexedList("IndexableProjects");
            }
            bool result = Bizz.CreateInDbReturnBool(Bizz.TempEnterprise);

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

                //Update EnterpriseList
                Bizz.RefreshList("EnterpriseList");
                Bizz.TempEnterprise = new Enterprise();

                //Close right UserControl
                Bizz.UcRightActive = false;
                UcRight.Content    = new UserControl();
            }
            else
            {
                //Show error
                MessageBox.Show("Databasen returnerede en fejl. Entrepriselisten blev ikke oprettet. Prøv igen.", "Opret Projekt", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }
Exemple #2
0
        private void ButtonAddJobDescription_Click(object sender, RoutedEventArgs e)
        {
            bool result = CreateJobDescriptionInDb();

            //Display result
            if (result)
            {
                //Show Confirmation
                MessageBox.Show("Jobbeskrivelsen blev tilføjet", "Jobbeskrivelser", MessageBoxButton.OK, MessageBoxImage.Information);

                //Reset Boxes
                ListBoxJobDescriptions.SelectedIndex = -1;
                ListBoxJobDescriptions.ItemsSource   = "";
                CBZ.RefreshIndexedList("JobDescriptions");
                ListBoxJobDescriptions.ItemsSource = CBZ.IndexedJobDescriptions;
                TextBoxJobDescriptionSearch.Text   = "";
                TextBoxArea.Text                 = "";
                TextBoxOccupation.Text           = "";
                CheckBoxProcuration.IsChecked    = null;
                TextBoxNewArea.Text              = "";
                TextBoxNewOccupation.Text        = "";
                CheckBoxNewProcuration.IsChecked = null;

                //Refresh JobDescriptions list
                CBZ.RefreshList("JobDescriptions");
                CBZ.TempJobDescription = new JobDescription();
                TempNewJobDescription  = new IndexedJobDescription();
            }
            else
            {
                //Show error
                MessageBox.Show("Databasen returnerede en fejl. Jobbeskrivelsen blev ikke tilføjet. Prøv igen.", "Jobbeskrivelser", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
        private void ButtonAddProjectStatus_Click(object sender, RoutedEventArgs e)
        {
            bool result = CreateProjectStatusInDb();

            //Display result
            if (result)
            {
                //Show Confirmation
                MessageBox.Show("Projektstatussen blev tilføjet", "Projektstatusser", MessageBoxButton.OK, MessageBoxImage.Information);

                //Reset Boxes
                ListBoxProjectStatuses.SelectedIndex = -1;
                ListBoxProjectStatuses.ItemsSource   = "";
                CBZ.RefreshIndexedList("ProjectStatuses");
                ListBoxProjectStatuses.ItemsSource = CBZ.IndexedCraftGroups;
                TextBoxProjectStatusSearch.Text    = "";
                TextBoxText.Text    = "";
                TextBoxNewText.Text = "";

                //Refresh Users list
                CBZ.RefreshList("ProjectStatuses");
                CBZ.TempProjectStatus = new ProjectStatus();
            }
            else
            {
                //Show error
                MessageBox.Show("Databasen returnerede en fejl. Projektstatussen blev ikke tilføjet. Prøv igen.", "Projektstatusser", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Exemple #4
0
        private void ButtonClose_Click(object sender, RoutedEventArgs e)
        {
            if (CBZ.TempContact != new Contact())
            {
                //Warning about lost changes before closing
                if (MessageBox.Show("Vil du annullere opdatering af Kontakt?", "Kontakter", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes)
                {
                    //Refresh Contacts list
                    CBZ.RefreshList("Contacts");
                    CBZ.TempContact     = new Contact();
                    CBZ.TempEntrepeneur = new Entrepeneur();

                    CBZ.CloseUcMain(UcMain);
                }
            }
            else
            {
                //Refresh Contacts list
                CBZ.RefreshList("Contacts");
                CBZ.TempContact     = new Contact();
                CBZ.TempEntrepeneur = new Entrepeneur();

                CBZ.CloseUcMain(UcMain);
            }
        }
Exemple #5
0
        private void ButtonPrepare_Click(object sender, RoutedEventArgs e)
        {
            //Code, that prepares
            Bizz.TempIttLetterPdfData = new IttLetterPdfData(Bizz.TempProject, Bizz.TempBuilder, TextBoxAnswerDate.Text, TextBoxQuestionDate.Text, TextBoxCorrectionSheetDate.Text, Convert.ToInt32(TextBoxTimeSpan.Text), TextBoxMaterialUrl.Text, TextBoxConditionUrl.Text, TextBoxPassword.Text);

            // Code that save changes to the IttLetter PdfData
            int result = Bizz.CreateInDbReturnInt(Bizz.TempIttLetterPdfData);

            if (result > 0)
            {
                //Show Confirmation
                MessageBox.Show("Personlig del af Udbudsbrevet blev rettet", "Forbered Udbudsbrev", MessageBoxButton.OK, MessageBoxImage.Information);

                //Update IttLetter PdfData List
                Bizz.RefreshList("IttLetterPdfDataList");

                //Reset UcIttLetterPreparePersonal
                ComboBoxCaseId.SelectedIndex = 0;
                Bizz.TempProject             = new Project();
                Bizz.TempBuilder             = new Builder();
                Bizz.TempIttLetterPdfData    = new IttLetterPdfData();
            }
            else
            {
                //Show error
                MessageBox.Show("Databasen returnerede en fejl. Personlig del af Tilbudsbrev blev ikke oprettet. Prøv igen.", "Forbered UdbudsBrev", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }
Exemple #6
0
        private void ButtonAddEnterpriseForm_Click(object sender, RoutedEventArgs e)
        {
            bool result = CreateEnterpriseFormInDb();

            //Display result
            if (result)
            {
                //Show Confirmation
                MessageBox.Show("Entrepriseformen blev tilføjet", "Entrepriseformer", MessageBoxButton.OK, MessageBoxImage.Information);

                //Reset Boxes
                TextBoxEnterpriseFormSearch.Text     = "";
                ListBoxEnterpriseForms.SelectedIndex = -1;
                ListBoxEnterpriseForms.ItemsSource   = "";
                ListBoxEnterpriseForms.ItemsSource   = FilteredEnterpriseForms;
                TextBoxText.Text    = "";
                TextBoxNewText.Text = "";

                //Refresh Users list
                CBZ.RefreshList("EnterpriseForms");
                CBZ.TempEnterpriseForm = new EnterpriseForm();
            }
            else
            {
                //Show error
                MessageBox.Show("Databasen returnerede en fejl. Entrepriseformen blev ikke tilføjet. Prøv igen.", "Entrepriseformer", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
        private void ButtonSave_Click(object sender, RoutedEventArgs e)
        {
            bool result = UpdateEntrepeneurInDb;

            //Display result
            if (result)
            {
                //Show Confirmation
                MessageBox.Show("Entrepenøren blev opdateret", "Entrepenører", MessageBoxButton.OK, MessageBoxImage.Information);

                //Reset Boxes
                TextBoxName.Text   = "";
                TextBoxPhone.Text  = "";
                TextBoxFax.Text    = "";
                TextBoxMobile.Text = "";
                TextBoxEmail.Text  = "";
                ComboBoxCraftGroup1.SelectedIndex = 0;
                ComboBoxCraftGroup2.SelectedIndex = 0;
                ComboBoxCraftGroup3.SelectedIndex = 0;
                ComboBoxCraftGroup4.SelectedIndex = 0;
                ComboBoxRegion.SelectedIndex      = 0;

                //Refresh Entrepeneurs list
                CBZ.RefreshList("Entrepeneurs");
                CBZ.TempEntrepeneur = new Entrepeneur();
            }
            else
            {
                //Show error
                MessageBox.Show("Databasen returnerede en fejl. Entrepenøren blev ikke opdateret. Prøv igen.", "Entrepenører", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
        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 ButtonAddCraftGroup_Click(object sender, RoutedEventArgs e)
        {
            bool result = CreateCraftGroupInDb();

            //Display result
            if (result)
            {
                //Show Confirmation
                MessageBox.Show("Faggruppen blev tilføjet", "Faggrupper", MessageBoxButton.OK, MessageBoxImage.Information);

                //Reset Boxes
                ListBoxCraftGroups.SelectedIndex = -1;
                ListBoxCraftGroups.ItemsSource   = "";
                CBZ.RefreshIndexedList("CraftGroups");
                ListBoxCraftGroups.ItemsSource    = CBZ.IndexedCraftGroups;
                TextBoxCraftGroupSearch.Text      = "";
                TextBoxDesignation.Text           = "";
                TextBoxDescription.Text           = "";
                ComboBoxCategory.SelectedIndex    = -1;
                ComboBoxCategory.ItemsSource      = "";
                TextBoxNewDesignation.Text        = "";
                TextBoxNewDescription.Text        = "";
                ComboBoxNewCategory.SelectedIndex = -1;
                ComboBoxNewCategory.ItemsSource   = "";

                //Refresh Users list
                CBZ.RefreshList("CraftGroups");
                CBZ.TempCraftGroup = new CraftGroup();
            }
            else
            {
                //Show error
                MessageBox.Show("Databasen returnerede en fejl. Faggruppen blev ikke tilføjet. Prøv igen.", "Faggrupper", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
        private void ButtonSave_Click(object sender, RoutedEventArgs e)
        {
            bool result = UpdateBuilderInDb();

            //Display result
            if (result)
            {
                //Show Confirmation
                MessageBox.Show("Bygherren blev opdateret", "Bygherrer", MessageBoxButton.OK, MessageBoxImage.Information);

                //Reset Boxes
                TextBoxName.Text   = "";
                TextBoxCoName.Text = "";
                TextBoxStreet.Text = "";
                TextBoxPlace.Text  = "";
                TextBoxZip.Text    = "";
                TextBoxTown.Text   = "";
                TextBoxPhone.Text  = "";
                TextBoxFax.Text    = "";
                TextBoxMobile.Text = "";
                TextBoxEmail.Text  = "";

                //Refresh Entrepeneurs list
                CBZ.RefreshList("Builders");
                CBZ.TempBuilder = new Builder();
            }
            else
            {
                //Show error
                MessageBox.Show("Databasen returnerede en fejl. Bygherren blev ikke opdateret. Prøv igen.", "Bygherrer", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
        private void ButtonAddRegion_Click(object sender, RoutedEventArgs e)
        {
            bool result = CreateRegionInDb();

            //Display result
            if (result)
            {
                //Show Confirmation
                MessageBox.Show("Regionen blev tilføjet", "Regioner", MessageBoxButton.OK, MessageBoxImage.Information);

                //Reset Boxes
                ListBoxRegions.SelectedIndex = -1;
                ListBoxRegions.ItemsSource   = "";
                CBZ.RefreshIndexedList("Regtions");
                ListBoxRegions.ItemsSource = CBZ.IndexedJobDescriptions;
                TextBoxRegionSearch.Text   = "";
                TextBoxText.Text           = "";
                TextBoxZips.Text           = "";
                TextBoxNewText.Text        = "";
                TextBoxNewZips.Text        = "";

                //Refresh JobDescriptions list
                CBZ.RefreshList("JobDescriptions");
                CBZ.TempRegion = new Region();
                TempNewRegion  = new IndexedRegion();
            }
            else
            {
                //Show error
                MessageBox.Show("Databasen returnerede en fejl. Regionen blev ikke tilføjet. Prøv igen.", "Regioner", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
        private void ButtonClose_Click(object sender, RoutedEventArgs e)
        {
            if (CBZ.UcMainEdited)
            {
                //Warning about lost changes before closing
                if (MessageBox.Show("Vil du annullere oprettelse af Entrepenør? Alle ugemte data mistes.", "Entrepenører", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes)
                {
                    //Refresh Entrepeneurs list
                    CBZ.RefreshList("Entrepeneurs");
                    CBZ.TempEnterprise = new Enterprise();

                    //Close right UserControl
                    CBZ.CloseUcMain(UcMain);
                }
            }
            else
            {
                //Refresh Entrepeneurs list
                CBZ.RefreshList("Entrepeneurs");
                CBZ.TempEnterprise = new Enterprise();

                //Close main UserControl
                CBZ.CloseUcMain(UcMain);
            }
        }
Exemple #13
0
        private void ButtonDelete_Click(object sender, RoutedEventArgs e)
        {
            //Code that deletes a project from Db
            bool result = Bizz.DeleteFromDb("EnterpriseList", Bizz.TempEnterprise.Id.ToString());

            Bizz.TempEnterprise = new Enterprise();

            if (result)
            {
                //Show Confirmation
                MessageBox.Show("Entrepriselisten blev slettet", "Slet Entrepriseliste", MessageBoxButton.OK, MessageBoxImage.Information);
                //Reset Boxes
                TextBoxName.Text                  = "";
                TextBoxElaboration.Text           = "";
                TextBoxOfferList.Text             = "";
                ComboBoxCraftGroup1.SelectedIndex = -1;
                ComboBoxCraftGroup2.SelectedIndex = -1;
                ComboBoxCraftGroup3.SelectedIndex = -1;
                ComboBoxCraftGroup4.SelectedIndex = -1;

                //Update Enterprise List
                Bizz.RefreshList("EnterpriseList");
                IndexableEnterpriseList.Clear();
                IndexableEnterpriseList           = GetIndexableEnterpriseList();
                ListBoxEnterpriseList.ItemsSource = IndexableEnterpriseList;
            }
            else
            {
                //Show error
                MessageBox.Show("Databasen returnerede en fejl. Entrepriselisten blev ikke slettet. Prøv igen.", "Slet Projekt", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }
Exemple #14
0
        private void ButtonClose_Click(object sender, RoutedEventArgs e)
        {
            //Update lists and fields
            Bizz.TempZipTown = new ZipTown();
            Bizz.RefreshList("ZipTownList");

            //Close right UserControl
            Bizz.UcRightActive = false;
            UcRight.Content    = new UserControl();
        }
Exemple #15
0
        private void ButtonChoose_Click(object sender, RoutedEventArgs e)
        {
            bool result = false;

            if (ListBoxEntrepeneurs.SelectedItems.Count == 0)
            {
                //Show Confirmation
                MessageBox.Show("Du har ikke valgt nogen underentrepenører.", "Vælg Underentrepenør", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            else if (ListBoxEntrepeneurs.SelectedItems.Count == 1)
            {
                int id = 0;

                //Code that adds IttLetter, Offer and Request to Bizz.TempSubEntrepeneur
                CreateIttLetter();
                CreateOffer();
                CreateRequest();

                //Code that adds a SubEntrepeneur to Enterprise List
                id = CBZ.CreateInDb(CBZ.TempSubEntrepeneur);
                if (id >= 1)
                {
                    result = true;
                }
            }
            else
            {
                result = AddMultipleSubentrepeneurs();
            }
            if (result)
            {
                //Show Confirmation
                MessageBox.Show("Underentrepenøren/-ne blev føjet til Entrepriselisten. Ved flere underentrepenører, er der ikke valgt kontaktperson. Ret dette under 'Rediger Underentrepenør'", "Vælg Underentrepenør", MessageBoxButton.OK, MessageBoxImage.Information);

                //Reset Boxes
                ComboBoxCaseId.SelectedIndex      = -1;
                TextBoxName.Text                  = "";
                ListBoxEntrepeneurs.SelectedIndex = -1;
                ListBoxEntrepeneurs.ItemsSource   = "";
                ComboBoxContact.SelectedIndex     = -1;
                ComboBoxContact.ItemsSource       = "";


                //Update SubEntrepeneurs List
                CBZ.RefreshList("SubEntrepeneurs");
                CBZ.UcMainEdited = false;
            }
            else
            {
                //Show error
                MessageBox.Show("Databasen returnerede en fejl. Underentrepenøren blev ikke føjet til Entrepriselisten. Prøv igen.", "Rediger Projekt", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }
Exemple #16
0
        private void ButtonSave_Click(object sender, RoutedEventArgs e)
        {
            bool result = UpdateUserInDb();

            //Display result
            if (result)
            {
                //Show Confirmation
                MessageBox.Show("Brugeren blev opdateret", "Brugere", MessageBoxButton.OK, MessageBoxImage.Information);

                //Reset Boxes
                ListBoxUsers.SelectedIndex           = -1;
                ListBoxUsers.ItemsSource             = "";
                TextBoxUserSearch.Text               = "";
                TextBoxName.Text                     = "";
                TextBoxPhone.Text                    = "";
                TextBoxFax.Text                      = "";
                TextBoxMobile.Text                   = "";
                TextBoxEmail.Text                    = "";
                TextBoxInitials.Text                 = "";
                ComboBoxJobDescription.SelectedIndex = -1;
                ComboBoxJobDescription.ItemsSource   = "";
                ComboBoxUserLevel.SelectedIndex      = -1;
                ComboBoxUserLevel.ItemsSource        = "";

                //Refresh Users list
                CBZ.RefreshList("Users");
                CBZ.TempUser = new User();
            }
            else
            {
                //Show error
                MessageBox.Show("Databasen returnerede en fejl. Bygherren blev ikke opdateret. Prøv igen.", "Bygherrer", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
        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);
            }
        }
        private void ButtonSave_Click(object sender, RoutedEventArgs e)
        {
            bool result = UpdateUserInDb;

            //Display result
            if (result)
            {
                //Show Confirmation
                MessageBox.Show("Brugeradgangen blev opdateret", "Brugere", MessageBoxButton.OK, MessageBoxImage.Information);

                //Reset Boxes
                ListBoxUsers.SelectedIndex      = -1;
                ListBoxUsers.ItemsSource        = "";
                ComboBoxUserAccess.SelectedItem = -1;
                TextBoxUserSearch.Text          = "";
                TextBoxName.Text = "";

                //Refresh Users list
                CBZ.RefreshList("Authentications");
                CBZ.TempUser = new User();
            }
            else
            {
                //Show error
                MessageBox.Show("Databasen returnerede en fejl. Brugeradgangen blev ikke opdateret. Prøv igen.", "Brugere", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Exemple #19
0
        private void ButtonExecute_Click(object sender, RoutedEventArgs e)
        {
            // Code that changes project status
            bool result = Bizz.UpdateInDb(Bizz.TempProject);

            if (result)
            {
                //Show Confirmation
                MessageBox.Show("Projekstatus blev ændret", "Ændr Projektstatus", 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. Projektstatus blev ikke ændret. Prøv igen.", "Ændr Projektstatus", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }
        private void ButtonEdit_Click(object sender, RoutedEventArgs e)
        {
            // Code that save changed CaseId to the project
            bool result = Bizz.UpdateInDb(Bizz.TempProject);

            if (result)
            {
                //Show Confirmation
                MessageBox.Show("Sagsnummer blev ændret", "Skift Sagsnummer", 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. Sagsnummer blev ikke ændret. Prøv igen.", "Skift Sagsnummer", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }
Exemple #21
0
        private void ButtonChoose_Click(object sender, RoutedEventArgs e)
        {
            bool result = false;

            if (ListBoxLegalEntities.SelectedItems.Count == 0)
            {
                //Show Confirmation
                MessageBox.Show("Du har ikke valgt nogen underentrepenører.", "Vælg Underentrepenør", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            else if (ListBoxLegalEntities.SelectedItems.Count == 1)
            {
                //Code that adds IttLetter, Offer and Request to Bizz.TempSubEntrepeneur
                CreateIttLetter();
                CreateOffer();
                CreateRequest();
                Contact tempContact = GetContact();
                Bizz.TempSubEntrepeneur.Contact = tempContact;

                //Code that adds a SubEntrepeneur to Enterprise List
                result = Bizz.CreateInDbReturnBool(Bizz.TempSubEntrepeneur);
            }
            else
            {
                result = AddMultipleSubentrepeneurs();
            }
            if (result)
            {
                //Show Confirmation
                MessageBox.Show("Underentrepenøre(r)n(e) blev føjet til Entrepriselisten. Ved flere underentrepenører, er der ikke valgt kontaktperson. Ret dette under 'Rediger Underentrepenør'", "Vælg Underentrepenør", MessageBoxButton.OK, MessageBoxImage.Information);

                //Reset Boxes
                TextBoxName.Text = "";

                //Update Enterprise List
                Bizz.RefreshList("SubEntrepeneurs");
                IndexableLegalEntities.Clear();
                IndexableLegalEntities           = GetIndexableLegalEntities();
                ListBoxLegalEntities.ItemsSource = IndexableLegalEntities;
            }
            else
            {
                //Show error
                MessageBox.Show("Databasen returnerede en fejl. Underentrepenøren blev ikke føjet til Entrepriselisten. Prøv igen.", "Rediger Projekt", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }
Exemple #22
0
        private void ButtonErase_Click(object sender, RoutedEventArgs e)
        {
            if (CheckBoxEraseProject.IsChecked == true)
            {
                if (MessageBox.Show("Er du sikker på, at du vil slette projektet? Alle data vil gå tabt!", "Slet Projekt", MessageBoxButton.OKCancel, MessageBoxImage.Warning) == MessageBoxResult.OK)
                {
                    // Code that changes project status
                    bool result = Bizz.DeleteFromDb("Projects", Bizz.TempProject.Id.ToString());

                    if (result)
                    {
                        foreach (Enterprise enterprise in Bizz.EnterpriseList)
                        {
                            if (enterprise.Project.Id == Bizz.TempProject.CaseId)
                            {
                                foreach (SubEntrepeneur subEntrepeneur in Bizz.SubEntrepeneurs)
                                {
                                    if (subEntrepeneur.EnterpriseList.Id == enterprise.Id)
                                    {
                                        Bizz.DeleteFromDb("Requests", subEntrepeneur.Request.Id.ToString());
                                        Bizz.DeleteFromDb("IttLetters", subEntrepeneur.IttLetter.Id.ToString());
                                        Bizz.DeleteFromDb("Offers", subEntrepeneur.Offer.Id.ToString());
                                        Bizz.DeleteFromDb("SubEntrepeneurs", subEntrepeneur.Id.ToString());
                                    }
                                }
                                Bizz.DeleteFromDb("EnterpriseList", enterprise.Id.ToString());
                            }
                        }

                        //Show Confirmation
                        MessageBox.Show("Projektet blev slettet", "Slet 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 slettet. Prøv igen.", "Slet Projekt", MessageBoxButton.OK, MessageBoxImage.Information);
                    }
                }
            }
            else
            {
                //Show error
                MessageBox.Show("Du har glemt at markere 'Godkend sletning af projekt'.", "Slet Projekt", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }
        private void ButtonChoose_Click(object sender, RoutedEventArgs e)
        {
            result = false;
            bool receivers = false;

            if (ListBoxLegalEntities.SelectedItems.Count >= 1)
            {
                receivers = true;
            }
            switch (receivers)
            {
            case false:
                //Show Confirmation
                MessageBox.Show("Du har ikke valgt nogen modtagere. Der blev ikke føjet modtagere til modtagerlisten.", "Tilføj Modtager(e)", MessageBoxButton.OK, MessageBoxImage.Information);
                break;

            case true:
                AddReceivers();
                break;
            }

            if (result)
            {
                //Show Confirmation
                MessageBox.Show("Modtager(e)n(ne) blev føjet til modtagerlisten.", "Tilføj Modtager(e)", MessageBoxButton.OK, MessageBoxImage.Information);

                //Reset Boxes
                ComboBoxCaseId.SelectedIndex = -1;

                //Update lists and fields
                Bizz.RefreshList("IttLetterReceivers");
                Bizz.RefreshList("IttLetterShippingList");
                Shipping = new IttLetterShipping();
            }
            else
            {
                //Show error
                MessageBox.Show("Databasen returnerede en fejl. Modtager(e)n(ne) blev ikke føjet til modtagerlisten. Prøv igen.", "Tilføj Modtager(e)", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }
        private void ComboBoxParagraphs_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            int selectedIndex = ComboBoxParagraphs.SelectedIndex;

            if (IndexableIttLetterParagraphList.Count == 0)
            {
                GetIndexableIttLetterParagraphList();
            }
            foreach (IndexedIttLetterParagraph temp in IndexableIttLetterParagraphList)
            {
                if (temp.Index == selectedIndex)
                {
                    Bizz.TempIttLetterParagraph = new IttLetterParagraph(temp.Id, temp.Project, temp.Name);
                    break;
                }
            }
            Bizz.RefreshList("LegalEntities");
            IndexableLegalEntities.Clear(); //Hvorfor???
            GetIndexableIttLetterBulletList();
            ListBoxBullets.ItemsSource   = IndexableIttLetterBulletList;
            ListBoxBullets.SelectedIndex = 0;
        }
        private void ButtonClose_Click(object sender, RoutedEventArgs e)
        {
            if (CBZ.UcMainEdited)
            {
                //Warning about lost changes before closing
                if (MessageBox.Show("Du er ved at lukke 'Opret Bruger'. Data der ikke er glemt, bliver mistet.", "Brugere", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes)
                {
                    //Refresh Contacts list
                    CBZ.RefreshList("Users");
                    CBZ.TempUser = new User();

                    CBZ.CloseUcMain(UcMain);
                }
            }
            else
            {
                //Refresh Contacts list
                CBZ.RefreshList("Users");
                CBZ.TempUser = new User();

                CBZ.CloseUcMain(UcMain);
            }
        }
Exemple #26
0
        private void ButtonClose_Click(object sender, RoutedEventArgs e)
        {
            if (CBZ.UcMainEdited)
            {
                //Warning about lost changes before closing
                if (MessageBox.Show("Vil du lukke Vælg Modtagere?", "Luk Vælg Modtagere", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes)
                {
                    //Update lists and fields
                    CBZ.TempZipTown = new ZipTown();
                    CBZ.RefreshList("ZipTowns");

                    CBZ.CloseUcMain(UcMain);
                }
            }
            else
            {
                //Update lists and fields
                CBZ.TempZipTown = new ZipTown();
                CBZ.RefreshList("ZipTowns");

                CBZ.CloseUcMain(UcMain);
            }
        }
Exemple #27
0
        private void ButtonClose_Click(object sender, RoutedEventArgs e)
        {
            if (CBZ.TempBuilder != new Builder())
            {
                //Warning about lost changes before closing
                if (MessageBox.Show("Du er ved at lukke 'Opret Bygherre'. Alle ugemte data mistes", "Bygherrer", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes)
                {
                    //Refresh Builders
                    CBZ.RefreshList("Builders");
                    CBZ.TempBuilder = new Builder();

                    CBZ.CloseUcMain(UcMain);
                }
            }
            else
            {
                //Refresh Builders
                CBZ.RefreshList("Builders");
                CBZ.TempBuilder = new Builder();

                CBZ.CloseUcMain(UcMain);
            }
        }
Exemple #28
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);
            }
        }
        private void ButtonSave_Click(object sender, RoutedEventArgs e)
        {
            bool result = UpdateBuilderInDb();

            //Display result
            if (result)
            {
                //Show Confirmation
                MessageBox.Show("Bygherren blev opdateret", "Bygherrer", MessageBoxButton.OK, MessageBoxImage.Information);

                //Reset Boxes
                ListBoxBuilders.SelectedIndex = 0;
                CheckBoxActive.IsChecked      = false;

                //Refresh Entrepeneurs list
                CBZ.RefreshList("Builders");
                CBZ.TempBuilder = new Builder();
            }
            else
            {
                //Show error
                MessageBox.Show("Databasen returnerede en fejl. Bygherren blev ikke opdateret. Prøv igen.", "Bygherrer", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
 /// <summary>
 /// Method, that refreshes content of a list in CBZ
 /// </summary>
 /// <param name="list">string</param>
 private void RefreshList(string list) => CBZ.RefreshList(list);