public RealEstateListViewModel(IRealEstateService <T> service, IMessageService messageService,
                                       IDistrictService districtService, IRealtorService realtorService,
                                       IOwnershipService ownershipService, IDealVariantService dealVariantService,
                                       IConditionService conditionService,
                                       IExcelService excelService, IWordService wordService, IServiceLocator serviceLocator)
        {
            _RealEstateService  = service;
            _MessageService     = messageService;
            _DistrictService    = districtService;
            _RealtorService     = realtorService;
            _OwnershipService   = ownershipService;
            _DealVariantService = dealVariantService;
            _ConditionService   = conditionService;
            _ServiceLocator     = serviceLocator;
            _excelService       = excelService;
            _wordService        = wordService;

            AddCommand                  = new DelegateCommand(Add);
            ChangeCommand               = new DelegateCommand(Change);
            DeleteCommand               = new DelegateCommand(Delete);
            UpdateCommand               = new DelegateCommand(Update);
            ClearFilterCommand          = new DelegateCommand(ClearFilter);
            ApplyFilterCommand          = new DelegateCommand(ApplyFilter);
            ExportToExcelCommand        = new DelegateCommand(ExportToExcel);
            ExportToWordCommand         = new DelegateCommand(ExportToWord);
            ExportToWordSelectedCommand = new DelegateCommand(ExportToWordSelected);

            ChangeInGridCommand = new DelegateCommand <RealEstateViewModel <T> >(ChangeInGrid);
            DeleteInGridCommand = new DelegateCommand <RealEstateViewModel <T> >(DeleteInGrid);

            SelectedEntities = new List <RealEstateViewModel <T> >();
        }
 public PlotEditViewModel(IPlotService service, IMessageService messageService,
                          IDistrictService districtService, IViewsService viewsService,
                          IRealtorService realtorService, IOwnershipService ownershipService,
                          IDealVariantService dealVariantService, IConditionService conditionalService)
     : base(service, messageService, districtService, realtorService, ownershipService, dealVariantService, conditionalService)
 {
     _ViewsService = viewsService;
 }
 public HouseListViewModel(IHouseService service, IMessageService messageService,
                           IDistrictService districtService, IRealtorService realtorService,
                           IOwnershipService ownershipService, IDealVariantService dealVariantService, IConditionService conditionService,
                           IExcelService excelService, IWordService wordService,
                           IServiceLocator serviceLocator)
     : base(service, messageService, districtService, realtorService, ownershipService, dealVariantService, conditionService, excelService,
            wordService, serviceLocator)
 {
 }
 public HouseEditViewModel(IHouseService service, IMessageService messageService,
                           IDistrictService districtService, IViewsService viewsService,
                           IRealtorService realtorService, IOwnershipService ownershipService,
                           IDealVariantService dealVariantService, IWaterSupplyService waterSupplyService,
                           ISewageService sewageService, IMaterialService materialService, IConditionService conditionalService)
     : base(service, messageService, districtService, realtorService, ownershipService, dealVariantService, conditionalService)
 {
     _ViewsService       = viewsService;
     _WaterSupplyService = waterSupplyService;
     _SewageService      = sewageService;
     _MaterialService    = materialService;
 }
 public RoomEditViewModel(IRoomService service, IMessageService messageService,
                          IDistrictService districtService, IViewsService viewsService,
                          IRealtorService realtorService, IOwnershipService ownershipService,
                          IDealVariantService dealVariantService,
                          ITerraceService terraceService, IMaterialService materialService,
                          ILayoutService layoutService, IFloorLevelService floorLevelService, IConditionService conditionalService)
     : base(service, messageService, districtService, realtorService, ownershipService, dealVariantService, conditionalService)
 {
     _ViewsService      = viewsService;
     _TerraceService    = terraceService;
     _MaterialService   = materialService;
     _LayoutService     = layoutService;
     _FloorLevelService = floorLevelService;
 }
