예제 #1
0
 public Departament(Chief superior, string fullName)
 {
     FullName           = fullName;
     Superior           = superior;
     superior.WorkPlace = this;
     Children           = new ObservableCollection <IExplorable>();
 }
예제 #2
0
 public Institution(Chief superior, string name)
 {
     Superior           = superior;
     FullName           = name;
     Children           = new ObservableCollection <IExplorable>();
     superior.WorkPlace = this;
 }
예제 #3
0
        private void submitBtn_Click(object sender, RoutedEventArgs e)
        {
            if (!DateTime.TryParse(birthDateBox.Text, out DateTime date))
            {
                MessageBox.Show("Incorrext date format", "Error");
                Close();
                return;
            }
            Employee recruit;

            switch (positionComboBox.SelectedIndex)
            {
            case 0:
                recruit = new Chief(nameBox.Text, surnameBox.Text, lastNameBox.Text, DateTime.Parse(birthDateBox.Text));
                Organisation.AddChief(recruit as Chief);
                break;

            case 1:
                recruit = new Intern(nameBox.Text, surnameBox.Text, lastNameBox.Text, DateTime.Parse(birthDateBox.Text));
                if (selected is Departament)
                {
                    recruit.WorkPlace = selected;
                    (selected as Departament).Children.Add(recruit);
                }
                else
                {
                    MessageBox.Show("Интерн может быть добавлен только в депаратамент", "Ошибка");
                }
                break;

            case 2:
                recruit = new Employee(nameBox.Text, surnameBox.Text, lastNameBox.Text, DateTime.Parse(birthDateBox.Text));
                if (selected is Departament)
                {
                    recruit.WorkPlace = selected;
                    (selected as Departament).Children.Add(recruit);
                }
                else
                {
                    MessageBox.Show("Соотрудник может быть добавлен только в депаратамент", "Ошибка");
                }
                break;

            default:
                break;
            }
            Close();
            Main.Activate();
        }
예제 #4
0
 public void AddChief(Chief chief)
 {
     ChiefsList.Add(chief);
 }