public void InitCollections()
        {
            _requestService  = new RequestServiceImpl.RequestService(AppSettings.DbConnection);
            FilterStreetList = new ObservableCollection <FieldForFilterDto>();
            HouseList        = new ObservableCollection <HouseDto>();
            FlatList         = new ObservableCollection <FlatDto>();
            FondList         = new ObservableCollection <FondDto>();

            ChangeCity(_requestService.GetCities().FirstOrDefault().Id);
        }
Exemplo n.º 2
0
        public RequestDialogViewModel()
        {
            AlertExists     = false;
            _requestService = new RequestServiceImpl.RequestService(AppSettings.DbConnection);
            var contactInfo = new ContactDto {
                Id = 1, IsMain = true, PhoneNumber = AppSettings.LastIncomingCall
            };

            _callUniqueId   = _requestService.GetActiveCallUniqueId();
            StreetList      = new ObservableCollection <StreetDto>();
            HouseList       = new ObservableCollection <HouseDto>();
            FlatList        = new ObservableCollection <FlatDto>();
            AddressTypeList = new ObservableCollection <AddressTypeDto>(_requestService.GetAddressTypes());
            //if (AddressTypeList.Count > 0)
            //{
            //    SelectedAddressType = AddressTypeList.FirstOrDefault();
            //}
            CityList = new ObservableCollection <CityDto>(_requestService.GetCities());
            if (CityList.Count > 0)
            {
                SelectedCity = CityList.FirstOrDefault();
            }
            RequestList = new ObservableCollection <RequestItemViewModel> {
                new RequestItemViewModel()
            };
            //AppSettings.LastIncomingCall = "932";
            CanEditAddress = AppSettings.CurrentUser.Roles.Select(r => r.Name).Contains("admin");
            if (!string.IsNullOrEmpty(AppSettings.LastIncomingCall))
            {
                var clientInfoDto = _requestService.GetLastAddressByClientPhone(AppSettings.LastIncomingCall);
                if (clientInfoDto != null)
                {
                    SelectedStreet = StreetList.FirstOrDefault(s => s.Id == clientInfoDto.StreetId);
                    SelectedHouse  = HouseList.FirstOrDefault(h => h.Building == clientInfoDto.Building &&
                                                              h.Corpus == clientInfoDto.Corpus);
                    SelectedFlat = FlatList.FirstOrDefault(f => f.Flat == clientInfoDto.Flat);
                    contactInfo  = new ContactDto {
                        Id = 1, IsMain = true, PhoneNumber = AppSettings.LastIncomingCall, Name = clientInfoDto.Name
                    };
                }
            }
            ContactList = new ObservableCollection <ContactDto>(new[] { contactInfo });
        }
Exemplo n.º 3
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);
        }