예제 #1
0
        /// <summary>
        /// Nach dem Editieren wird auf Korrektheit geprüft und ggfs. in die DB gespeichert
        /// Author: Antonios Fesenmeier
        /// </summary>
        /// <param name="button"></param>
        private void pbSave_Click(Button button)
        {
            _Validator.clearSB();
            // Wurde die Validierung positiv abgeschlossen müssen die Werte der einzelnen Felder in die Datenbank geschrieben werden!
            CheckForm();

            var isCompany = chBIsCompany.IsChecked;

            if (_IsValid == false)
            {
                MessageBoxEnhanced.Error(_Validator.getErrorMsg().ToString());
            }
            else
            {
                var title       = cbTitle.SelectedItem as DB.Title;
                var fundingType = cBFundType.SelectedItem as DB.FundingType;

                if (isCompany == true)
                {
                    DB.Sponsor.Update(_CurrentSponsor.SponsorID, title.TitleID, fundingType.FundingTypeID, txtStreet.Text, txtCity.Text, Convert.ToInt32(txtZipCode.Text),
                                      txtFirstName.Text, txtLastName.Text, txtCompanyName.Text, txtMobileNo.Text, txtTelNo.Text, txtFax.Text, txtEMail.Text, null, isCompany.Value);
                }
                else
                {
                    DB.Sponsor.Update(_CurrentSponsor.SponsorID, title.TitleID, fundingType.FundingTypeID, txtStreet.Text, txtCity.Text, Convert.ToInt32(txtZipCode.Text),
                                      txtFirstName.Text, txtLastName.Text, "", txtMobileNo.Text, txtTelNo.Text, txtFax.Text, txtEMail.Text, null, isCompany.Value);
                }

                KPage      pageSponsorAdministration = new KöTaf.WPFApplication.Views.pSponsorAdministration(pagingStartValue);
                SinglePage singlePage = new SinglePage(IniParser.GetSetting("APPSETTINGS", "sponsorAdministration"), pageSponsorAdministration);
            }
            _Validator.clearSB();
        }
예제 #2
0
        private void Init()
        {
            try
            {
                _Validator = new ValidationTools();
            }
            catch (Exception ex)
            {
                MessageBoxEnhanced.Error(ex.Message);
                return;
            }

            gbCompanySponsor.Visibility = System.Windows.Visibility.Collapsed;
            gbCompanySponsor.IsEnabled  = false;

            this.DataContext = this._CurrentSponsor;

            // Title ComboBox
            var titles = DB.Title.GetTitles();

            cbTitle.ItemsSource  = titles;
            cbTitle.SelectedItem = titles.SingleOrDefault(t => t.TitleID == _CurrentSponsor.Title.TitleID);

            // FundingType ComboBox
            var fundingTypes = DB.FundingType.GetFundingTypes();

            cBFundType.ItemsSource  = fundingTypes;
            cBFundType.SelectedItem = fundingTypes.SingleOrDefault(ft => ft.FundingTypeID == _CurrentSponsor.FundingType.FundingTypeID);
        }
예제 #3
0
        /// <summary>
        /// Löscht ein Konto
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void pbDelete_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                int            accountID      = (int)((Button)sender).CommandParameter;
                List <Account> account        = Account.GetAccounts(accountID).ToList();
                Account        currentAccount = account[0];

                if (currentAccount == null)
                {
                    throw new Exception(IniParser.GetSetting("ERRORMSG", "deleteAccount"));
                }

                if (currentAccount.IsFixed)
                {
                    throw new Exception(IniParser.GetSetting("ERRORMSG", "deleteFixedAccount"));
                }

                Account.Delete(currentAccount.AccountID);

                MainWindow mainWindow = Application.Current.MainWindow as MainWindow;
                Type       pageType   = typeof(pAccountManager);
                mainWindow.switchPage(IniParser.GetSetting("ACCOUNTING", "accountManagement"), pageType);
            }
            catch (Exception ex)
            {
                MessageBoxEnhanced.Error(ex.Message);
            }
        }