Пример #6
0
        public RealtorDictionaryViewModel(IServiceLocator serviceLocator, IRealtorService dictionaryService,
                                          IMessageService messageService)
            : base(serviceLocator, messageService)
        {
            _DictionaryService = dictionaryService;

            PropertyChanged += (sender, args) =>
            {
                if (args.PropertyName == PropertySupport.ExtractPropertyName(() => Name))
                {
                    AddCommand.RaiseCanExecuteChanged();
                }
            };
            _DictionaryService.StartSession();
        }
 private void CreateServices()
 {
     dealVariantService = _serviceLocator.GetInstance <DealVariantService>();
     districtService    = _serviceLocator.GetInstance <IDistrictService>();
     floorLevelService  = _serviceLocator.GetInstance <IFloorLevelService>();
     layoutService      = _serviceLocator.GetInstance <ILayoutService>();
     materialService    = _serviceLocator.GetInstance <IMaterialService>();
     ownershipService   = _serviceLocator.GetInstance <IOwnershipService>();
     realtorService     = _serviceLocator.GetInstance <IRealtorService>();
     sewageService      = _serviceLocator.GetInstance <ISewageService>();
     streetService      = _serviceLocator.GetInstance <IStreetService>();
     terraceService     = _serviceLocator.GetInstance <ITerraceService>();
     toiletTypeService  = _serviceLocator.GetInstance <IToiletTypeService>();
     waterSupplyService = _serviceLocator.GetInstance <IWaterSupplyService>();
     flatService        = _serviceLocator.GetInstance <IFlatService>();
     houseService       = _serviceLocator.GetInstance <IHouseService>();
     plotService        = _serviceLocator.GetInstance <IPlotService>();
     residenceService   = _serviceLocator.GetInstance <IResidenceService>();
     roomService        = _serviceLocator.GetInstance <IRoomService>();
 }
        public RealEstateEditViewModel(IRealEstateService <T> service, IMessageService messageService,
                                       IDistrictService districtService, IRealtorService realtorService,
                                       IOwnershipService ownershipService, IDealVariantService dealVariantService, IConditionService conditionService)
        {
            _RealEstateService  = service;
            _MessageService     = messageService;
            _DistrictService    = districtService;
            _RealtorService     = realtorService;
            _OwnershipService   = ownershipService;
            _DealVariantService = dealVariantService;
            _ConditionService   = conditionService;
            PropertyChanged    += (sender, args) =>
            {
                OkCommand.RaiseCanExecuteChanged();
            };

            OkCommand = new DelegateCommand(() =>
            {
                var mode  = _Id == 0 ? EditEndedMode.Add : EditEndedMode.Edit;
                var error = Error;
                if (error == null)
                {
                    UpdateModelFromValues();
                    SaveToDatabase();
                    CloseDialog();
                    OnEditEnded(mode, DbEntity);
                }
                else
                {
                    _MessageService.ShowMessage(error, "Ошибка", image: MessageBoxImage.Error);
                }
            }, CanOk);

            CancelCommand = new DelegateCommand(() =>
            {
                UpdateValuesFromModel();
                CloseDialog();
                OnEditEnded(EditEndedMode.Cancel, null);
            }, CanCancel);
        }
 public RealtorViewModel(IRealtorService service)
 {
     _DictionaryService = service;
 }
