예제 #1
0
        /// <summary>
        /// Lösch Button Klick Event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DeleteNoteButton_Click(object sender, RoutedEventArgs e)
        {
            Note currentSelectedNote = NotesDatagrid.SelectedItem as Note;

            if (currentSelectedNote != null)
            {
                var result = MessageBoxEnhanced.Question(IniParser.GetSetting("NOTES", "deleteNote"));
                if (result == MessageBoxResult.Yes)
                {
                    DeleteNote(currentSelectedNote);
                }
            }
        }
예제 #2
0
        /// <summary>
        /// Kassenabschlussbericht als erledigt markieren
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ReportDone_Checked(object sender, RoutedEventArgs e)
        {
            try
            {
                CheckBox cbSender  = (CheckBox)sender;
                int      closureID = (int)(cbSender).CommandParameter;

                if (!(closureID >= 0))
                {
                    throw new Exception();
                }

                CashClosureReport closureReport = CashClosureReport.GetCashClosureReports().Where(c => c.CashClosure.CashClosureID == closureID).FirstOrDefault();

                if (!closureReport.PrintDone)
                {
                    cbSender.IsChecked = false;
                    MessageBoxEnhanced.Error(IniParser.GetSetting("ERRORMSG", "cashClosureReportDoneNotPrinted"));
                    return;
                }

                CashClosure cashClosure = CashClosure.GetCashClosures(closureID).FirstOrDefault();
                DateTime    date        = cashClosure.ClosureDate;
                string      dateTime    = SafeStringParser.safeParseToStr(date, true);
                bool        isReprint   = closureReport.PrintDone;

                MessageBoxResult result = MessageBoxEnhanced.Question(IniParser.GetSetting("CASHCLOSURE", "questionMarkDone").Replace("{0}", dateTime));

                if (result == MessageBoxResult.Yes)
                {
                    int      reportID       = closureReport.CashClosureReportID;
                    bool     printDone      = closureReport.PrintDone;
                    DateTime printDate      = (DateTime)closureReport.PrintDate;
                    int      printUserID    = closureReport.PrintUserAccount.UserAccountID;
                    bool     reportDone     = true;
                    DateTime?reportDoneDate = DateTime.Now;
                    int      reportDoneUser = UserSession.userAccountID;

                    CashClosureReport.Update(reportID, closureID, printDone, printDate, printUserID, reportDone, reportDoneDate, reportDoneUser);
                    refreshCashClosureDataGrid();
                }
            }
            catch
            {
                MessageBoxEnhanced.Error(IniParser.GetSetting("ERRORMSG", "doneCashClosureReport"));
            }
        }
예제 #3
0
        /// <summary>
        /// Das Event loescht den ausgewaehlten Filter nach einer erneuten bestaetigung
        /// </summary>
        private void bDeleteSavedFilter_Click(object sender, RoutedEventArgs e)
        {
            // Bestaetigung abfragen
            var result = MessageBoxEnhanced.Question(IniParser.GetSetting("LISTS", "deleteFilterSet"));

            if (result == MessageBoxResult.No)
            {
                return;
            }

            // Cursor auf arbeitenden Kreis setzen, um zu zeigen dass das Programm was macht
            Cursor = Cursors.Wait;

            // Zu loeschendes FilterSet aus DB holen
            IEnumerable <FilterSet> filterSets = FilterSet.GetFilterSets(null, null, cBSavedFilter.Text);

            // Alle Filter für das jeweilige FilterSet und anschließend FilterSet loeschen
            foreach (FilterSet filterSet in filterSets)
            {
                IEnumerable <Filter> filters = Filter.GetFilters(null, filterSet.FilterSetID, null, null);
                foreach (Filter filter in filters)
                {
                    Filter.Delete(filter.FilterID);
                }
                FilterSet.Delete(filterSet.FilterSetID);
            }

            //ComboBox mit Filtern neu befuellen, da einer geloescht wurde.
            fillSavedFilter();

            // Drucken-, Suche-, Loeschenbutton deaktivieren
            bSearchSavedFilter.IsEnabled = false;
            bDeleteSavedFilter.IsEnabled = false;
            bPrint.IsEnabled             = false;

            // Alle Boxen für Anzuzeigende Daten reseten
            displayedDataPage.resetAll();

            // DataGrid wird resetet da Filter geloescht wurde
            lCount.Content            = "";
            dGSavedFilter.ItemsSource = null;
            dGSavedFilter.Columns.Clear();

            //Cursor zuruecksetzen
            Cursor = Cursors.Arrow;
        }
예제 #4
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"));
                }
            }
        }
예제 #5
0
        /// <summary>
        /// Kassenabschlussbericht drucken
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void printCashClosureReport_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                int closureID = (int)(((Button)sender).CommandParameter);

                if (!(closureID >= 0))
                {
                    throw new Exception();
                }

                CashClosureReport closureReport = CashClosureReport.GetCashClosureReports().Where(c => c.CashClosure.CashClosureID == closureID).FirstOrDefault();
                CashClosure       cashClosure   = CashClosure.GetCashClosures(closureID).FirstOrDefault();
                DateTime          date          = cashClosure.ClosureDate;
                string            dateTime      = SafeStringParser.safeParseToStr(date, true);
                bool isReprint = closureReport.PrintDone;

                MessageBoxResult result;

                // Wenn bereits das Original gedruckt wurde, drucke automatisch den Nachdruck
                if (isReprint)
                {
                    result = MessageBoxEnhanced.Question(IniParser.GetSetting("CASHCLOSURE", "questionReportCopyPrint").Replace("{0}", dateTime));
                }
                else
                {
                    result = MessageBoxEnhanced.Question(IniParser.GetSetting("CASHCLOSURE", "questionReportOriginalPrint").Replace("{0}", dateTime));
                }

                // Wenn der Benutzer möchte, kann ausgedruckt werden
                if (result == MessageBoxResult.Yes)
                {
                    PrintForms.printCashClosureReport(closureID, isReprint);
                }
                else
                {
                    return;
                }

                // Wenn Nachdruck, dann ändere nichts an dem Datensatz
                if (isReprint)
                {
                    return;
                }

                // Damit die Nachfrage nicht sofort aufploppt
                Thread.Sleep(1000);

                MessageBoxResult success = MessageBoxEnhanced.Question(IniParser.GetSetting("CASHCLOSURE", "questionPrintReportSuccess"));

                if (success == MessageBoxResult.Yes)
                {
                    int      reportID       = closureReport.CashClosureReportID;
                    bool     printDone      = true;
                    DateTime printDate      = DateTime.Now;
                    int      printUserID    = UserSession.userAccountID;
                    bool     reportDone     = closureReport.Done;
                    DateTime?reportDoneDate = closureReport.DoneDate;

                    int?reportDoneUser;
                    if (closureReport.DoneUserAccount != null)
                    {
                        reportDoneUser = closureReport.DoneUserAccount.UserAccountID;
                    }
                    else
                    {
                        reportDoneUser = null;
                    }

                    CashClosureReport.Update(reportID, closureID, printDone, printDate, printUserID, reportDone, reportDoneDate, reportDoneUser);
                    refreshCashClosureDataGrid();
                }
            }
            catch
            {
                MessageBoxEnhanced.Error(IniParser.GetSetting("ERRORMSG", "printCashClosureReport"));
            }
        }