예제 #4
0
        private void Init()
        {
            try
            {
                this._PersonValidator = new ValidationTools();
            }
            catch (Exception ex)
            {
                MessageBoxEnhanced.Error(ex.Message);
                return;
            }
            this._Childs = new List <DB.Child>();

            // Jeder neue Kunde bekommt zunächst eine TafelNummer
            this._TableNo   = DB.Person.GetNewIdentityNo();
            txtTableNo.Text = this._TableNo.ToString();

            // Title ComboBox
            cbTitle.ItemsSource = DB.Title.GetTitles();

            // FamilyState ComboBox
            cbFamilyState.ItemsSource = DB.FamilyState.GetFamilyStates();

            // Gültig von/bis -> Personalien
            dpStartDate.SelectedDate = DateTime.Now;
            dpEndDate.SelectedDate   = DateTime.Now.AddMonths(6); // 6 Monate gültig

            // Gruppen ComboBox befüllen
            cbGroup.Items.Add("1");
            cbGroup.Items.Add("2");


            this._IsInitialized = true;
        }
        /// <summary>
        /// FilterSet speichern
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void saveFilterSet_Click(object sender, RoutedEventArgs e)
        {
            // Prüfe ob für das Statistiken/Listen-Modul
            if (this.useForListModule && string.IsNullOrEmpty(tbName.Text))
            {
                MessageBoxEnhanced.Error(IniParser.GetSetting("FORMLETTER", "noSetNameSpecified"));
                return;
            }

            // Keine leeren Filtersets zulassen
            if (!(listBox1.Items.Count > 0))
            {
                return;
            }

            // Lese Filter aus Filter-Liste
            foreach (var subitem in listBox1.Items)
            {
                currentFilterSet.addFilter(subitem as FilterModel);
            }

            // Wenn nicht für Listen-Modul, lege FilterSet im Speicher ab
            if (!this.useForListModule)
            {
                allFilterSets.Add(currentFilterSet);
            }

            // Für das Listen/Statistiken-Modul wird das FilterSet direkt in die Datenbank gespeichert
            if (this.useForListModule)
            {
                string name = tbName.Text;
                try
                {
                    int filterSetID = FilterSet.Add(name, currentFilterSet.linkingType);

                    // Bearbeite alle Filter zu jedem Set
                    foreach (var filter in currentFilterSet.filterList)
                    {
                        string table     = filter.group.ToString();
                        string type      = filter.criterion.ToString();
                        string operation = filter.operation.ToString();
                        string value     = filter.value;
                        int    filterID  = Filter.Add(filterSetID, table, type, operation, value);
                    }
                }
                catch
                {
                }
            }

            listBox1.IsEnabled          = false;
            listBox2.IsEnabled          = true;
            btDeleteSetButton.IsEnabled = true;
            refreshListBoxWithAllFilterSets();
            currentFilterSet = null;
            clearForm();
            tbName.Clear();
            deactivateForm();
        }
예제 #6
0
 public void getErrorMsg()
 {
     if (this._PersonIsValid == false)
     {
         MessageBoxEnhanced.Error(_PersonValidator.getErrorMsg().ToString());
         this._PersonValidator.clearSB();
     }
 }
예제 #7
0
        private void Init()
        {
            try
            {
                this._PersonValidator = new ValidationTools();
            }
            catch (Exception ex)
            {
                MessageBoxEnhanced.Error(ex.Message);
                return;
            }
            this._Childs = new List <ChildModel>();

            //Datenkontext für die Seite festlegen
            this.DataContext = _currentPerson;

            // Title ComboBox
            var titles = DataModel.Title.GetTitles().ToList();

            cbTitle.ItemsSource = titles;
            if (_currentPerson.Title != null)
            {
                cbTitle.SelectedIndex = titles.FindIndex(t => t.TitleID == _currentPerson.Title.TitleID);
            }

            // FamilyState ComboBox
            var familyStates = DB.FamilyState.GetFamilyStates().ToList();

            cbFamilyState.ItemsSource = familyStates;
            if (_currentPerson.FamilyState != null)
            {
                cbFamilyState.SelectedIndex = familyStates.FindIndex(f => f.FamilyStateID == _currentPerson.FamilyState.FamilyStateID);
            }


            // Gültig von/bis -> Personalien
            dpStartDate.SelectedDate = _currentPerson.ValidityStart;
            dpEndDate.SelectedDate   = _currentPerson.ValidityEnd;

            // Gruppen ComboBox befüllen
            cbGroup.Items.Add("1");
            cbGroup.Items.Add("2");
            //Richtige Gruppe auswählen
            if (_currentPerson.Group == 1)
            {
                cbGroup.SelectedIndex = 0;
            }
            else
            {
                cbGroup.SelectedIndex = 1;
            }

            setNumberOfChild(_currentPerson.NumberOfChildren.ToString());



            this._IsInitialized = true;
        }
