/// <summary>
        /// Creates a new Projekt
        /// </summary>
        /// <param name="sender">The sending object</param>
        /// <param name="e">The event args</param>
        private void CreateProjekt(object sender, EventArgs e)
        {
            // hide label
            this.projektNeuMsgLabel.Text = string.Empty;
            this.projektNeuMsgLabel.Hide();

            // define Rules
            IRule lnhsv = new LettersNumbersHyphenSpaceValidator();
            IRule slv = new StringLength150Validator();

            ProjektTable projekt = new ProjektTable();

            // bind values
            projekt.Projektname = DataBindingFramework.BindFromString(this.projektNeuProjekttitelTextbox.Text, "Projekttitel", this.projektNeuMsgLabel, false, lnhsv, slv);

            if (lnhsv.HasErrors || slv.HasErrors)
            { this.projektNeuMsgLabel.Text = "Projektname ungültig!"; }

            // no Angebot chosen or first element chosen (which is empty) -> show error label
            if (this.projektErstellenAngebotCombobox.SelectedIndex <= 0)
            {
                this.projektNeuMsgLabel.Text += "\nKein Angebot ausgewählt";
                this.projektNeuMsgLabel.ForeColor = Color.Red;
                this.projektNeuMsgLabel.Show();
                return;
            }
            // Angebot chosen - get ID out of ComboBox
            else
            {
                string s_angebotID = this.projektErstellenAngebotCombobox.SelectedItem.ToString();
                s_angebotID = s_angebotID.Substring(0, s_angebotID.IndexOf(':'));

                IRule posint = new PositiveIntValidator();
                IRule datev = new DateValidator();

                projekt.AngebotID = DataBindingFramework.BindFromInt(s_angebotID, "AngebotID", this.projektNeuMsgLabel, false, posint);
                projekt.Projektstart = DataBindingFramework.BindFromString(this.projektNeuStartdatumDatepicker.Value.ToShortDateString(), "Startdatum", projektNeuMsgLabel, false, datev);

                // Check for errors while databinding
                if (this.projektNeuMsgLabel.Visible)
                {
                    this.logger.Log(Logger.Level.Error, projekt.AngebotID + " is an invalid Angebot ID or invalid date chosen or invalid project name.");
                    return;
                }

                // get Kunde table out of Database
                AngebotManager loader = new AngebotManager();
                List<AngebotTable> results = loader.Load(projekt.AngebotID, new DateTime(1900, 1, 1), new DateTime(2100, 1, 1), this.projektNeuMsgLabel, true);

                // there must be exactly one result, for ID is unique!
                if (results.Count != 1)
                {
                    this.logger.Log(Logger.Level.Error, "More than one Angebot returned - impossible, because ID is unique!");
                    this.projektNeuMsgLabel.Text = "Error: Datenbank inkonsistent!";
                    this.projektNeuMsgLabel.Visible = true;
                    return;
                }

                // everything went fine
                ProjektManager saver = new ProjektManager();

                try
                {
                    saver.Create(projekt);
                    //logger.Log(Logger.Level.Info, "uebergabe von projekttab: " + projekt.AngebotID+ " " + projekt.Projektstart);
                }
                catch (InvalidInputException ex)
                {
                    this.logger.Log(Logger.Level.Error, "Input was invalid, although checked." + ex.Message);
                }
                catch (DataBaseException ex)
                {
                    this.logger.Log(Logger.Level.Error, "Some serious problem with the database occured!" + ex.Message);
                }

                GlobalActions.ShowSuccessLabel(this.projektNeuMsgLabel);
            }
        }
        /// <summary>
        /// Gets all existing Projekte from the Database and adds them to the existingProjekteComboBox
        /// </summary>
        /// <param name="sender">The sender</param>
        /// <param name="e">The event args</param>
        public static void BindFromExistingProjekteToComboBox(object sender, EventArgs e)
        {
            // check sender for null
            if (sender == null)
            {
                return;
            }

            List<ProjektTable> results;

            // add empty element to make empty choices possible
            List<string> listItems = new List<string>();
            listItems.Add("");

            ProjektManager loader = new ProjektManager();

            // Load all existing Projekte to object result list
            results = loader.Load(-1, new DateTime(1900, 1, 1), new DateTime(2100, 1, 1), null);

            // if there are results, add them to string result list
            if (results.Count != 0)
            {
                foreach (ProjektTable projekt in results)
                {
                    string entry = projekt.ID + ": " + projekt.Projektname;
                    listItems.Add(entry);
                }
            }

            // set data source
            (sender as ComboBox).DataSource = listItems;
        }
        private void projektSuchenSearchButton_Click(object sender, EventArgs e)
        {
            logger.Log(Logger.Level.Info, "projekt search button pressed");

            // get selected KundenID
            // force searching for existing Kunden, if Kunde has not dropped down the ComboBox (would throw Exception otherwise)
            if (this.projektSuchenKundeCombobox.SelectedIndex < 0)
            {
                GlobalActions.BindFromExistingKundenToComboBox(this.projektSuchenKundeCombobox, null);
            }

            this.projektSuchenMessageLabel.Hide();

            string kundenID = this.projektSuchenKundeCombobox.SelectedItem.ToString();
            int id = -1;
            try
            {
                id = GlobalActions.GetIdFromCombobox(kundenID, projektSuchenMessageLabel);
                logger.Log(Logger.Level.Info, "kundenid in projekt search: " + id);
            }
            catch(InvalidInputException)
            {
                logger.Log(Logger.Level.Error, "Unknown Exception while getting ID from Projekte from AngeboteTab!");
            }
            //logger.Log(Logger.Level.Info, "KundenID:" +id);

            // get Angebot in SDS format: 6/1/2009
            DateTime from = this.projektSuchenVonDatepicker.Value;
            DateTime until = this.projektSuchenBisDatepicker.Value;

            ProjektManager manager = new ProjektManager();
            List<ProjektTable> results = new List<ProjektTable>();

            try
            {
                results = manager.Load(id, from, until, this.projektSuchenMessageLabel);
                logger.Log(Logger.Level.Info,"resultslength: "+results.Count);
            }
            catch (DataBaseException ex)
            {
                this.logger.Log(Logger.Level.Error, "A serious problem with the database has occured. Program will be exited. " + ex.Message + ex.StackTrace);
                Application.Exit();
            }

            this.projektSearchBindingSource.DataSource = results;
        }