Пример #10
0
        public void SetUp()
        {
            var listCitis = new City[]
            {
                new City()
                {
                    Id = 1, Name = "Киев"
                },
                new City()
                {
                    Id = 2, Name = "Черкассы"
                },
            };

            Mock <IReadOnlyRepository <City> > cityReadOnlyRepository = new Mock <IReadOnlyRepository <City> >();

            cityReadOnlyRepository.Setup(m => m.GetAll()).Returns(listCitis.AsQueryable());
            cityReadOnlyRepository.Setup(x => x.GetByIdAsync(It.IsAny <int>())).ReturnsAsync(
                (int id) =>
            {
                return(cityReadOnlyRepository.Object.GetAll().FirstOrDefault(x => x.Id == id));
            });


            Mock <IReadOnlyRepository <CityDistrict> > cityDistrictReadOnlyRepository = new Mock <IReadOnlyRepository <CityDistrict> >();
            var listCityDistrict = new List <CityDistrict>();
            var city_1           = cityReadOnlyRepository.Object.GetAll().FirstOrDefault(x => x.Name == "Киев");
            int cityDistrictId   = 1;

            if (city_1 != null)
            {
                listCityDistrict.Add(new CityDistrict()
                {
                    CityId = city_1.Id,
                    Name   = "Троещина",
                    Id     = cityDistrictId++
                });

                listCityDistrict.Add(new CityDistrict()
                {
                    CityId = city_1.Id,
                    Name   = "Шевченковский р-н",
                    Id     = cityDistrictId++
                });

                listCityDistrict.Add(new CityDistrict()
                {
                    CityId = city_1.Id,
                    Name   = "Голосеевский р-н",
                    Id     = cityDistrictId++
                });

                listCityDistrict.Add(new CityDistrict()
                {
                    CityId = city_1.Id,
                    Name   = "Днепровский р-н",
                    Id     = cityDistrictId++
                });
            }

            cityDistrictReadOnlyRepository.Setup(m => m.GetAll()).Returns(listCityDistrict.AsQueryable());
            cityDistrictReadOnlyRepository.Setup(x => x.GetByIdAsync(It.IsAny <int>())).ReturnsAsync(
                (int id) =>
            {
                return(cityDistrictReadOnlyRepository.Object.GetAll().FirstOrDefault(x => x.Id == id));
            });

            Mock <IReadOnlyRepository <Street> > streetReadOnlyRepository = new Mock <IReadOnlyRepository <Street> >();
            var listStreet = new List <Street>();

            var district_1 = cityDistrictReadOnlyRepository.Object.GetAll().FirstOrDefault(x => x.Name == "Шевченковский р-н");
            int streetId   = 1;

            if (district_1 != null)
            {
                listStreet.Add(new Street()
                {
                    CityDistrictId = district_1.Id,
                    Name           = "Чорновола ул.",
                    Id             = streetId++
                });

                listStreet.Add(new Street()
                {
                    CityDistrictId = district_1.Id,
                    Name           = "Саксаганского ул.",
                    Id             = streetId++
                });

                listStreet.Add(new Street()
                {
                    CityDistrictId = district_1.Id,
                    Name           = "Ружинская ул.",
                    Id             = streetId++
                });

                listStreet.Add(new Street()
                {
                    CityDistrictId = district_1.Id,
                    Name           = "Стеценко ул.",
                    Id             = streetId++
                });

                listStreet.Add(new Street()
                {
                    CityDistrictId = district_1.Id,
                    Name           = "Победы просп.",
                    Id             = streetId++
                });
            }

            var district_2 = cityDistrictReadOnlyRepository.Object.GetAll().FirstOrDefault(x => x.Name == "Днепровский р-н");

            if (district_2 != null)
            {
                listStreet.Add(new Street()
                {
                    CityDistrictId = district_2.Id,
                    Name           = "Жмаченко генерала ул.",
                    Id             = streetId++
                });

                listStreet.Add(new Street()
                {
                    CityDistrictId = district_2.Id,
                    Name           = "Строителей ул.",
                    Id             = streetId++
                });

                listStreet.Add(new Street()
                {
                    CityDistrictId = district_2.Id,
                    Name           = "Тампере ул.",
                    Id             = streetId++
                });
            }

            streetReadOnlyRepository.Setup(m => m.GetAll()).Returns(listStreet.AsQueryable());
            streetReadOnlyRepository.Setup(x => x.GetByIdAsync(It.IsAny <int>())).ReturnsAsync(
                (int id) =>
            {
                return(streetReadOnlyRepository.Object.GetAll().FirstOrDefault(x => x.Id == id));
            });


            Mock <IRepository <RealEstate> > realEstateRepository = new Mock <IRepository <RealEstate> >();
            var listRealEstate = new List <RealEstate>();

            var street_1     = streetReadOnlyRepository.Object.GetAll().FirstOrDefault(x => x.Name == "Чорновола ул.");
            int realEstateId = 1;

            if (street_1 != null)
            {
                listRealEstate.Add(new RealEstate()
                {
                    Building     = "33/30",
                    Appartment   = 24,
                    Floor        = 6,
                    Height       = 9,
                    Area         = 54,
                    Price        = 36.000M,
                    RoomNumber   = 2,
                    CreationDate = DateTime.Now,
                    Description  = "test",
                    IsSold       = false,
                    StreetId     = street_1.Id,
                    RealtorId    = "test",
                    Id           = realEstateId++
                });
                listRealEstate.Add(new RealEstate()
                {
                    Building     = "3",
                    Appartment   = 4,
                    Floor        = 2,
                    Height       = 19,
                    Area         = 154,
                    Price        = 56.000M,
                    RoomNumber   = 2,
                    CreationDate = DateTime.Now,
                    Description  = "test",
                    IsSold       = false,
                    StreetId     = street_1.Id,
                    RealtorId    = "test",
                    Id           = realEstateId++
                });
            }

            var street_2 = streetReadOnlyRepository.Object.GetAll().FirstOrDefault(x => x.Name == "Саксаганского ул.");

            if (street_2 != null)
            {
                listRealEstate.Add(new RealEstate()
                {
                    Building     = "33/30",
                    Appartment   = 24,
                    Floor        = 6,
                    Height       = 9,
                    Area         = 54,
                    Price        = 36.000M,
                    RoomNumber   = 2,
                    CreationDate = DateTime.Now,
                    Description  = "test",
                    IsSold       = false,
                    StreetId     = street_2.Id,
                    RealtorId    = "test",
                    Id           = realEstateId++
                });
                listRealEstate.Add(new RealEstate()
                {
                    Building     = "123",
                    Appartment   = 94,
                    Floor        = 12,
                    Height       = 19,
                    Area         = 154,
                    Price        = 516.000M,
                    RoomNumber   = 4,
                    CreationDate = DateTime.Now,
                    Description  = "test",
                    IsSold       = false,
                    StreetId     = street_2.Id,
                    RealtorId    = "test",
                    Id           = realEstateId++
                });
            }


            realEstateRepository.Setup(m => m.GetAll()).Returns(listRealEstate.AsQueryable());
            realEstateRepository.Setup(x => x.GetByIdAsync(It.IsAny <int>())).ReturnsAsync(
                (int id) =>
            {
                return(realEstateRepository.Object.GetAll().FirstOrDefault(x => x.Id == id));
            });

            var unitOfWork = new Mock <IUnitOfWork>();

            unitOfWork.Setup(x => x.Cities).Returns(cityReadOnlyRepository.Object);
            unitOfWork.Setup(x => x.CityDistricts).Returns(cityDistrictReadOnlyRepository.Object);
            unitOfWork.Setup(x => x.Streets).Returns(streetReadOnlyRepository.Object);
            unitOfWork.Setup(x => x.RealEstates).Returns(realEstateRepository.Object);


            _realtorService = new RealtorService(unitOfWork.Object, new MapperFactory(), new RealeEstateSort());
        }
Пример #11
0
 public RealtorController(IRealtorService realtorService, IIdentityService identityService, IMapperFactoryWEB mapperFactory)
 {
     _realtorService  = realtorService;
     _identityService = identityService;
     _mapper          = mapperFactory.CreateMapperWEB();
 }
 public ResidenceEditViewModel(IResidenceService residenceService, IMessageService messageService,
                               IDistrictService districtService, IViewsService viewsService, IRealtorService realtorService,
                               IOwnershipService ownershipService, IDealVariantService dealVariantService,
                               IMaterialService materialService, IConditionService conditionalService, IDestinationService destinationService)
     : base(residenceService, messageService, districtService, realtorService, ownershipService, dealVariantService, conditionalService)
 {
     _ViewsService       = viewsService;
     _MaterialService    = materialService;
     _DestinationService = destinationService;
 }