Пример #1
0
        private void Speichern_Click(object sender, RoutedEventArgs e)
        {
            InputEvaluator ie = new InputEvaluator();


            if (ie.Evaluate(this))
            {
                PersonalAssistant paU = new PersonalAssistant();
                var a = App.Current as App;
                paU.Id                     = a.PAIndex;
                paU.HomeAdress             = new Adress();
                paU.HomeAdress.AdressId    = pa.HomeAdress.AdressId;
                paU.HomeAdress.Street      = Street.getContent();
                paU.HomeAdress.HouseNumber = parseInt(HNr.getContent());
                paU.HomeAdress.Etage       = parseInt(Etage.getContent());
                paU.HomeAdress.StairNumber = parseInt(StairNr.getContent());
                paU.HomeAdress.DoorNumber  = parseInt(DoorNr.getContent());
                paU.HomeAdress.City        = City.getContent();
                paU.HomeAdress.ZipCode     = parseInt(ZIP.getContent());
                paU.HomeAdress.Country     = Country.getContent();
                paU.nationality            = nationality.getContent();

                paU.FirstName            = FirstName.getContent();
                paU.LastName             = LastName.getContent();
                paU.EMail                = Email.getContent();
                paU.PhoneNumber          = PhoneNr.getContent();
                paU.MobilePhone          = MobileNr.getContent();
                paU.SVN                  = parseLong(SVN.getContent());
                paU.ClosingDateDocuments = DateTime.ParseExact(documentDate.getContent(), "dd.mm.yyyy", CultureInfo.InvariantCulture);

                paU.IBAN          = IBAN.getContent();
                paU.BIC           = BIC.getContent();
                paU.AccountHolder = kontoinhaber.getContent();
                //paU.EmploymentTimes.Clear();

                paU.SV            = ((bool)SV.IsChecked) ? (true) : false;
                paU.Dienstvertrag = ((bool)Dienstvertrag.IsChecked) ? (true) : false;
                paU.BestBH        = ((bool)BestätigungBH.IsChecked) ? (true) : false;
                paU.Grundkurs     = ((bool)Grundkurs.IsChecked) ? (true) : false;
                paU.Active        = ((bool)activeRadioBtn.IsChecked) ? (true) : false;

                //Weiterbildungen
                paU.consumedHours = Convert.ToDecimal(tbHours.getContent());
                paU.deadLineHours = Convert.ToDateTime(tbDeadline.getContent());
                paU.InfoField     = pa.InfoField;
                bl.UpdatePa(paU);

                //check if add and delete are in conflict
                PAtoPurchaserBL PBL = new PAtoPurchaserBL();

                foreach (Purchaser p in addedAGs)
                {
                    foreach (Purchaser pd in deletedAGs)
                    {
                        if (p.Id == pd.Id)
                        {
                            addedAGs.Remove(p);
                            deletedAGs.Remove(pd);
                        }
                    }
                }

                //add PA connection
                foreach (Purchaser p in addedAGs)
                {
                    PBL.add(paU, p);
                }

                //delete PA connection
                foreach (Purchaser p in deletedAGs)
                {
                    PBL.delete(paU, p);
                }

                //add Employments
                foreach (Employment emp in addedEmps)
                {
                    _bl.insertEmployment(emp);
                }
                //delete Employments
                foreach (Employment emp in deletedEmps)
                {
                    _bl.deleteEmployment(emp);
                }


                foreach (Window window in Application.Current.Windows)
                {
                    if (window.GetType() == typeof(Main))
                    {
                        (window as Main).FrameÜbersicht.Source = new Uri("../Personenverwaltung/PA/PAÜbersicht.xaml", UriKind.Relative);
                    }
                }
            }
        }