예제 #8
0
        /// <summary>
        /// Aktiviert oder deaktiviert einen Benutzer
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ToggleUserActivateStateButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                UserAccount currentUserAccount = UserDataGrid.SelectedItem as UserAccount;

                if (currentUserAccount != null)
                {
                    if (currentUserAccount.IsAdmin && currentUserAccount.IsActive && UserAccount.GetUserAccounts().Where(u => u.IsAdmin).ToList().Count <= 1)
                    {
                        throw new Exception(IniParser.GetSetting("ERRORMSG", "deactivateAdmin"));
                    }

                    if (UserSession.userAccountID.Equals(currentUserAccount.UserAccountID))
                    {
                        throw new Exception(IniParser.GetSetting("ERRORMSG", "selfDeactivation"));
                    }

                    var state   = currentUserAccount.IsActive;
                    var message = string.Format(IniParser.GetSetting("USER", "confirmationFormatString"),
                                                currentUserAccount.Username,
                                                ((state) ? IniParser.GetSetting("FILTER", "inactive") : IniParser.GetSetting("FILTER", "active")));

                    var dialogResult = MessageBox.Show(message, IniParser.GetSetting("USER", "confirmationNeeded"), MessageBoxButton.OKCancel, MessageBoxImage.Question);
                    if (dialogResult == MessageBoxResult.OK)
                    {
                        if (state)
                        {
                            UserAccount.Deactivate(currentUserAccount.UserAccountID);
                        }
                        else
                        {
                            UserAccount.Activate(currentUserAccount.UserAccountID);
                        }

                        this.userAccounts = UserAccount.GetUserAccounts();
                        if (this.userAccounts != null)
                        {
                            this.userAccounts.OrderByDescending(u => u.IsActive);
                        }

                        if (this.parentToolbar.searchPanel.searchBox.Text == IniParser.GetSetting("APPSETTINGS", "search"))
                        {
                            processKeyUp("");
                        }
                        else
                        {
                            processKeyUp(this.parentToolbar.searchPanel.searchBox.Text);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBoxEnhanced.Error(ex.Message);
            }
        }
예제 #9
0
 /// <summary>
 /// Stoppe Dispatcher Timer, Zeige dezeitiges Objekt an.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dispatcherTime_Tick(object sender, EventArgs e)
 {
     dispatcherTimer.Stop();
     if (!checkAccount())
     {
         MessageBoxEnhanced.Error(IniParser.GetSetting("ERRORMSG", "dbAccountFail"));
         System.Environment.Exit(1);
     }
     this.Show();
 }
예제 #10
0
        /// <summary>
        /// Konstruktor, holt entsprechende Variablen aus der Konfigurationsdatei,
        /// und initialisiert die Klassen CheckForUSB und Timer.
        /// </summary>
        /// <param name="mainW"></param>
        /// <param name="_DbLevel"></param>
        public USB_Identification(MainWindow mainW = null, string _DbLevel = "backup")
        {
            InitializeComponent();
            // Überprüfe CheckForUSB und Timer. Wenn ein Fehler durch die Konfigurationsdatei verursacht wurde,
            // beende den dezeitigen Zustand.
            try
            {
                this._Cusb  = new CheckForUSB();
                this._Timer = new Timer();
            }
            catch (Exception ex) {
                MessageBoxEnhanced.Error(ex.Message);
                this.Close();
                return;
            }
            this._MainWindowObj = mainW;
            // Zuornung aller relevanten Werte aus der Konfiguationsdatei.
            try
            {
                this._USB_FOLDER_NAME = IniParser.GetSetting("USB", "USB_FOLDER_NAME");
                this._TIME_FACTOR_TO_ENABLED_BACKUP_CANCEL_BUTTON = Convert.ToInt32(IniParser.GetSetting("USB", "TIME_FACTOR_TO_ENABLED_BACKUP_CANCEL_BUTTON"));
                this._FILENAME_DB_EXTENSION = IniParser.GetSetting("USB", "FILENAME_DB_EXTENSION").ToLower();
                // __FILENAME_DB_EXTENSION darf nicht null sein.
                if (this._FILENAME_DB_EXTENSION == "")
                {
                    throw new Exception("FAIL");
                }
            }
            // Wenn ein Fehler durch die Konfigurationsdatei verursacht wurde, beende den
            // dezeitigen Zustand
            catch (Exception) {
                KöTaf.WPFApplication.Helper.MessageBoxEnhanced.Error(IniParser.GetSetting("ERRORMSG", "configFileError"));
                this.Close();
                return;
            }
            this._DbLevel = _DbLevel;
            this.Topmost  = true;
            // Lese das aktuelle Datum aus XML Datei. Entscheide dann, ob ein Backup notwendig ist. (beim schließen des Programms)
            liste = _Timer.readXML(Environment.CurrentDirectory + @"\TimeStamp.xml", "backup", "date", "iswrite");
            if (liste[0] == DateTime.Now.ToShortDateString().ToString() && liste[1] == "True" && _DbLevel != "restore")
            {
                this._DbLevel = "backupExist";
            }
            switch (this._DbLevel)
            {
            case "backupExist":
                this.Close();
                break;

            default:
                startApplication();
                break;
            }
        }
예제 #11
0
        /// <summary>
        /// Eingaben speichern und in Buchungen umwandeln
        /// </summary>
        /// <param name="btn">Referenz zum sendendem Button</param>
        private void saveAmounts(Button btn)
        {
            // Standard Hintergrund definieren
            Brush bgNormal = QuickBookingDataGrid.Background;

            // Validiere Textboxen und hole gleichzeitig eine Liste von Models, die alle geparsten Beträge und zugehörige Kunden enthält
            List <QuickBookingDataGridModel> quickBookingDataGridModels;
            bool allTextBoxesValid = validateTextBoxAmount(out quickBookingDataGridModels);

            if (allTextBoxesValid)
            {
                // Hole Standardkonten für Kunden und für Einnahmen-Kasse aus der config.ini
                string srcAccountNumberStr = IniParser.GetSetting("ACCOUNTING", "defaultCustomerAccountNr");
                int    srcAccountID;
                bool   successSrcAccParse = getAccountIDfromAccountNumberStr(srcAccountNumberStr, out srcAccountID);

                string targetAccountNumberStr = IniParser.GetSetting("ACCOUNTING", "defaultCashBoxAccountNr");
                int    targetAccountID;
                bool   successTargetAccParse = getAccountIDfromAccountNumberStr(targetAccountNumberStr, out targetAccountID);

                // Wenn diese Einträge in der Konfigurationsdatei nicht korrekt sind, breche ab
                if (!(successSrcAccParse && successTargetAccParse))
                {
                    MessageBoxEnhanced.Error(IniParser.GetSetting("ERRORMSG", "quickBookingError"));
                    return;
                }

                bool success = true;

                // Ansonsten führe die Buchungen durch
                foreach (var model in quickBookingDataGridModels)
                {
                    success = newQuickBooking(model.person, model.parsedAmount, srcAccountID, targetAccountID);
                    if (!success)
                    {
                        break;
                    }
                }

                if (success)
                {
                    MessageBoxEnhanced.Info(IniParser.GetSetting("ACCOUNTING", "quickBookingSuccess"));
                    QuickBookingDataGrid.ItemsSource = null;
                    QuickBookingDataGrid.Items.Refresh();
                    cbGroup.SelectedItem = null;
                }
            }
            else
            {
                MessageBoxEnhanced.Error(IniParser.GetSetting("ERRORMSG", "quickBookingParsed"));
            }
        }
예제 #12
0
        /// <summary>
        /// Speichern-Button
        /// </summary>
        /// <param name="button"></param>
        private void pbSave_Click(Button button)
        {
            _Validator.clearSB();
            CheckForm();

            if (_IsValid == false)
            {
                MessageBox.Show(_Validator.getErrorMsg().ToString(), IniParser.GetSetting("ERRORMSG", "noTextField"), MessageBoxButton.OK, MessageBoxImage.Hand);
            }
            else
            {
                try
                {
                    var teamId              = this._CurrentTeamMember.TeamID;
                    var teamTitle           = cbTitle.SelectedItem as DataModel.Title;
                    var teamFunction        = cBFunction.SelectedItem as TeamFunction;
                    var dateOfBirth         = (DateTime)dpBirthday.SelectedDate;
                    var firstName           = txtFirstName.Text;
                    var lastName            = txtLastName.Text;
                    var street              = txtStreet.Text;
                    var zipCode             = int.Parse(txtZipCode.Text);
                    var city                = txtCity.Text;
                    var mobileNo            = txtMobileNo1.Text;
                    var phoneNo             = txtTelNo1.Text;
                    var email               = txtEMail1.Text;
                    var isFormletterAllowed = (bool)chBIsFormletterAllowed.IsChecked;

                    Team.Update(teamId, dateOfBirth, teamTitle.TitleID, teamFunction.TeamFunctionID, firstName, lastName, street,
                                zipCode, city, mobileNo, phoneNo, email, isFormletterAllowed);

                    if (cbIsActive.IsChecked == true)
                    {
                        Team.Activate(teamId);
                    }
                    else
                    {
                        Team.Deactivate(teamId);
                    }

                    KPage pageTeamAdministration = new KöTaf.WPFApplication.Views.pTeamAdministration(pagingStartValue);

                    SinglePage singlePage = new SinglePage(IniParser.GetSetting("APPSETTINGS", "teamAdministration"), pageTeamAdministration);
                }
                catch
                {
                    MessageBoxEnhanced.Error(IniParser.GetSetting("ERRORMSG", "common"));
                }
            }
            _Validator.clearSB();
        }
예제 #13
0
        private void Init()
        {
            try
            {
                this._Validator = new ValidationTools();
            }
            catch (Exception ex)
            {
                MessageBoxEnhanced.Error(ex.Message);
                return;
            }

            FillComboBoxes();
        }
예제 #14
0
        /// <summary>
        /// Notiz bearbeiten Klick Event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void EditNoteButton_Click(object sender, RoutedEventArgs e)
        {
            Note currentSelectedNote = NotesDatagrid.SelectedItem as Note;

            if (currentSelectedNote != null)
            {
                KPage      pageNoteAdmin = new KöTaf.WPFApplication.Views.pEditNote(currentSelectedNote);;
                SinglePage singlePage    = new SinglePage(IniParser.GetSetting("NOTES", "notes"), pageNoteAdmin);
            }
            else
            {
                MessageBoxEnhanced.Error(IniParser.GetSetting("ERRORMSG", "loadNote"));
            }
        }
예제 #15
0
 private void Init()
 {
     try
     {
         this._RevenuesValidator = new ValidationTools();
     }
     catch (Exception ex)
     {
         MessageBoxEnhanced.Error(ex.Message);
         return;
     }
     this._Revenues      = new List <RevenueModel>();
     this._ValidRevenues = new List <RevenueModel>();
 }
예제 #16
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"));
            }
        }
