예제 #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
        private void modifyCommand(object parameter)
        {
            if (string.IsNullOrEmpty(Firstname) || string.IsNullOrEmpty(Lastname))
            {
                return;
            }

            if (ModifyContent.ToLower() == "add")
            {
                modifyEntity();
                runTask(SQLFunctionType.Add);
            }
            else
            {
                if (dataModified() == false)
                {
                    return;
                }

                WindowMessageResult modifyResult = MessageBoxEnhanced.Show(
                    "Question...",
                    "You are about to modify a record in the database! Do you wish to continue?",
                    WindowMessageButtons.YesNo,
                    WindowMessageIcon.Question);

                if (modifyResult == WindowMessageResult.Yes)
                {
                    modifyEntity();
                    runTask(SQLFunctionType.Modify);
                }
            }
        }
예제 #4
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);
            }
        }
예제 #5
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();
        }
예제 #7
0
 public void getErrorMsg()
 {
     if (this._PersonIsValid == false)
     {
         MessageBoxEnhanced.Error(_PersonValidator.getErrorMsg().ToString());
         this._PersonValidator.clearSB();
     }
 }
예제 #8
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;
        }
예제 #9
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);
            }
        }
예제 #10
0
        /// <summary>
        /// Warnung bevor Fixkonto ausgewählt wird
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void chkbIsFixAccount_Checked(object sender, RoutedEventArgs e)
        {
            MessageBoxResult result = MessageBoxEnhanced.Warning(IniParser.GetSetting("ACCOUNTING", "warningCheckFixed"));

            if (result == MessageBoxResult.No)
            {
                chkbIsFixAccount.IsChecked = false;
            }
        }
예제 #11
0
 // Usage examples:
 // Windows like dialog:
 // NOTE: See the DialogData class above for more options. The method used below and even direct calling to open a dialog requires a window where the dialog will open.
 public static void ExampleOne(object parameter)
 {
     MessageBoxEnhanced.Show(
         parameter as Window,
         "Example...",
         "This is a sample message...",
         "The is the body of the dialog.",
         WindowMessageButtons.Ok,
         WindowMessageIcon.Information);
 }
예제 #12
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();
 }
예제 #13
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;
            }
        }
예제 #14
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"));
            }
        }
예제 #15
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);
                }
            }
        }
예제 #16
0
        private void deleteCommand(object parameter)
        {
            WindowMessageResult deleteResult = MessageBoxEnhanced.Show(
                "Question...",
                "You are about to delete a record from the database! Do you wish to continue?",
                WindowMessageButtons.YesNo,
                WindowMessageIcon.Question);

            if (deleteResult == WindowMessageResult.Yes)
            {
                runTask(SQLFunctionType.Delete);
            }
        }
예제 #17
0
        private void Init()
        {
            try
            {
                this._Validator = new ValidationTools();
            }
            catch (Exception ex)
            {
                MessageBoxEnhanced.Error(ex.Message);
                return;
            }

            FillComboBoxes();
        }
예제 #18
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>();
 }
예제 #19
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();
        }
예제 #20
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"));
            }
        }
예제 #21
0
        /// <summary>
        /// Löschen bestätigen
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnConfirm_Click(object sender, RoutedEventArgs e)
        {
            MessageBoxResult result = MessageBoxEnhanced.Warning(IniParser.GetSetting("FORMLETTER", "questionDelete"));

            if (result == MessageBoxResult.Yes)
            {
                FormletterPatternModelDB formletterPatternModel = new FormletterPatternModelDB(this.formletterPatternID);
                formletterPatternModel.deleteThisFormletterPattern();

                // Generiere wieder die Hauptseite der SB-Verwaltung
                MainWindow mainWindow = Application.Current.MainWindow as MainWindow;
                Type       pageType   = typeof(pFormletterAdministration);
                mainWindow.switchPage(IniParser.GetSetting("FORMLETTER", "formletterAdmin"), pageType);
            }
        }
예제 #22
0
        private void resetCommand(object parameter)
        {
            WindowMessageResult resetResult = MessageBoxEnhanced.Show(
                "Warning...",
                "You are about to reset the database!",
                "Any changes you have made to the current database will lost. Are you sue you wish to continue?",
                WindowMessageButtons.YesNo,
                WindowMessageIcon.Warning);

            if (resetResult == WindowMessageResult.Yes)
            {
                SQLConnection.Close();
                Statics.LoadResourceDatabase(true);
                CloseDialogWithResult(WindowMessageResult.Yes);
            }
        }
예제 #23
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();
        }
예제 #24
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"));
            }
        }
예제 #25
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();
        }
예제 #26
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;
        }
예제 #27
0
        // Opens Custom Windows style Dialog Window and setting the owner of that window to the passed in paramater. Optinal use since a dialog can be directly opened.
        public static WindowMessageResult OpenWindowsDialog(DialogData data, Window window)
        {
            WindowMessageResult result = WindowMessageResult.Undefined;

            if (Application.Current == null)
            {
                return(result);
            }

            // This will allow for use of this method from threads outside the UI thread.
            window.Dispatcher.Invoke((Action) delegate
            {
                result = MessageBoxEnhanced.OpenWindowMessage(data, window);
            });

            return(result);
        }
예제 #28
0
        private void Init()
        {
            try
            {
                _Validator = new ValidationTools();
            }
            catch (Exception ex)
            {
                MessageBoxEnhanced.Error(ex.Message);
                return;
            }


            this.DataContext = _CurrentTeamMember;

            FillComboBoxes();
        }
예제 #29
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;
        }
예제 #30
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");
            }
        }