private void prepareDropdown()
        {
            Bibliothek.Projekt_Alle().ForEach(delegate(Projekt projekt)
            {
                ComboBox_ProjektBezeichnung.Items.Add(projekt.Name);
            });

            Bibliothek.Mitarbeiter_Alle().ForEach(delegate(Mitarbeiter mitarbeiter)
            {
                ComboBox_Mitarbeiter.Items.Add(mitarbeiter.Name + " " + mitarbeiter.Vorname);
            });
        }
示例#2
0
        public listEmployee()
        {
            InitializeComponent();
            List <Mitarbeiter> mitList = Bibliothek.Mitarbeiter_Alle();

            for (var i = 0; i < mitList.Count(); i++)
            {
                ListBoxItem mit = new ListBoxItem();
                mit.Tag               = mitList[i].ID;
                mit.Content           = mitList[i].Name;
                mit.Background        = Brushes.White;
                mit.MouseDoubleClick += this.lsEmployee_Handler;
                this.mitListBox.Items.Add(mit);
            }
        }
示例#3
0
        /// <summary>
        /// Diese Methode liest alle Mitarbeiter und schreibt Sie in eine ComboBox
        /// damit Einsätze an andere Personen weitergegeben werden können.
        /// </summary>
        private void setMitarbeiterBox()
        {
            List <String> mitarbeiterNamen = new List <string>();

            // Für jeden Mitarbeiter wird dessen kompletter Name in eine Liste gespeichert
            foreach (Mitarbeiter mitarbeiter in Bibliothek.Mitarbeiter_Alle())
            {
                mitarbeiterNamen.Add(mitarbeiter.Vorname + " " + mitarbeiter.Name);
            }
            // Dann wird diese Liste als Quelle für die ComboBox der Mitarbeiter angegeben
            this.mitarbeiter.ItemsSource = mitarbeiterNamen;
            // Wenn der Einsatz bereits existiert, wird der Mitarbeiter als Standart gesezt, der am Einsatz arbeitet.
            // Falls dies ein neuer Einsatz ist, wird einfach der erste Mitarbeiter als Standart gesezt.
            if (Neu)
            {
                this.mitarbeiter.SelectedIndex = 1;
            }
            else
            {
                this.mitarbeiter.SelectedIndex = einsatz.Mitarbeiter.ID - 1;
            }
        }
        public newJob()
        {
            InitializeComponent();

            if (Application.Current.Properties["job_edit_id"] == null) // not in edit mode
            {
                // Fill list of mitarbeiters
                var listMitarbeiter = Bibliothek.Mitarbeiter_Alle();
                for (var i = 0; i < listMitarbeiter.Count(); i++)
                {
                    ComboboxItem mitarbeiter = new ComboboxItem(); // Defined own combobox object (defined below) to save name & id
                    mitarbeiter.Text  = listMitarbeiter[i].Name;
                    mitarbeiter.Value = listMitarbeiter[i].ID;
                    jobMit.Items.Add(mitarbeiter);
                }
                jobMit.SelectedIndex = 0;

                // Fill list of projects
                var listProjekte = Bibliothek.Projekt_Alle();
                for (var i = 0; i < listProjekte.Count(); i++)
                {
                    ComboboxItem projekt = new ComboboxItem(); // Defined own combobox object (defined below) to save name & id
                    projekt.Text  = listProjekte[i].Name;
                    projekt.Value = listProjekte[i].ID;
                    jobProj.Items.Add(projekt);
                }
                jobProj.SelectedIndex = 0;
            }


            // Edit Employee auto fill form
            if (Application.Current.Properties["job_edit_id"] != null)
            {
                int     job_id;
                var     bool5 = Int32.TryParse(Application.Current.Properties["job_edit_id"].ToString(), out job_id);
                Einsatz job   = Bibliothek.Einsatz_nach_ID(job_id);
                this.jobName.Text = job.Name;

                // Fill list of mitarbeiters
                var listMit = Bibliothek.Mitarbeiter_Alle();
                var index1  = 0;
                for (var i = 0; i < listMit.Count(); i++)
                {
                    ComboboxItem mitarbeiter = new ComboboxItem(); // Defined own combobox object (defined below) to save name & id
                    mitarbeiter.Text  = listMit[i].Name;
                    mitarbeiter.Value = listMit[i].ID;
                    jobMit.Items.Add(mitarbeiter);
                    if (job.Mitarbeiter.ID == listMit[i].ID)
                    {
                        jobMit.SelectedIndex = index1;
                    }
                    else
                    {
                        index1 += 1;
                    }
                }


                // Fill list of projects
                var listProj = Bibliothek.Projekt_Alle();
                var index2   = 0;
                for (var i = 0; i < listProj.Count(); i++)
                {
                    ComboboxItem projekt = new ComboboxItem(); // Defined own combobox object (defined below) to save name & id
                    projekt.Text  = listProj[i].Name;
                    projekt.Value = listProj[i].ID;
                    jobProj.Items.Add(projekt);
                    if (job.Projekt.ID == listProj[i].ID)
                    {
                        jobProj.SelectedIndex = index2;
                    }
                    else
                    {
                        index2 += 1;
                    }
                }


                this.jobStart.SelectedDate = job.Start;
                this.jobEnd.SelectedDate   = job.Ende;

                this.jobSubmit.Tag = "edit";

                // Create hidden button to save employee id
                this.btnID.Tag = job_id.ToString();

                // Edit window opened and loaded.. reset trigger property
                Application.Current.Properties["job_edit_id"] = null;
            }
        }