예제 #17
0
        /// <summary>
        /// Überprüft alle Felder auf Korrektheit, anschließend entweder Fehlerausgabe oder speichern der Daten
        /// Author: Antonios Fesenmeier
        /// </summary>
        /// <param name="button"></param>
        private void pbSave_Click(Button button)
        {
            _Validator.clearSB();
            // Wurde die Validierung positiv abgeschlossen müssen die Werte der einzelnen Felder in die Datenbank geschrieben werden!
            CheckForm();
            if (_IsValid == false)
            {
                MessageBox.Show(_Validator.getErrorMsg().ToString(), IniParser.GetSetting("ERRORMSG", "noTextField"), MessageBoxButton.OK, MessageBoxImage.Hand);
            }
            else
            {
                try
                {
                    var title               = cbTitle.SelectedItem as DataModel.Title;
                    var teamFunction        = cBFunction.SelectedItem as TeamFunction;
                    var firstName           = txtFirstName.Text;
                    var lastName            = txtLastName.Text;
                    var street              = txtStreet.Text;
                    var zipCode             = int.Parse(txtZipCode.Text);
                    var city                = txtCity.Text;
                    var dateOfBirth         = (DateTime)dpBirthday.SelectedDate;
                    var mobileNo            = txtMobileNo1.Text;
                    var phoneNo             = txtTelNo1.Text;
                    var email               = txtEMail1.Text;
                    var isFormLetterAllowed = (bool)chBIsFormletterAllowed.IsChecked;

                    var teamId = Team.Add(title.TitleID, teamFunction.TeamFunctionID, firstName, lastName, street, zipCode, city,
                                          dateOfBirth, mobileNo, phoneNo, email, isFormLetterAllowed);

                    if (teamId > 0)
                    {
                        KPage pageTeamAdministration = new KöTaf.WPFApplication.Views.pTeamAdministration();

                        SinglePage singlePage = new SinglePage(IniParser.GetSetting("APPSETTINGS", "teamAdministration"), pageTeamAdministration);
                    }
                    else
                    {
                        MessageBoxEnhanced.Error(IniParser.GetSetting("ERRORMSG", "saveDataRecord"));
                    }
                }
                catch
                {
                    MessageBoxEnhanced.Error(IniParser.GetSetting("ERRORMSG", "common"));
                }
            }
            _Validator.clearSB();
        }
