Ejemplo n.º 1
0
        protected override async Task InitializeAsync()
        {
            try
            {
                IsLoading = true;
                Parameter = new List <int>();

                var departemnts = await _departmentApiService.GetAvailable();

                DepartmentList = new ObservableCollection <DepartmentDto>(departemnts);

                var employees = await _employeeApiService.GetAvailable();

                EmployeeList = new ObservableCollection <EmployeeDto>(employees);
            }
            catch (Exception e)
            {
                _loggingService.LogFatal("Error during initalization!", e);
                _dialogService.ShowError(e.Message);
            }
            finally
            {
                IsLoading = false;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializer
        /// </summary>
        /// <returns></returns>
        protected override async Task InitializeAsync()
        {
            try
            {
                IsLoading = true;
                //var employees = await _employeeApiService.GetAll();
                //if (employees != null)
                //{
                //    var result = employees.Select(employee => new EmployeeListItemViewModel(employee)).ToList();
                //    Employees = new ObservableCollection<EmployeeListItemViewModel>(result);
                //}
                //else
                //{
                //    Employees = new ObservableCollection<EmployeeListItemViewModel>();
                //}

                var departmentList = await _departmentApiService.GetAll();

                if (departmentList != null)
                {
                    Departments = new ObservableCollection <DepartmentDto>(departmentList);
                }
                else
                {
                    Departments = new ObservableCollection <DepartmentDto>();
                }

                var sectionList = await _sectionApiService.GetAll();

                if (sectionList != null)
                {
                    Sections = new ObservableCollection <SectionDto>(sectionList);
                }
                else
                {
                    Sections = new ObservableCollection <SectionDto>();
                }
            }
            catch (Exception e)
            {
                _loggingService.LogFatal("Error during Employee list initialization", e);
                _dialogService.ShowError(e.Message);
            }
            finally
            {
                IsLoading = false;
            }
        }
Ejemplo n.º 3
0
        protected async override Task InitializeAsync()
        {
            try
            {
                IsLoading = true;
                var departments = await _departmentApiService.GetAvailable();

                if (departments != null)
                {
                    Departments = new ObservableCollection <DepartmentDto>(departments);
                }
                else
                {
                    Departments = new ObservableCollection <DepartmentDto>();
                }

                var sections = await _sectionApiService.GetAvailable();

                if (sections != null)
                {
                    Sections = new ObservableCollection <SectionDto>(sections);
                }
                else
                {
                    Sections = new ObservableCollection <SectionDto>();
                }

                if (_navigationService.Parameter != null)
                {
                    if (_navigationService.Parameter is EmployeeDto param)
                    {
                        Employee.Value     = param.Copy();
                        SelectedDepartment = Employee.Value.Department;
                        RaisePropertyChanged(() => Employee);
                    }
                }
            }
            catch (Exception e)
            {
                _loggingService.LogFatal("Error during initialization of Employee list!", e);
                _dialogService.ShowError(e.Message);
            }
            finally
            {
                IsLoading = false;
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Async data loading during initialization
        /// </summary>
        /// <returns></returns>
        protected override async Task InitializeAsync()
        {
            try
            {
                IsLoading = true;
                var itemNatureList = await _itemNatureApiService.GetAll();

                ItemNatures = new ObservableCollection <ItemNatureDto>(itemNatureList);
            }
            catch (Exception e)
            {
                _loggingService.LogFatal("Error during Initialization!", e);
                _dialogService.ShowError(e.Message);
            }
            finally
            {
                IsLoading = false;
            }
        }
        /// <summary>
        /// Async data loading during initialization
        /// </summary>
        /// <returns></returns>
        protected override async Task InitializeAsync()
        {
            try
            {
                IsLoading = true;
                var floorList = await _floorApiService.GetAll();

                Floors = new ObservableCollection <FloorDto>(floorList);
                var departmentList = await _departmentApiService.GetAll();

                Departments = new ObservableCollection <DepartmentDto>(departmentList);
            }
            catch (Exception e)
            {
                _loggingService.LogFatal("Error during Initialization!", e);
                _dialogService.ShowError(e.Message);
            }
            finally
            {
                IsLoading = false;
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Initialization
        /// </summary>
        /// <returns></returns>
        protected override async Task InitializeAsync()
        {
            try
            {
                IsLoading = true;

                if (Parameter != null)
                {
                    SelectedBuildings   = new ObservableCollection <BuildingDto>(Parameter.Buildings);
                    SelectedDepartments = new ObservableCollection <DepartmentDto>(Parameter.Departments);
                    SelectedFloors      = new ObservableCollection <FloorDto>(Parameter.Floors);
                    SelectedItemNatures = new ObservableCollection <ItemNatureDto>(Parameter.ItemNatures);
                    SelectedItemStates  = new ObservableCollection <ItemStateDto>(Parameter.ItemStates);
                    SelectedItemTypes   = new ObservableCollection <ItemTypeDto>(Parameter.ItemTypes);
                    SelectedLocations   = new ObservableCollection <LocationDto>(Parameter.Locations);
                    SelectedSections    = new ObservableCollection <SectionDto>(Parameter.Sections);
                }
                else
                {
                    SelectedBuildings   = new ObservableCollection <BuildingDto>();
                    SelectedDepartments = new ObservableCollection <DepartmentDto>();
                    SelectedFloors      = new ObservableCollection <FloorDto>();
                    SelectedItemNatures = new ObservableCollection <ItemNatureDto>();
                    SelectedItemStates  = new ObservableCollection <ItemStateDto>();
                    SelectedItemTypes   = new ObservableCollection <ItemTypeDto>();
                    SelectedLocations   = new ObservableCollection <LocationDto>();
                    SelectedSections    = new ObservableCollection <SectionDto>();
                }

                var buildingList = await _buildingApiService.GetAll();

                var departmentList = await _departmentApiService.GetAll();

                var floorList = await _floorApiService.GetAll();

                var itemNatureList = await _itemNatureApiService.GetAll();

                var itemStateList = await _itemStateApiService.GetAll();

                var itemTypeList = await _itemTypeApiService.GetAll();

                var locationList = await _locationApiService.GetAll();

                var sectionList = await _sectionApiService.GetAll();

                if (buildingList != null)
                {
                    var buildings = buildingList.Where(building => SelectedBuildings.FirstOrDefault(building2 => building.Id == building2.Id) == null).ToList();
                    NotSelectedBuildings = new ObservableCollection <BuildingDto>(buildings);
                }
                if (departmentList != null)
                {
                    var departments = departmentList.Where(department => SelectedDepartments.FirstOrDefault(department2 => department.Id == department2.Id) == null).ToList();
                    NotSelectedDepartments = new ObservableCollection <DepartmentDto>(departments);
                }
                if (floorList != null)
                {
                    var floors = floorList.Where(floor => !SelectedFloors.Contains(floor)).ToList();
                    NotSelectedFloors = new ObservableCollection <FloorDto>(floors);
                }
                if (itemNatureList != null)
                {
                    var itemNatures = itemNatureList.Where(itemNature => SelectedItemNatures.FirstOrDefault(itemNature2 => itemNature.Id == itemNature2.Id) == null).ToList();
                    NotSelectedItemNatures = new ObservableCollection <ItemNatureDto>(itemNatures);
                }
                if (itemStateList != null)
                {
                    var itemStates = itemStateList.Where(itemState => SelectedItemStates.FirstOrDefault(itemState2 => itemState.Id == itemState2.Id) == null).ToList();
                    NotSelectedItemStates = new ObservableCollection <ItemStateDto>(itemStates);
                }
                if (itemTypeList != null)
                {
                    var itemTypes = itemTypeList.Where(itemType => SelectedItemTypes.FirstOrDefault(itemType2 => itemType.Id == itemType2.Id) == null).ToList();
                    NotSelectedItemTypes = new ObservableCollection <ItemTypeDto>(itemTypes);
                }
                if (locationList != null)
                {
                    var locations = locationList.Where(location => SelectedLocations.FirstOrDefault(location2 => location.Id == location2.Id) == null).ToList();
                    NotSelectedLocations = new ObservableCollection <LocationDto>(locations);
                }
                if (sectionList != null)
                {
                    var sections = sectionList.Where(section => SelectedSections.FirstOrDefault(section2 => section.Id == section2.Id) == null).ToList();
                    NotSelectedSections = new ObservableCollection <SectionDto>(sections);
                }
            }
            catch (Exception e)
            {
                _loggingService.LogFatal("Error during Initalization!", e);
                _dialogService.ShowError(e.Message);
            }
            finally
            {
                IsLoading = false;
            }
        }