Beispiel #1
0
        private void kd_delete_Click(object sender, RoutedEventArgs e)
        {
            Mitarbeiter foo = new Mitarbeiter(this.curr_id);

            foo.delete();
            this.refreshList();
        }
Beispiel #2
0
        public void refreshList()
        {
            this.listing.Items.Clear();

            Mitarbeiter f_neu = new Mitarbeiter();

            f_neu.vorname = " >>> NEUEN Mitarbeiter anlegen <<< ";
            this.listing.Items.Add(f_neu);

            ArrayList alleMitarbeiter = Mitarbeiter.getAll();

            foreach (Mitarbeiter f in alleMitarbeiter)
            {
                this.listing.Items.Add(f);
            }

            this.curr_id = 0;

            this.formular.Visibility = Visibility.Collapsed;
            this.listing.Visibility  = Visibility.Visible;
        }
Beispiel #3
0
        // Holt die Daten aus der Datenbank
        private void listing_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (this.listing.SelectedIndex >= 0)
            {
                this.curr_id = ((Mitarbeiter)this.listing.Items[this.listing.SelectedIndex]).id;

                this.listing.Visibility = Visibility.Collapsed;

                Mitarbeiter m = new Mitarbeiter(this.curr_id);

                // Blendet die Daten in den Textboxen ein
                this.vorname.Text  = m.vorname;
                this.nachname.Text = m.nachname;
                this.strasse.Text  = m.strasse;
                this.hsnr.Text     = m.hsnr;
                this.plz.Text      = m.plz;
                this.ort.Text      = m.ort;
                this.land.Text     = m.land;
                this.plz.Text      = m.plz;
                this.tel.Text      = m.tel;
                this.email.Text    = m.email;
                this.persnr.Text   = m.persnr;

                ArrayList allFirmen = Firma.getAll();
                // Combobox Auswahl
                this.f_firma.Items.Clear();

                foreach (Firma firm in allFirmen)
                {
                    this.f_firma.Items.Add(firm);

                    if (firm.id == m.firmen_id)
                    {
                        this.f_firma.SelectedIndex = this.f_firma.Items.Count - 1;
                    }
                }

                // Anrede und Funktion in Combobox holen

                if (m.anrede == 1)
                {
                    this.cbanrede.SelectedIndex = 0;
                }
                if (m.anrede == 2)
                {
                    this.cbanrede.SelectedIndex = 1;
                }
                if (m.anrede == 3)
                {
                    this.cbanrede.SelectedIndex = 2;
                }

                if (m.funktion == 1)
                {
                    this.cbfunktion.SelectedIndex = 0;
                }
                if (m.funktion == 2)
                {
                    this.cbfunktion.SelectedIndex = 1;
                }
                if (m.funktion == 3)
                {
                    this.cbfunktion.SelectedIndex = 2;
                }


                this.formular.Visibility = Visibility.Visible;
            }
        }
Beispiel #4
0
        private void f_save_it()
        {
            Mitarbeiter f = new Mitarbeiter(this.curr_id);

            f.vorname  = this.vorname.Text;
            f.nachname = this.nachname.Text;
            f.strasse  = this.strasse.Text;
            f.hsnr     = this.hsnr.Text;
            f.plz      = this.plz.Text;
            f.ort      = this.ort.Text;
            f.land     = this.land.Text;
            f.tel      = this.tel.Text;
            f.email    = this.email.Text;
            f.persnr   = this.persnr.Text;

            // Anrede Combobox in Int umwandeln

            int selIndex = this.f_firma.SelectedIndex;

            if (selIndex != -1)
            {
                f.firmen_id = ((Firma)(this.f_firma.Items[selIndex])).id;
            }

            int cobIndex = this.cbanrede.SelectedIndex;

            if (cobIndex != -1)
            {
                if (this.cbanrede.Text == "Herr")
                {
                    f.anrede = 1;
                }
                if (this.cbanrede.Text == "Frau")
                {
                    f.anrede = 2;
                }
                if (this.cbanrede.Text == "Mix")
                {
                    f.anrede = 3;
                }
            }

            int cobIndexFunk = this.cbfunktion.SelectedIndex;

            if (cobIndexFunk != -1)
            {
                if (this.cbfunktion.Text == "CEO")
                {
                    f.funktion = 1;
                }
                if (this.cbfunktion.Text == "COF")
                {
                    f.funktion = 2;
                }
                if (this.cbfunktion.Text == "Slave")
                {
                    f.funktion = 3;
                }
            }

            f.save();


            this.refreshList();
        }