Пример #2
0
        private void save_Click(object sender, RoutedEventArgs e)
        {
            Purchaser purU = new Purchaser();


            if (purData.Purchaser.ContactPerson != null)
            {
                purU.ContactPerson = new Person();
                purU.ContactPerson = purData.Purchaser.ContactPerson;
            }

            PurchaserData purDataU = new PurchaserData();

            purU.HomeAdress = new Adress();
            InputEvaluator ie = new InputEvaluator();


            if (ie.Evaluate(this))
            {
                purU.Id        = AGidx;
                purU.FirstName = FirstName.getContent();
                purU.LastName  = LastName.getmustContent();
                purU.EMail     = Email.getContent();
                if (PhoneNr.getContent() != null)
                {
                    purU.PhoneNumber = PhoneNr.getContent();
                }
                if (MobileNr.getContent() != null)
                {
                    purU.MobilePhone = MobileNr.getContent();
                }
                purU.HomeAdress.AdressId    = purData.Purchaser.HomeAdress.AdressId;
                purU.HomeAdress.Street      = Street.getContent();
                purU.HomeAdress.StairNumber = parseInt(StairNr.getContent());
                purU.HomeAdress.HouseNumber = parseInt(HNr.getContent());
                purU.HomeAdress.Etage       = parseInt(Etage.getContent());
                purU.HomeAdress.DoorNumber  = parseInt(DoorNr.getContent());
                purU.HomeAdress.City        = City.getContent();
                purU.HomeAdress.Country     = Country.getContent();
                purU.HomeAdress.ZipCode     = parseInt(ZIP.getContent());
                purU.EntryDate         = EntryDate.DisplayDate;
                purU.ApprovalBegin     = ApprovelFrom.DisplayDate;
                purU.ApprovalEnd       = ApprovelTo.DisplayDate;
                purU.DistrictCommision = districtcommission.getContent();
                purU.nationality       = nationality.getContent();
                purU.SVN = parseLong(SVN.getContent());


                purDataU.HourlyRate            = parseDecimal(PayperHour.getContent());
                purDataU.TravellingAllowanceKM = parseDecimal(KmPay.getContent());
                purDataU.HourlyRatePayoff      = parseDecimal(billablePayperHour.getContent());
                purDataU.Income              = parseDecimal(Income.getContent());
                purDataU.AssistenceDemand    = parseInt(Needof.getContent());
                purDataU.InputIncome         = parseDecimal(IncomeBetrag.getContent());
                purDataU.CareAllowance       = parseInt((string)CareAllowence.SelectedValue);
                purDataU.Purchaser.InfoField = purData.Purchaser.InfoField;
                purDataU.Year      = purData.Year;
                purDataU.Month     = purData.Month;
                purU.IBAN          = IBAN.getContent();
                purU.BIC           = BIC.getContent();
                purU.AccountHolder = kontoinhaber.getContent();

                if ((bool)activeRadioBtn.IsChecked)
                {
                    purU.Active = true;
                }
                else if ((bool)inactiveRadioBtn.IsChecked)
                {
                    purU.Active = false;
                }


                if ((bool)einfuehrungskurs.IsChecked)
                {
                    purU.hasContract = true;
                }
                if ((bool)contract.IsChecked)
                {
                    purU.hasIntroCourse = true;
                }

                if (purDataU.Purchaser.Employees != null)
                {
                    foreach (EmploymentStatus emp in purData.Purchaser.Employees)
                    {
                        bool found = false;
                        foreach (PersonalAssistant pa in employedPA)
                        {
                            if (pa.Id.Equals(emp.Assistant.Id))
                            {
                                found = true;
                            }
                        }
                        if (found)
                        {
                            purU.Employees.Add(emp);
                        }
                    }
                }

                //add PA connection
                PAtoPurchaserBL PBL = new PAtoPurchaserBL();

                foreach (PersonalAssistant pa in addedPAs)
                {
                    foreach (PersonalAssistant pad in deletedPAs)
                    {
                        if (pa.Id == pad.Id)
                        {
                            addedPAs.Remove(pa);
                            deletedPAs.Remove(pad);
                        }
                    }
                }


                foreach (PersonalAssistant pa in addedPAs)
                {
                    PBL.add(pa, purU);
                }

                //delete PA connection
                foreach (PersonalAssistant pa in deletedPAs)
                {
                    PBL.delete(pa, purU);
                }


                //delete PA connection

                //AKTIV RADIO BOXEN NAMEN

                //switch to Übersicht



                foreach (Window window in Application.Current.Windows)
                {
                    if (window.GetType() == typeof(Main))
                    {
                        (window as Main).FrameÜbersicht.Source = new Uri("../Personenverwaltung/AG/AGÜbersicht.xaml", UriKind.Relative);
                    }
                }
            }
            purU.InfoField     = purData.Purchaser.InfoField;
            purDataU.Purchaser = purU;
            if (purU.FirstName != null && purU.LastName != null)
            {
                bl.UpdatePurchaser(purDataU);
            }
        }
