Example #1
0
        public void InitCollections()
        {
            _requestService  = new RequestServiceImpl.RequestService(AppSettings.DbConnection);
            FilterStreetList = new ObservableCollection <FieldForFilterDto>();
            HouseList        = new ObservableCollection <HouseDto>();
            FlatList         = new ObservableCollection <FlatDto>();
            ServiceList      = new ObservableCollection <ServiceDto>();
            FilterMasterList = new ObservableCollection <FieldForFilterDto>(_requestService.GetMasters(null).Select(
                                                                                w => new FieldForFilterDto()
            {
                Id       = w.Id,
                Name     = $"{w.SurName} {w.FirstName} {w.PatrName}",
                Selected = false
            }).OrderBy(s => s.Name));

            FilterExecuterList = new ObservableCollection <FieldForFilterDto>(_requestService.GetExecuters(null).Select(
                                                                                  w => new FieldForFilterDto()
            {
                Id       = w.Id,
                Name     = $"{w.SurName} {w.FirstName} {w.PatrName}",
                Selected = false
            }).OrderBy(s => s.Name));

            FilterServiceCompanyList = new ObservableCollection <FieldForFilterDto>(_requestService.GetServiceCompanies().Select(
                                                                                        w => new FieldForFilterDto()
            {
                Id       = w.Id,
                Name     = w.Name,
                Selected = false
            }).OrderBy(s => s.Name));

            FilterStatusList = new ObservableCollection <FieldForFilterDto>(_requestService.GetRequestStatuses().Select(
                                                                                w => new FieldForFilterDto()
            {
                Id       = w.Id,
                Name     = w.Description,
                Selected = false
            }).OrderBy(s => s.Name));

            FilterUserList = new ObservableCollection <FieldForFilterDto>(_requestService.GetUsers().Select(
                                                                              w => new FieldForFilterDto()
            {
                Id       = w.Id,
                Name     = w.FullName,
                Selected = false
            }).OrderBy(s => s.Name));
            FilterRatingList = new ObservableCollection <FieldForFilterDto>(new [] { 1, 2, 3, 4, 5 }.Select(
                                                                                w => new FieldForFilterDto()
            {
                Id       = w,
                Name     = w.ToString(),
                Selected = false
            }).OrderBy(s => s.Name));
            FilterParentServiceList = new ObservableCollection <FieldForFilterDto>(_requestService.GetServices(null).Select(
                                                                                       w => new FieldForFilterDto()
            {
                Id       = w.Id,
                Name     = w.Name,
                Selected = false
            }).OrderBy(s => s.Name));
            foreach (var service in FilterParentServiceList)
            {
                service.PropertyChanged += ServiceOnPropertyChanged;
            }
            //foreach (var status in FilterStatusList)
            //{
            //    status.PropertyChanged += OnPropertyChanged;
            //}

            PaymentList = new ObservableCollection <PaymentDto>(new [] { new PaymentDto {
                                                                             Id = 0, Name = "Бесплатные"
                                                                         }, new PaymentDto {
                                                                             Id = 1, Name = "Платные"
                                                                         } });
            ChangeCity(_requestService.GetCities().FirstOrDefault().Id);
        }