Esempio n. 1
0
        public void disableTabs()
        {
            pEditClientPerson pPerson = getPageFromTabs <pEditClientPerson>();
            int childs = Convert.ToInt32(pPerson.txtChildrens.Content);

            DB.FamilyState fS = pPerson.cbFamilyState.SelectedItem as DB.FamilyState;

            if (!(childs > 0) && !(fS.ShortName.Equals("VH") || fS.ShortName.Equals("LP")))
            {
                TabControl tC = this.parentTabControl;
                var        childPartnerTab = ((Control)(tC.Items.GetItemAt(1))).IsEnabled = false;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Deaktiviert je nach Familienstatus oder Kinderzahl die Tabs und dessen Groupboxen
        /// Author: Antonios Fesenmeier
        /// </summary>
        public void disableTabs()
        {
            int childs = Convert.ToInt32(this.txtChildrens.Content);

            DB.FamilyState fS = cbFamilyState.SelectedItem as DB.FamilyState;
            if (childs == 0 && !fS.ShortName.Equals("VH") && !fS.ShortName.Equals("LP"))
            {
                TabControl tC = this.parentTabControl;
                var        childPartnerTab = ((Control)(tC.Items.GetItemAt(1))).IsEnabled = false;

                pNewClientPartnerChild pPartnerChild = getPageFromTabs <pNewClientPartnerChild>();
                pPartnerChild.GrBChildren.IsEnabled = false;
                pPartnerChild.GrBPartner.IsEnabled  = false;
            }
        }
Esempio n. 3
0
        public void disableTabs()
        {
            int childs = Convert.ToInt32(this.txtChildrens.Content);

            DB.FamilyState fS = cbFamilyState.SelectedItem as DB.FamilyState;

            if (!(childs > 0) && (!(fS.ShortName.Equals("VH") || fS.ShortName.Equals("LP"))))
            {
                TabControl tC = this.parentTabControl;
                var        childPartnerTab = ((Control)(tC.Items.GetItemAt(1))).IsEnabled = false;
            }
            else
            {
                this.EnableTabs();
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Speichert bei Korrektheit aller Tabs die veränderten Kunden, Kinder, Partner und Einkommensdaten
        ///
        /// Author: Antonios Fesenmeier, Georg Schmid
        /// </summary>
        /// <param name="button"></param>
        public void pbSaveEdit_Click(Button button)
        {
            TabControl tC = this.parentTabControl;

            pEditClientPerson       pPerson       = getPageFromTabs <pEditClientPerson>();
            pEditClientPartnerChild pPartnerChild = getPageFromTabs <pEditClientPartnerChild>();
            pEditClientRevenues     pRevenues     = getPageFromTabs <pEditClientRevenues>();

            bool _PersonIsValid       = pPerson.checkPersonTab(),
                 _ChildPartnerIsValid = pPartnerChild.checkPartnerChildTab(),
                 _RevenuesIsValid     = pRevenues.checkRevenuesTab();

            if (_PersonIsValid == false)
            {
                pPerson.getErrorMsg();
            }
            pPerson.clearErrorMsg();

            if (((TabItem)tC.Items.GetItemAt(1)).IsEnabled)
            {
                if (_PersonIsValid && _ChildPartnerIsValid == false)
                {
                    pPartnerChild.getErrorMsg();
                }
            }
            pPartnerChild.clearErrorMsg();

            if (((TabItem)tC.Items.GetItemAt(2)).IsEnabled)
            {
                if (_PersonIsValid && _ChildPartnerIsValid && _RevenuesIsValid == false)
                {
                    pRevenues.getErrorMsg();
                }
            }
            pRevenues.clearErrorMsg();

            if (_PersonIsValid && _ChildPartnerIsValid && _RevenuesIsValid)
            {
                try
                {
                    // Daten für Person holen
                    DB.Title       title = pPerson.cbTitle.SelectedItem as DB.Title;
                    DB.FamilyState fS    = pPerson.cbFamilyState.SelectedItem as DB.FamilyState;

                    String   firstName     = pPerson.txtFirstName.Text;
                    String   lastName      = pPerson.txtLastName.Text;
                    String   street        = pPerson.txtStreet.Text;
                    String   nationality   = pPerson.txtNationalCountry.Text;
                    DateTime birthday      = (DateTime)pPerson.dpBirthday.SelectedDate;
                    int      group         = Convert.ToInt32(pPerson.cbGroup.SelectedValue.ToString());
                    int      zipCode       = Convert.ToInt32(pPerson.txtZipCode.Text);
                    String   city          = pPerson.txtCity.Text;
                    DateTime startDate     = (DateTime)pPerson.dpStartDate.SelectedDate;
                    DateTime endDate       = (DateTime)pPerson.dpEndDate.SelectedDate;
                    int      childs        = Convert.ToInt32(pPerson.txtChildrens.Content);
                    String   nativeCountry = pPerson.txtNativeCountry.Text;
                    String   email         = pPerson.txtEmail.Text;
                    String   mobileNo      = pPerson.txtMobileNo.Text;
                    String   phoneNo       = pPerson.txtTelno.Text;
                    int      tableNo       = Convert.ToInt32(pPerson.txtTableNo.Text);
                    // Daten für Partner holen

                    String   firstNamePartner     = pPartnerChild.txtFirstName1.Text;
                    String   lastNamePartner      = pPartnerChild.txtLastName1.Text;
                    String   nationalityPartner   = pPartnerChild.txtNationalCountry1.Text;
                    DateTime?birthdayPartner      = pPartnerChild.dpBirthday1.SelectedDate;
                    String   nativeCountryPartner = pPartnerChild.txtNativeCountry1.Text;
                    String   maritalPhone         = pPartnerChild.txtTelno1.Text;
                    String   maritalMobile        = pPartnerChild.txtMobileNo1.Text;
                    String   maritalEmail         = pPartnerChild.txtEmail1.Text;

                    DB.Title maritalTitle = pPartnerChild.cbTitle1.SelectedItem as DB.Title;

                    //TeamID mit UserID beschreiben
                    int userID = _UserAccount.UserAccountID;


                    //Person aktualisieren
                    int personID = pPerson.getPersonID();
                    if (maritalTitle != null)
                    {
                        DB.Person.Update(personID, title.TitleID, fS.FamilyStateID, userID, firstName, lastName, zipCode, city, street, nationality, tableNo, phoneNo, mobileNo, null, nativeCountry, birthday, email, group, startDate, endDate, birthdayPartner, firstNamePartner, lastNamePartner, nationalityPartner, null, nativeCountryPartner, maritalPhone, maritalMobile, maritalEmail, maritalTitle.TitleID);
                    }
                    else
                    {
                        DB.Person.Update(personID, title.TitleID, fS.FamilyStateID, userID, firstName, lastName, zipCode, city, street, nationality, tableNo, phoneNo, mobileNo, null, nativeCountry, birthday, email, group, startDate, endDate, birthdayPartner, firstNamePartner, lastNamePartner, nationalityPartner, null, nativeCountryPartner, maritalPhone, maritalMobile, maritalEmail);
                    }


                    // Alle Kinder holen und speichern
                    IList <DB.Child> lChilds = new List <DB.Child>();
                    lChilds = pPartnerChild.getChilds();

                    foreach (DB.Child aChild in lChilds)
                    {
                        String   aChildLastName  = aChild.LastName;
                        String   aChildFirstName = aChild.FirstName;
                        bool     aChildIsFemale  = aChild.IsFemale;
                        DateTime aChildsBirthday = aChild.DateOfBirth;

                        if (aChild.ChildID == 0)
                        {
                            var childID = DB.Child.Add(personID, aChildFirstName, aChildLastName, aChildsBirthday, aChildIsFemale);
                        }
                        else
                        {
                            DB.Child.Update(aChild.ChildID, aChildFirstName, aChildLastName, aChildsBirthday, aChildIsFemale);
                        }
                    }

                    // Alle Revenues holen und speichern
                    IList <DB.Revenue> lRevs = new List <DB.Revenue>();
                    lRevs = pRevenues.getRevenues();

                    foreach (DB.Revenue aRev in lRevs)
                    {
                        Double amount   = aRev.Amount;
                        String desc     = aRev.Description;
                        int    revTypID = aRev.RevenueType.RevenueTypeID;

                        if (aRev.RevenueID == 0)
                        {
                            var revenueID = DB.Revenue.Add(personID, revTypID, amount, aRev.StartDate, aRev.EndDate, desc);
                        }
                        else
                        {
                            DB.Revenue.Update(aRev.RevenueID, revTypID, amount, desc, aRev.StartDate, aRev.EndDate);
                        }
                    }

                    //Gelöschte Childs aus Datenbank entfernen
                    List <int> deletedChilds = pPartnerChild.getDeletedChilds();
                    foreach (int dchildID in deletedChilds)
                    {
                        if (dchildID != 0)
                        {
                            DB.Child.Delete(dchildID);
                        }
                    }

                    //Gelöschte Revenues aus Datenbank entfernen
                    List <int> deletedRevenues = pRevenues.getDeletedRevenues();
                    foreach (int drevID in deletedRevenues)
                    {
                        if (drevID != 0)
                        {
                            DB.Revenue.Delete(drevID);
                        }
                    }

                    //Zurück zur Verwaltung
                    KPage      pageClientAdministration = new KöTaf.WPFApplication.Views.pClientAdministration(pagingStartValue);
                    SinglePage singlePage = new SinglePage(IniParser.GetSetting("CLIENT", "clientManagement"), pageClientAdministration);
                }
                catch
                {
                    MessageBoxEnhanced.Error(IniParser.GetSetting("ERRORMSG", "common"));
                }
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Überprüft alle Untertabs auf Vollständigkeit/ Korrektheit und speichert
        /// bei Korrektheit alle Kinder, Partner, die Person selbst und deren Einkommen
        /// mit allen Abhängigkeiten in die Datenbank
        ///
        /// Author: Antonios Fesenmeier
        /// </summary>
        /// <param name="button"></param>
        public void pbSave_Click(Button button)
        {
            TabControl tC = this.parentTabControl;

            pNewClientPerson       pPerson       = getPageFromTabs <pNewClientPerson>();
            pNewClientPartnerChild pPartnerChild = getPageFromTabs <pNewClientPartnerChild>();
            pNewClientRevenues     pRevenues     = getPageFromTabs <pNewClientRevenues>();

            bool _PersonIsValid       = pPerson.checkPersonTab(),
                 _ChildPartnerIsValid = pPartnerChild.checkPartnerChildTab(),
                 _RevenuesIsValid     = pRevenues.checkRevenuesTab();

            if (_PersonIsValid == false)
            {
                pPerson.getErrorMsg();
            }
            pPerson.clearErrorMsg();

            if (((TabItem)tC.Items.GetItemAt(1)).IsEnabled)
            {
                if (_PersonIsValid && _ChildPartnerIsValid == false)
                {
                    pPartnerChild.getErrorMsg();
                }
            }
            pPartnerChild.clearErrorMsg();

            if (((TabItem)tC.Items.GetItemAt(2)).IsEnabled)
            {
                if (_PersonIsValid && _ChildPartnerIsValid && _RevenuesIsValid == false)
                {
                    pRevenues.getErrorMsg();
                }
            }
            pRevenues.clearErrorMsg();

            if (_PersonIsValid && _ChildPartnerIsValid && _RevenuesIsValid)
            {
                try
                {
                    // Daten für Person holen
                    DB.Title       title = pPerson.cbTitle.SelectedItem as DB.Title;
                    DB.FamilyState fS    = pPerson.cbFamilyState.SelectedItem as DB.FamilyState;

                    String   firstName     = pPerson.txtFirstName.Text;
                    String   lastName      = pPerson.txtLastName.Text;
                    String   street        = pPerson.txtStreet.Text;
                    String   nationality   = pPerson.txtNationalCountry.Text;
                    DateTime birthday      = (DateTime)pPerson.dpBirthday.SelectedDate;
                    int      group         = Convert.ToInt32(pPerson.cbGroup.SelectedValue.ToString());
                    int      zipCode       = Convert.ToInt32(pPerson.txtZipCode.Text);
                    String   city          = pPerson.txtCity.Text;
                    DateTime startDate     = (DateTime)pPerson.dpStartDate.SelectedDate;
                    DateTime endDate       = (DateTime)pPerson.dpEndDate.SelectedDate;
                    int      childs        = Convert.ToInt32(pPerson.txtChildrens.Content);
                    String   nativeCountry = pPerson.txtNativeCountry.Text;
                    String   email         = pPerson.txtEmail.Text;
                    String   mobileNo      = pPerson.txtMobileNo.Text;
                    String   phoneNo       = pPerson.txtTelno.Text;
                    int      tableNo       = Convert.ToInt32(pPerson.txtTableNo.Text);
                    // Daten für Partner holen

                    String   firstNamePartner     = pPartnerChild.txtFirstName1.Text;
                    String   lastNamePartner      = pPartnerChild.txtLastName1.Text;
                    String   nationalityPartner   = pPartnerChild.txtNationalCountry1.Text;
                    DateTime?birthdayPartner      = pPartnerChild.dpBirthday1.SelectedDate;
                    String   nativeCountryPartner = pPartnerChild.txtNativeCountry1.Text;
                    String   maritalPhone         = pPartnerChild.txtTelno1.Text;
                    String   maritalMobile        = pPartnerChild.txtMobileNo1.Text;
                    String   maritalEmail         = pPartnerChild.txtEmail1.Text;

                    DB.Title maritalTitle   = pPartnerChild.cbTitle1.SelectedItem as DB.Title;
                    int      maritalTitleID = maritalTitle.TitleID;

                    //UserID beschreiben
                    int userID = _UserAccount.UserAccountID;

                    // Person speichern
                    var personID = DB.Person.Add(title.TitleID, fS.FamilyStateID, firstName, lastName, street, nationality, birthday, group, zipCode, city, startDate, endDate,
                                                 userID, nativeCountry, email, mobileNo, phoneNo, firstNamePartner, lastNamePartner, nationalityPartner, birthdayPartner, nativeCountryPartner, maritalPhone, maritalMobile, maritalEmail, maritalTitle.TitleID, null, tableNo);

                    // Alle Kinder holen und speichern
                    IList <DB.Child> lChilds = new List <DB.Child>();
                    lChilds = pPartnerChild.getChilds();

                    foreach (DB.Child aChild in lChilds)
                    {
                        String   aChildLastName  = aChild.LastName;
                        String   aChildFirstName = aChild.FirstName;
                        bool     aChildIsFemale  = aChild.IsFemale;
                        DateTime aChildsBirthday = aChild.DateOfBirth;

                        var childID = DB.Child.Add(personID, aChildFirstName, aChildLastName, aChildsBirthday, aChildIsFemale);
                    }

                    // Alle Revenues holen und speichern
                    IList <DB.Revenue> lRevs = new List <DB.Revenue>();
                    lRevs = pRevenues.getRevenues();

                    foreach (DB.Revenue aRev in lRevs)
                    {
                        Double amount   = aRev.Amount;
                        String desc     = aRev.Description;
                        int    revTypID = aRev.RevenueType.RevenueTypeID;


                        var revenueID = DB.Revenue.Add(personID, revTypID, amount, aRev.StartDate, aRev.EndDate, desc);
                    }

                    //Wenn erfolgreich Dokumente Drucken
                    MessageBoxResult result1 = MessageBoxEnhanced.Question("Möchten Sie für diesen neuen Kunden das Aufnahmeformular jetzt drucken?");
                    if (result1 == MessageBoxResult.Yes)
                    {
                        PrintForms.printClientEnrolmentForm(personID);
                    }

                    MessageBoxResult result2 = MessageBoxEnhanced.Question("Möchten Sie für diesen neuen Kunden die Widerrufbelehrung jetzt drucken?");
                    if (result2 == MessageBoxResult.Yes)
                    {
                        PrintForms.printClientDisclaimer(personID);
                    }

                    //Zurück zur Verwaltung
                    KPage      pageClientAdministration = new KöTaf.WPFApplication.Views.pClientAdministration();
                    SinglePage singlePage = new SinglePage(IniParser.GetSetting("CLIENT", "clientManagement"), pageClientAdministration);
                }
                catch
                {
                    MessageBoxEnhanced.Error(IniParser.GetSetting("ERRORMSG", "common"));
                }
            }
        }
Esempio n. 6
0
        public void EnableTabs()
        {
            if (this._PersonIsValid == true)
            {
                Boolean haveChild = false, havePartner = false;
                int     childs = Convert.ToInt32(txtChildrens.Content);

                pEditClientPartnerChild pPartnerChild = getPageFromTabs <pEditClientPartnerChild>();

                // Wurde angegeben dass Kinder vorhanden sind, wird die
                // entsprechende Gruppe von Controls enabled
                if (childs > 0)
                {
                    pPartnerChild.GrBChildren.IsEnabled = true;
                    haveChild = true;
                }
                else
                {
                    pPartnerChild.GrBChildren.IsEnabled = false;
                }

                DB.FamilyState fS = cbFamilyState.SelectedItem as DB.FamilyState;

                if (fS.ShortName.Equals("VH") || fS.ShortName.Equals("LP"))
                {
                    pPartnerChild.GrBPartner.IsEnabled = true;
                    havePartner = true;

                    //KinderGroupbox aktivieren, damit Kinder hinzugefügt werden können
                    pPartnerChild.GrBChildren.IsEnabled = true;


                    //Daten des Partners eintragen
                    var titles = DataModel.Title.GetTitles().ToList();
                    pPartnerChild.cbTitle1.ItemsSource = titles;
                    if (_currentPerson.MaritalTitle != null)
                    {
                        pPartnerChild.cbTitle1.SelectedIndex = titles.FindIndex(t => t.TitleID == _currentPerson.MaritalTitle.TitleID);
                    }
                    if (_currentPerson.MaritalBirthday != null)
                    {
                        pPartnerChild.dpBirthday1.SelectedDate = _currentPerson.MaritalBirthday;
                    }
                }
                else
                {
                    pPartnerChild.GrBPartner.IsEnabled = false;
                    havePartner = false;

                    //Daten für Partner löschen

                    pPartnerChild.cbTitle1.SelectedIndex   = 0;
                    pPartnerChild.txtFirstName1.Text       = "";
                    pPartnerChild.txtLastName1.Text        = "";
                    pPartnerChild.txtNationalCountry1.Text = "";

                    //Datum auf leer setzten
                    //pPartnerChild.dpBirthday1.SelectedDate = DateTime.Now;

                    pPartnerChild.txtNativeCountry1.Text = "";
                    pPartnerChild.txtTelno1.Text         = "";
                    pPartnerChild.txtMobileNo1.Text      = "";
                    pPartnerChild.txtEmail1.Text         = "";
                }

                TabControl tC              = this.parentTabControl;
                var        tab             = tC.Items.GetItemAt(1);
                Control    childPartnerTab = ((Control)tab);


                tab = tC.Items.GetItemAt(2);
                Control revenuesTab = ((Control)tab);

                if (haveChild == true || havePartner == true)
                {
                    childPartnerTab.IsEnabled = true;
                    return;
                }
                else
                {
                    childPartnerTab.IsEnabled = false;
                    revenuesTab.IsEnabled     = true;
                }
            }
        }
Esempio n. 7
0
        /// <summary>
        /// Je nach Kinderzahl oder Familienstand müssen die jeweiligen Tabs enabled werden.
        /// Author: Antonios Fesenmeier, Georg Schmid
        /// </summary>
        public void EnableTabs()
        {
            if (this._PersonIsValid == true)
            {
                Boolean haveChild = false, havePartner = false;
                int     childs = Convert.ToInt32(txtChildrens.Content);

                pNewClientPartnerChild pPartnerChild = getPageFromTabs <pNewClientPartnerChild>();

                // Wurde angegeben dass Kinder vorhanden sind, wird die
                // entsprechende Gruppe von Controls enabled
                if (childs > 0)
                {
                    pPartnerChild.GrBChildren.IsEnabled = true;
                    pPartnerChild.addNewChildtoDatagrid();
                    haveChild = true;
                }
                else
                {
                    pPartnerChild.GrBChildren.IsEnabled = false;
                }

                DB.FamilyState fS = cbFamilyState.SelectedItem as DB.FamilyState;


                // Gleiches Verfahren wie bei den Kindern implementieren!!!
                if (fS.ShortName.Equals("VH") || fS.ShortName.Equals("LP"))
                {
                    pPartnerChild.GrBPartner.IsEnabled  = true;
                    pPartnerChild.GrBChildren.IsEnabled = true;
                    pPartnerChild.addNewChildtoDatagrid();
                    haveChild   = true;
                    havePartner = true;

                    ////KinderGroupbox aktivieren, damit Kinder hinzugefügt werden können
                    //pPartnerChild.GrBChildren.IsEnabled = true;
                    //pPartnerChild.addNewChildtoDatagrid();
                }
                else
                {
                    pPartnerChild.GrBPartner.IsEnabled = false;
                    havePartner = false;
                }

                TabControl tC              = this.parentTabControl;
                var        tab             = tC.Items.GetItemAt(1);
                Control    childPartnerTab = ((Control)tab);

                tab = tC.Items.GetItemAt(2);
                Control revenuesTab = ((Control)tab);

                if (haveChild == true || havePartner == true)
                {
                    childPartnerTab.IsEnabled = true;
                    return;
                }
                else
                {
                    childPartnerTab.IsEnabled = false;
                    revenuesTab.IsEnabled     = true;
                }
            }
        }
Esempio n. 8
0
 /// <summary>
 /// Veraltete Methode zum Hinzufügen eines neuen Objekts zum EntitySet 'FamilyStates'. Verwenden Sie stattdessen die Methode '.Add' der zugeordneten Eigenschaft 'ObjectSet&lt;T&gt;'.
 /// </summary>
 public void AddToFamilyStates(FamilyState familyState)
 {
     base.AddObject("FamilyStates", familyState);
 }
Esempio n. 9
0
 /// <summary>
 /// Erstellt ein neues FamilyState-Objekt.
 /// </summary>
 /// <param name="familyStateID">Anfangswert der Eigenschaft FamilyStateID.</param>
 /// <param name="name">Anfangswert der Eigenschaft Name.</param>
 /// <param name="shortName">Anfangswert der Eigenschaft ShortName.</param>
 public static FamilyState CreateFamilyState(global::System.Int32 familyStateID, global::System.String name, global::System.String shortName)
 {
     FamilyState familyState = new FamilyState();
     familyState.FamilyStateID = familyStateID;
     familyState.Name = name;
     familyState.ShortName = shortName;
     return familyState;
 }