Пример #3
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (purData == null)
            {
                purData = new PurchaserData();
            }


            if (purData.Purchaser == null)
            {
                purData.Purchaser = new Purchaser();
            }


            Purchaser pur = purData.Purchaser;

            //purData = new PurchaserData();
            pur.HomeAdress = new Adress();
            InputEvaluator ie   = new InputEvaluator();
            bool           save = true;

            if (doubles())
            {
                SystemSounds.Asterisk.Play();
                switch (MessageBox.Show("Es existiert bereits ein Auftraggeber mit diesem Namen. Soll er wirklich hinzugefügt werden?",
                                        "Achtung!",
                                        MessageBoxButton.YesNo, MessageBoxImage.Question))
                {
                case MessageBoxResult.No:
                    save = false;
                    break;

                case MessageBoxResult.Yes:
                    break;
                }
            }


            if (save)
            {
                if (ie.Evaluate(this))
                {
                    pur.FirstName = FirstName.getContent();
                    pur.LastName  = LastName.getmustContent();
                    pur.EMail     = Email.getContent();
                    if (PhoneNr.getContent() != null)
                    {
                        pur.PhoneNumber = PhoneNr.getContent();
                    }
                    if (MobileNr.getContent() != null)
                    {
                        pur.MobilePhone = MobileNr.getContent();
                    }
                    pur.HomeAdress.Street      = Street.getContent();
                    pur.HomeAdress.StairNumber = parseInt(StairNr.getContent());
                    pur.HomeAdress.HouseNumber = parseInt(HNr.getContent());
                    pur.HomeAdress.Etage       = parseInt(Etage.getContent());
                    pur.HomeAdress.DoorNumber  = parseInt(DoorNr.getContent());
                    pur.HomeAdress.City        = City.getContent();
                    pur.HomeAdress.Country     = Country.getContent();
                    pur.HomeAdress.ZipCode     = parseInt(ZIP.getContent());
                    pur.BIC                       = BIC.getContent();
                    pur.IBAN                      = IBAN.getContent();
                    pur.SVN                       = parseLong(SVN.getContent());
                    pur.AccountHolder             = kontoinhaber.getContent();
                    pur.EntryDate                 = EntryDate.SelectedDate;
                    pur.ApprovalBegin             = ApprovelFrom.SelectedDate;
                    pur.ApprovalEnd               = ApprovelTo.SelectedDate;
                    pur.nationality               = nationality.getContent();
                    purData.HourlyRate            = parseDecimal(PayperHour.getContent());
                    purData.TravellingAllowanceKM = parseDecimal(KmPay.getContent());
                    purData.HourlyRatePayoff      = parseDecimal(billablePayperHour.getContent());
                    purData.Income                = parseDecimal(Income.getContent());
                    purData.AssistenceDemand      = parseInt(Needof.getContent());
                    purData.InputIncome           = parseDecimal(IncomeBetrag.getContent());
                    purData.CareAllowance         = parseInt((string)CareAllowence.SelectedValue);
                    pur.DistrictCommision         = districtcommission.getContent();
                    if ((bool)activeRadioBtn.IsChecked)
                    {
                        pur.Active = true;
                    }

                    if ((bool)einfuehrungskurs.IsChecked)
                    {
                        pur.hasContract = true;
                    }
                    if ((bool)contract.IsChecked)
                    {
                        pur.hasIntroCourse = true;
                    }

                    //switch to Übersicht
                    foreach (Window window in Application.Current.Windows)
                    {
                        if (window.GetType() == typeof(Main))
                        {
                            (window as Main).FrameÜbersicht.Source = new Uri("../Personenverwaltung/AG/AGÜbersicht.xaml", UriKind.Relative);
                        }
                    }
                    purData.Purchaser = pur;
                    if (pur.FirstName != null && pur.LastName != null)
                    {
                        _bl.CreatePurchaser(purData);
                    }

                    //add PA connection
                    PAtoPurchaserBL PBL = new PAtoPurchaserBL();

                    foreach (PersonalAssistant pa in addedPAs)
                    {
                        foreach (PersonalAssistant pad in deletedPAs)
                        {
                            if (pa.Id == pad.Id)
                            {
                                addedPAs.Remove(pa);
                                deletedPAs.Remove(pad);
                            }
                        }
                    }


                    foreach (PersonalAssistant pa in addedPAs)
                    {
                        PBL.add(pa, pur);
                    }

                    //delete PA connection
                    foreach (PersonalAssistant pa in deletedPAs)
                    {
                        PBL.delete(pa, pur);
                    }
                }
            }
        }