예제 #18
0
        /// <summary>
        /// Buchung speichern
        /// </summary>
        /// <param name="button">sendender Button</param>
        private void Speichern_Click(Button button)
        {
            this.validator.clearSB();
            this.checkForm();

            if (!this.isValid)
            {
                MessageBox.Show(this.validator.getErrorMsg().ToString(), IniParser.GetSetting("ERRORMSG", "noTextField"), MessageBoxButton.OK);
                this.validator.clearSB();
            }
            else
            {
                try
                {
                    ComboBox cbSoll       = cbSourceAccount as ComboBox;
                    Account  accSoll      = cbSoll.SelectedItem as Account;
                    int      srcAccountID = accSoll.AccountID;

                    ComboBox cbHaben         = cbTargetAccount as ComboBox;
                    Account  accHaben        = cbHaben.SelectedItem as Account;
                    int      targetAccountID = accHaben.AccountID;

                    double amount;
                    bool   parsed = Double.TryParse(tbAmount.Text.Replace(".", ","), out amount);

                    string description = tbDescription.Text;

                    int bookingId = Booking.Add(srcAccountID, targetAccountID, amount, null, UserSession.userAccountID, description);

                    if (bookingId < 0)
                    {
                        throw new Exception();
                    }
                }
                catch
                {
                    MessageBoxEnhanced.Error(IniParser.GetSetting("ERRORMSG", "newBooking"));
                    this.validator.clearSB();
                    return;
                }

                MainWindow mainWindow = Application.Current.MainWindow as MainWindow;
                Type       pageType   = typeof(pBookings);
                mainWindow.switchPage(IniParser.GetSetting("ACCOUNTING", "bookings"), pageType);
            }
            this.validator.clearSB();
        }
