예제 #1
0
        private void UpdateMastets()
        {
            var selectedMaster = SelectedMaster?.Id;

            MasterList.Clear();
            if (_showAllMasters)
            {
                foreach (var master in _requestService.GetMasters(null))
                {
                    MasterList.Add(master);
                }
                SelectedMaster = MasterList.FirstOrDefault(m => m.Id == selectedMaster);
            }
            else
            {
                if (_selectedHouseId.HasValue)
                {
                    foreach (var master in _requestService.GetWorkersByHouseAndService(_selectedHouseId.Value, SelectedParentService.Id))
                    {
                        MasterList.Add(master);
                    }
                    SelectedMaster = MasterList.FirstOrDefault();
                }
            }
        }
예제 #2
0
 public RequestItemViewModel()
 {
     _requestService       = new RequestServiceImpl.RequestService(AppSettings.DbConnection);
     ServiceList           = new ObservableCollection <ServiceDto>();
     MasterList            = new ObservableCollection <WorkerDto>(_requestService.GetMasters(null));
     ExecuterList          = new ObservableCollection <WorkerDto>(_requestService.GetExecuters(null));
     EquipmentList         = new ObservableCollection <EquipmentDto>(_requestService.GetEquipments());
     ParentServiceList     = new ObservableCollection <ServiceDto>(_requestService.GetServices(null));
     SelectedParentService = ParentServiceList.FirstOrDefault();
     PeriodList            = new ObservableCollection <PeriodDto>(_requestService.GetPeriods());
     SelectedPeriod        = PeriodList.FirstOrDefault();
     CompanyList           = new ObservableCollection <ServiceCompanyDto>(_requestService.GetServiceCompanies());
     SelectedCompany       = CompanyList.FirstOrDefault();
     Rating      = new RequestRatingDto();
     GarantyList = new ObservableCollection <GarantyDto>(new GarantyDto[] {
         new GarantyDto {
             Id = 0, Name = "Обычная"
         },
         new GarantyDto {
             Id = 1, Name = "Гарантия"
         },
         new GarantyDto {
             Id = 2, Name = "Возможно гарантия"
         },
     });
     SelectedGaranty = GarantyList.FirstOrDefault();
 }
예제 #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);
        }