Пример #4
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            InputEvaluator ie = new InputEvaluator();

            _bl = new PersonalAssistentBl();
            bool save = true;

            if (doubles())
            {
                SystemSounds.Asterisk.Play();
                switch (MessageBox.Show("Es existiert bereits ein Persönlicher Assistent mit diesem Namen. Soll er wirklich hinzugefügt werden?",
                                        "Achtung!",
                                        MessageBoxButton.YesNo, MessageBoxImage.Question))
                {
                case MessageBoxResult.No:
                    save = false;
                    break;

                case MessageBoxResult.Yes:
                    break;
                }
            }

            if (save)
            {
                if (ie.Evaluate(this))
                {
                    //PersonalAssistant pa = new PersonalAssistant();
                    pa.HomeAdress             = new Adress();
                    pa.HomeAdress.Street      = Street.getContent();
                    pa.HomeAdress.HouseNumber = parseInt(HNr.getContent());
                    pa.HomeAdress.Etage       = parseInt(Etage.getContent());
                    pa.HomeAdress.StairNumber = parseInt(StairNr.getContent());
                    pa.HomeAdress.DoorNumber  = parseInt(DoorNr.getContent());
                    pa.HomeAdress.City        = City.getContent();
                    pa.HomeAdress.ZipCode     = parseInt(ZIP.getContent());
                    pa.HomeAdress.Country     = Country.getContent();
                    pa.nationality            = nationality.getContent();

                    pa.FirstName   = FirstName.getContent();
                    pa.LastName    = LastName.getContent();
                    pa.EMail       = Email.getContent();
                    pa.PhoneNumber = PhoneNr.getContent();
                    pa.MobilePhone = MobileNr.getContent();
                    pa.SVN         = parseLong(SVN.getContent());
                    // TODO add document date

                    pa.IBAN          = IBAN.getContent();
                    pa.BIC           = BIC.getContent();
                    pa.AccountHolder = kontoinhaber.getContent();

                    pa.SV            = ((bool)SV.IsChecked) ? (true) : false;
                    pa.Dienstvertrag = ((bool)Dienstvertrag.IsChecked) ? (true) : false;
                    pa.BestBH        = ((bool)BestätigungBH.IsChecked) ? (true) : false;
                    pa.Grundkurs     = ((bool)Grundkurs.IsChecked) ? (true) : false;

                    pa.Purchasers      = new List <Purchaser>();
                    pa.EmploymentTimes = this.employmentList;


                    pa.consumedHours = Convert.ToDecimal(tbHours.getContent());

                    //Deadline für die Weiterbildungen ermitteln
                    if (pa.EmploymentTimes != null && pa.EmploymentTimes.Count != 0 && pa.EmploymentTimes.Last().EmplBegin.Year == 1)
                    {
                        pa.deadLineHours = pa.EmploymentTimes.Last().EmplBegin.AddYears(2);
                    }
                    else
                    {
                        pa.deadLineHours = DateTime.Now.AddYears(2);
                    }

                    if ((bool)activeRadioButton.IsChecked)
                    {
                        pa.Active = true;
                    }
                    foreach (Purchaser pur in employedPurchasers)

                    {
                        //pa.Purchasers.Add(pur);
                    }
                    _bl.CreatePa(pa);


                    PAtoPurchaserBL PBL = new PAtoPurchaserBL();

                    foreach (Purchaser p in addedAGs)
                    {
                        foreach (Purchaser pd in deletedAGs)
                        {
                            if (p.Id == pd.Id)
                            {
                                addedAGs.Remove(p);
                                deletedAGs.Remove(pd);
                            }
                        }
                    }

                    //insert PA Connection
                    foreach (Purchaser p in addedAGs)
                    {
                        PBL.add(pa, p);
                    }

                    //delete PA connection
                    foreach (Purchaser p in deletedAGs)
                    {
                        PBL.delete(pa, p);
                    }


                    //add Employments
                    foreach (Employment emp in addedEmps)
                    {
                        emp.EmplId = pa.Id;
                        _bl.insertEmployment(emp);
                    }
                    //delete Employments
                    foreach (Employment emp in deletedEmps)
                    {
                        emp.EmplId = pa.Id;
                        _bl.deleteEmployment(emp);
                    }



                    //switch to Übersicht
                    foreach (Window window in Application.Current.Windows)
                    {
                        if (window.GetType() == typeof(Main))
                        {
                            (window as Main).FrameÜbersicht.Source = new Uri("../Personenverwaltung/PA/PAÜbersicht.xaml", UriKind.Relative);
                        }
                    }
                }
            }
        }