예제 #19
0
        private void Init()
        {
            try
            {
                _Validator = new ValidationTools();
            }
            catch (Exception ex)
            {
                MessageBoxEnhanced.Error(ex.Message);
                return;
            }


            this.DataContext = _CurrentTeamMember;

            FillComboBoxes();
        }
예제 #20
0
        private void Init()
        {
            this.deletedChilds = new List <int>();

            try
            {
                this._PartnerChildValidator = new ValidationTools();
            }
            catch (Exception ex)
            {
                MessageBoxEnhanced.Error(ex.Message);
                return;
            }
            this._Childs      = new List <ChildModel>();
            this._ValidChilds = new List <ChildModel>();
            this.DataContext  = _currentPerson;
        }
예제 #21
0
        /// <summary>
        /// Drucken
        /// </summary>
        /// <param name="button">Referenz zu sendenem Button</param>
        public void pbListPrint_Click(Button button)
        {
            if (!LibreOffice.isLibreOfficeInstalled())
            {
                string warning = IniParser.GetSetting("ERRORMSG", "libre");
                MessageBoxEnhanced.Error(warning);
                return;
            }
            DataGrid allPrintData = new DataGrid();

            try
            {
                KöTaf.Utils.Printer.PrintModul pM = new Utils.Printer.PrintModul(PrintType.Client, allPrintData.ItemsSource);
            }
            catch
            {
            }
        }
