private void ChangeCity(int?cityId)
 {
     foreach (var street in FilterStreetList)
     {
         street.PropertyChanged -= StreetOnPropertyChanged;
     }
     FilterStreetList.Clear();
     if (!cityId.HasValue)
     {
         return;
     }
     foreach (var street in _requestService.GetStreets(cityId.Value).OrderBy(s => s.Name).Select(w => new FieldForFilterDto()
     {
         Id = w.Id,
         Name = w.NameWithPrefix,
         Selected = false
     }))
     {
         FilterStreetList.Add(street);
     }
     foreach (var street in FilterStreetList)
     {
         street.PropertyChanged += StreetOnPropertyChanged;
     }
     OnPropertyChanged(nameof(FilterStreetList));
 }
예제 #2
0
        private void RefreshRequest()
        {
            if (_requestService == null)
            {
                _requestService = new RequestServiceImpl.RequestService(AppSettings.DbConnection);
            }
            RequestList.Clear();
            var requests = _requestService.GetRequestList(RequestNum, FilterByCreateDate, FromDate, ToDate,
                                                          ExecuteFromDate, ExecuteToDate,
                                                          FilterStreetList.Where(w => w.Selected).Select(x => x.Id).ToArray(),
                                                          _selectedHouse?.Id, SelectedFlat?.Id,
                                                          FilterParentServiceList.Where(w => w.Selected).Select(x => x.Id).ToArray(),
                                                          SelectedService?.Id,
                                                          FilterStatusList.Where(w => w.Selected).Select(x => x.Id).ToArray(),
                                                          FilterMasterList.Where(w => w.Selected).Select(x => x.Id).ToArray(),
                                                          FilterExecuterList.Where(w => w.Selected).Select(x => x.Id).ToArray(),
                                                          FilterServiceCompanyList.Where(w => w.Selected).Select(x => x.Id).ToArray(),
                                                          FilterUserList.Where(w => w.Selected).Select(x => x.Id).ToArray(),
                                                          FilterRatingList.Where(w => w.Selected).Select(x => x.Id).ToArray(),
                                                          SelectedPayment?.Id, ServiceCompanyBadWork, OnlyRetry, ClientPhone, OnlyGaranty, OnlyImmediate);

            foreach (var request in requests)
            {
                RequestList.Add(request);
            }
            RequestCount = RequestList.Count;
            OnPropertyChanged(nameof(RequestList));
        }
        private void RefreshRequest()
        {
            if (_requestService == null)
            {
                _requestService = new RequestService(AppSettings.DbConnection);
            }
            FondList.Clear();
            var fonds = _requestService.GetServiceCompanyFondList(
                FilterStreetList.Where(w => w.Selected).Select(x => x.Id).ToArray(),
                _selectedHouse?.Id, SelectedFlat?.Id);

            foreach (var address in fonds)
            {
                FondList.Add(address);
            }
        }
        private void StreetOnPropertyChanged(object sender, PropertyChangedEventArgs propertyChangedEventArgs)
        {
            var item = sender as FieldForFilterDto;

            if (item != null)
            {
                if (FilterStreetList.Count(f => f.Selected) == 1)
                {
                    ChangeStreet(FilterStreetList.FirstOrDefault(f => f.Selected)?.Id);
                }
                else
                {
                    ChangeStreet(null);
                }
            }
        }