private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            using (var logic = new NomenclaturesLogic())
            {
                this.department = logic.UN_Departments.GetById(this.id_selectedDepartment);

                if (this.id_structurePosition == 0)
                {
                    this.structurePosition               = new HR_StructurePositions();
                    this.structurePosition.IsActive      = true;
                    this.structurePosition.Code          = department.Code;
                    this.structurePosition.id_department = this.id_selectedDepartment;
                    this.structurePosition.ActiveFrom    = DateTime.Now;
                }
                else
                {
                    this.structurePosition = logic.HR_StructurePositions.GetById(this.id_structurePosition);
                }

                var comboBoxLogic = new ComboBoxLogic();
                this.cmbPosition.ItemsSource = comboBoxLogic.ReadGlobalPositions(this.structurePosition.id_globalPosition);
                if (this.structurePosition.id_globalPosition != 0)
                {
                    this.cmbPositionTypes.ItemsSource = comboBoxLogic.ReadPositionTypes(this.structurePosition.HR_GlobalPositions.id_positionType);
                }
                else
                {
                    this.cmbPositionTypes.ItemsSource = comboBoxLogic.ReadPositionTypes();
                }
            }
            this.DataContext = this.structurePosition;
        }
Exemplo n.º 2
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     using (var logic = new NomenclaturesLogic())
     {
         if (this.id_department == 0)
         {
             this.department            = new UN_Departments();
             this.department.IsActive   = true;
             this.department.ActiveFrom = DateTime.Now;
         }
         else
         {
             this.department = logic.UN_Departments.GetById(this.id_department);
         }
     }
     this.DataContext = this.department;
 }