예제 #22
0
        private void pbEdit_Click(object sender, RoutedEventArgs e)
        {
            //Setzt den Rücksprungwert für das Paging
            pagingStartValue = _DataGridPaging.getStartOfDataGridItems();

            Sponsor sponsor = this.dGSponsorView.SelectedItem as Sponsor;

            if (sponsor != null)
            {
                KPage pageEditSponsor = new KöTaf.WPFApplication.Views.pEditSponsor(sponsor, pagingStartValue);

                SinglePage singlePage = new SinglePage("Sponsor bearbeiten", pageEditSponsor);
            }
            else
            {
                MessageBoxEnhanced.Error("Es ist ein Fehler beim Laden des aktuellen Sponsors aufgetreten");
            }
        }
예제 #23
0
        /// <summary>
        /// Überprüft das Datum, wenn das Feld den Focus verliert
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dpBirthday_LostFocus(object sender, RoutedEventArgs e)
        {
            try
            {
                DateTime date = dpBirthday.SelectedDate.GetValueOrDefault(System.DateTime.Today);
                TimeSpan ts   = System.DateTime.Now.Subtract(date);

                if (date > System.DateTime.Now || ts.TotalDays >= (365 * 120))
                {
                    MessageBox.Show(IniParser.GetSetting("TEAM", "birthdateError"), IniParser.GetSetting("TEAM", "dateError"), MessageBoxButton.OK, MessageBoxImage.Error);
                    dpBirthday.SelectedDate = System.DateTime.Now;
                }
            }
            catch
            {
                MessageBoxEnhanced.Error(IniParser.GetSetting("ERRORMSG", "common"));
            }
        }
예제 #24
0
        private void dpBirthday_SelectedDateChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                DateTime date = dpBirthday.SelectedDate.GetValueOrDefault(System.DateTime.Today);
                TimeSpan ts   = System.DateTime.Now.Subtract(date);

                if (date > System.DateTime.Now || ts.TotalDays >= (365 * 120))
                {
                    MessageBox.Show("Bitte geben Sie ein korrektes Geburtsdatum an!", "Fehlerhaftes Datum", MessageBoxButton.OK, MessageBoxImage.Error);
                    dpBirthday.SelectedDate = System.DateTime.Now;
                }
            }
            catch
            {
                MessageBoxEnhanced.Error(IniParser.GetSetting("ERRORMSG", "common"));
            }
        }
예제 #25
0
        private void Init()
        {
            try
            {
                this._PartnerChildValidator = new ValidationTools();
            }
            catch (Exception ex)
            {
                MessageBoxEnhanced.Error(ex.Message);
                return;
            }
            this._Childs      = new List <ChildModel>();
            this._ValidChilds = new List <ChildModel>();
            personLastName    = "";

            // Title ComboBox
            cbTitle1.ItemsSource = DB.Title.GetTitles();
        }
예제 #26
0
        private void pbPrint_Click(Button button)
        {
            if (!LibreOffice.isLibreOfficeInstalled())
            {
                string warning = IniParser.GetSetting("ERRORMSG", "libre");
                MessageBoxEnhanced.Error(warning);
                return;
            }
            DataGrid allPrintData = new DataGrid();

            allPrintData.ItemsSource = _DataGridPaging.getItems();
            try
            {
                KöTaf.Utils.Printer.PrintModul pM = new Utils.Printer.PrintModul(PrintType.Sponsor, allPrintData.ItemsSource);
            }catch (Exception ex) {
                MessageBoxEnhanced.Error(ex.Message);
                return;
            }
        }
예제 #27
0
        /// <summary>
        /// Button zum Bearbeiten eines Teammitgliedes
        /// /// Author: Georg Schmid
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void pbEdit_Click(object sender, RoutedEventArgs e)
        {
            //Setzt den Rücksprungwert für das Paging
            pagingStartValue = _DataGridPaging.getStartOfDataGridItems();

            Team team = dGTeamView.SelectedItem as Team;

            if (team != null)
            {
                //_PageTools.ChangePage(new pEditTeamMember(team));
                KPage pageEditTeamMember = new KöTaf.WPFApplication.Views.pEditTeamMember(team, pagingStartValue);

                SinglePage singlePage = new SinglePage(IniParser.GetSetting("TEAM", "editSponsor"), pageEditTeamMember);
            }
            else
            {
                MessageBoxEnhanced.Error(IniParser.GetSetting("ERRORMSG", "loadTeamMember"));
            }
        }
예제 #28
0
        /// <summary>
        /// Öffnet das Formular zum Bearbeiten eines Benutzerkontos
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void pbEdit_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                UserAccount currentUserAccount = UserDataGrid.SelectedItem as UserAccount;

                if (currentUserAccount == null)
                {
                    throw new Exception(IniParser.GetSetting("ERRORMSG", "loadUserAccount"));
                }

                MainWindow mainWindow = Application.Current.MainWindow as MainWindow;
                Type       pageType   = typeof(pEditUser);
                mainWindow.switchPage(IniParser.GetSetting("USER", "editUser"), pageType, currentUserAccount);
            }
            catch (Exception ex)
            {
                MessageBoxEnhanced.Error(ex.Message);
            }
        }
예제 #29
0
        /// <summary>
        /// Wird aufgerufen wenn auf "Drucken"-Button geklickt wurde.
        /// </summary>
        private void bPrint_Click(object sender, RoutedEventArgs e)
        {
            if (!LibreOffice.isLibreOfficeInstalled())
            {
                string warning = IniParser.GetSetting("ERRORMSG", "libre");
                MessageBoxEnhanced.Error(warning);
                return;
            }

            var keyValueList = dGAnyStatistics.ToKeyValueList();

            try
            {
                KöTaf.Utils.Printer.PrintModul pM = new Utils.Printer.PrintModul(PrintType.Statistic, keyValueList);
            }
            catch (Exception ex) {
                MessageBoxEnhanced.Error(ex.Message);
                return;
            }
        }
예제 #30
0
        /// <summary>
        /// Nach Validierung der einzelnen Felder wird der Sponsor in der DB abgelegt
        /// Author: Anotnios Fesenmeier
        /// </summary>
        /// <param name="button"></param>
        private void pbSave_Click(Button button)
        {
            //  bool formLetter = false;
            _Validator.clearSB();
            // Wurde die Validierung positiv abgeschlossen müssen die Werte der einzelnen Felder in die Datenbank geschrieben werden!
            CheckForm();

            if (!this._IsValid)
            {
                MessageBoxEnhanced.Error(_Validator.getErrorMsg().ToString());
            }
            else
            {
                var fundingType         = cBFundingTyp.SelectedItem as FundingType;
                var title               = cbTitle.SelectedItem as Title;
                var isFormLetterAllowed = chBformLetter.IsChecked;
                var isCompany           = chBIsCompany.IsChecked;
                int _sponsorID;

                if (isCompany == true)
                {
                    _sponsorID = Sponsor.Add(fundingType.FundingTypeID, title.TitleID, txtFirstName.Text, txtLastName.Text, txtCity.Text, txtStreet.Text, Convert.ToInt32(txtZipCode.Text),
                                             isFormLetterAllowed.Value, txtCompanyName.Text, null, txtEMail.Text, txtFax.Text, txtMobileNo.Text, txtTelNo.Text, isCompany.Value);
                }
                else
                {
                    _sponsorID = Sponsor.Add(fundingType.FundingTypeID, title.TitleID, txtFirstName.Text, txtLastName.Text, txtCity.Text, txtStreet.Text, Convert.ToInt32(txtZipCode.Text),
                                             isFormLetterAllowed.Value, txtCompanyName.Text, null, txtEMail.Text, txtFax.Text, txtMobileNo.Text, txtTelNo.Text, isCompany.Value);
                }
                if (_sponsorID > 0)
                {
                    KPage      pageSponsorAdministration = new KöTaf.WPFApplication.Views.pSponsorAdministration();
                    SinglePage singlePage = new SinglePage("Sponsorverwaltung", pageSponsorAdministration);
                }
                else
                {
                    MessageBoxEnhanced.Error("Es ist ein Fehler beim speichern des Datensatzes aufgetreten");
                }
            }
            _Validator.clearSB();
        }