コード例 #1
0
        public UpdateViewModel()
        {
            UpdataOrg = new RelayCommand(UpdateOrganization);
            Clean     = new RelayCommand(Clear);
            SelectOrg = new RelayCommand(SelectForUpdate);
            DelOrg    = new RelayCommand(DeleteOrg);

            updateModel = new UpdateOrgModel();
            upsateRepo  = new UpdateRepository();

            _countryRepository = new CountryRepository();                            //создаем экземпляр класса CountryRepository, который унаследован от интрефейса ICountryRepository
            List <CountryModel> countries = _countryRepository.GetCountries();       // создаем список объектов с типом CountryModel при помощи метода обязательного (Интрерфес) методом GetCountries из репы
            var countryVM = CountryMapper.CountryModelToCountryViewModel(countries); // при помощи статического метода CountryModelToCountryViewModel из класса CountryMapper приводим тип из Модели во Вью модель, чтобы наша вью модель могла работать с данными

            _sectionRepository = new SectionRepository();
            List <SectionModel> sections = _sectionRepository.GetSections();
            var sectionVM = SectionMappers.SectionModelToSectionViewModel(sections);

            Countries = countryVM;
            Section   = sectionVM;

            Person = new UpdatePersViewModel(countryVM)
            {
            };

            Organization = new UpdateOrgViewModel(countryVM, sectionVM)
            {
                CreateDateOrg = new DateTime()
            };
        }
コード例 #2
0
 public ActionResult <CountryInApi> PostCountry(int continentId, [FromBody] CountryInApi countryInApi)
 {
     logger.LogInformation($"Post api/continent/{continentId}/country/ called");
     try
     {
         Domain.Models.Country country        = CountryMapper.CountryInMapper(continentManager, countryInApi);
         Domain.Models.Country countryCreated = countryManager.AddCountry(country);
         if (countryCreated != null)
         {
             CountryOutApi countryOut = CountryMapper.CountryOutMapper(hostUrl, countryCreated);
             return(CreatedAtAction(nameof(GetCountry), new
             {
                 continentId = countryCreated.Continent.Id,
                 countryId = countryCreated.Id
             }, countryOut));
         }
         else
         {
             logger.LogError("Country can not be null.");
             return(NotFound("Country can not be null."));
         }
     }
     catch (Exception ex)
     {
         logger.LogError(ex.Message);
         return(NotFound(ex.Message));
     }
 }
コード例 #3
0
        public Country GetCountryByName([FromODataUri] string name)
        {
            var mapper  = new CountryMapper();
            var country = mapper.FromEntity(DbQuery().FirstOrDefault(x => x.Name.Equals(name)));

            return(country);
        }
        public void Arrange()
        {
            _geocodeService   = new Mock <IGeocodeService>();
            _mappingService   = new Mock <IMappingService>();
            _vacanciesApi     = new Mock <ILivevacanciesAPI>();
            _standardsService = new Mock <IStandardsRepository>();
            _vacanciesMapper  = new VacanciesMapper();
            _logger           = new Mock <ILogger <VacanciesRepository> >();
            _countryMapper    = new CountryMapper();

            _standards = new List <int>()
            {
                1, 2
            };


            _standardIds = string.Join(',', _standards);

            _geocodeService.Setup(s => s.GetFromPostCode(It.IsAny <string>())).ReturnsAsync(coordinatesResponse);


            _vacanciesApi.Setup(s => s.SearchApprenticeshipVacanciesByLocationAsync(It.IsAny <double>(), It.IsAny <double>(),
                                                                                    It.IsAny <int>(), It.IsAny <int>(), It.IsAny <int>(), It.IsAny <string>())).ReturnsAsync(GetSearchResults.MockSearchResults(coordinatesResponse));

            _standardsService.Setup(s => s.GetByRoute(routeId)).ReturnsAsync(_standards);

            sut = new VacanciesRepository(_vacanciesApi.Object, _vacanciesMapper, _geocodeService.Object, _mappingService.Object, _logger.Object, _countryMapper, _standardsService.Object);
        }
コード例 #5
0
        public IEnumerable <Country> GetAllCountries()
        {
            var listEntityCountry = _countryService.GetAllCountries();
            IEnumerable <Country> modelCountryList = CountryMapper.ConvertCountryEntityToModel(listEntityCountry);

            return(modelCountryList);
        }
コード例 #6
0
ファイル: Edit.aspx.cs プロジェクト: apkalexei/HRMS
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.QueryString["CountryId"] != null)
     {
         if (!IsPostBack)
         {
             CountryEntity entity = new CountryMapper().Get(new CountryEntity()
             {
                 Id = Convert.ToInt32(Request.QueryString["CountryId"])
             });
             if (entity != null)
             {
                 TitleTextBox.Text     = entity.Title;
                 OtherInfoTextBox.Text = entity.Description;
             }
             else
             {
                 Response.Redirect("List.aspx");
             }
         }
     }
     else
     {
         Response.Redirect("List.aspx");
     }
 }
コード例 #7
0
        public IActionResult Index()
        {
            var response = _bCSDirectoryService.GetCountry();

            @ViewBag.Countries = CountryMapper.Convert(response);
            return(View());
        }
コード例 #8
0
        public SearchWievModelOrg()
        {
            _searchRepository = new SearchRepository();

            _countryRepository = new CountryRepository();                        //создаем экземпляр класса CountryRepository, который унаследован от интрефейса ICountryRepository
            List <CountryModel> countries = _countryRepository.GetCountries();   // создаем список объектов с типом CountryModel при помощи метода обязательного (Интрерфес) методом GetCountries из репы

            Countries = CountryMapper.CountryModelToCountryViewModel(countries); // при помощи статического метода CountryModelToCountryViewModel из класса CountryMapper приводим тип из Модели во Вью модель, чтобы наша вью модель могла работать с данными

            _sectionRepository = new SectionRepository();
            List <SectionModel> sections = _sectionRepository.GetSections();

            Section = SectionMappers.SectionModelToSectionViewModel(sections);

            CreatedateOrgSTART = new DateTime(1980, 01, 01);
            CreatedateOrgFINAL = DateTime.Now;

            CheckDateOrgSTART = DateTime.Today;
            CheckDateOrgFINAL = DateTime.Today.AddDays(1);

            CheckDateOrg = DateTime.Now;

            RiscLevelLess = 83;
            RiscLevelMore = 0;

            /*  SearchCommand = new RelayCommand(Search, CanSearch);*/
        }
コード例 #9
0
        public SearchWievModelPers()
        {
            _countryRepository = new CountryRepository();                        //создаем экземпляр класса CountryRepository, который унаследован от интрефейса ICountryRepository
            List <CountryModel> countries = _countryRepository.GetCountries();   // создаем список объектов с типом CountryModel при помощи метода обязательного (Интрерфес) методом GetCountries из репы

            Countries = CountryMapper.CountryModelToCountryViewModel(countries); // при помощи статического метода CountryModelToCountryViewModel из класса CountryMapper приводим тип из Модели во Вью модель, чтобы наша вью модель могла работать с данными
        }
コード例 #10
0
 /// <summary>
 /// Given certain conditions.
 /// </summary>
 protected override void Given()
 {
     input = new Country {
         Name = "Germany"
     };
     classUnderTest = new CountryMapper();
 }
コード例 #11
0
        public List <CountryViewModel> GetCountries(string columnName, string searchString)
        {
            List <Country> entities;

            switch (columnName.ToLower())
            {
            case "name":
                entities = _repository.GetByCountryName(searchString);
                break;

            case "path":
                entities = _repository.GetByCountryPath(searchString);
                break;

            default:
                entities = _repository.GetAll();
                break;
            }

            if (entities == null)
            {
                throw new Exception(LOCALIZATION_COUNTRY_NOT_FOUND);
            }

            return(CountryMapper.MapToCountryViewModel(entities));
        }
コード例 #12
0
 public IActionResult PutCountry(int continentId, int countryId, [FromBody] CountryInApi countryInApi)
 {
     logger.LogInformation($"Post api/continent/{continentId}/country/{countryId} called");
     if (countryInApi == null)
     {
         return(BadRequest());
     }
     try
     {
         if (countryManager.Find(countryId) == null)
         {
             Domain.Models.Country country        = CountryMapper.CountryInMapper(continentManager, countryInApi);
             Domain.Models.Country countryCreated = countryManager.AddCountry(country);
             CountryOutApi         countryOut     = CountryMapper.CountryOutMapper(hostUrl, countryCreated);
             return(CreatedAtAction(nameof(GetCountry), new { continentId = countryCreated.Continent.Id, countryId = countryCreated.Id }, countryOut));
         }
         Domain.Models.Country countryUpdate = CountryMapper.CountryInMapper(continentManager, countryInApi);
         countryManager.UpdateCountry(countryId, countryUpdate, countryUpdate.Continent.Id);
         return(new NoContentResult());
     }
     catch (Exception ex)
     {
         logger.LogError(ex.Message);
         return(BadRequest(ex.Message));
     }
 }
コード例 #13
0
        private IQueryable <Country> Query()
        {
            var mapper   = new CountryMapper();
            var coutries = from c in DbQuery()
                           select mapper.FromEntity(c);

            return(coutries.AsQueryable());
        }
コード例 #14
0
        public async Task <IReadOnlyCollection <Country> > GetAllCountries()
        {
            var request = new RestRequest("all", Method.GET);

            var countryDtos = await this.PerformRequest <IReadOnlyCollection <CountryDto> >(request);

            return(CountryMapper.Map(countryDtos));
        }
コード例 #15
0
        public SingleResult <Country> Get([FromODataUri] int key)
        {
            var mapper  = new CountryMapper();
            var country = from c in DbQuery().Where(x => x.Id.Equals(key))
                          select mapper.FromEntity(c);

            return(SingleResult.Create(country));
        }
コード例 #16
0
        public NewOrganizationViewModel()
        {
            _newOrgrepo = new NewOrganizationRepository();

            _countryRepository = new CountryRepository();                            //создаем экземпляр класса CountryRepository, который унаследован от интрефейса ICountryRepository
            List <CountryModel> countries = _countryRepository.GetCountries();       // создаем список объектов с типом CountryModel при помощи метода обязательного (Интрерфес) методом GetCountries из репы
            var countryVM = CountryMapper.CountryModelToCountryViewModel(countries); // при помощи статического метода CountryModelToCountryViewModel из класса CountryMapper приводим тип из Модели во Вью модель, чтобы наша вью модель могла работать с данными

            _sectionRepository = new SectionRepository();
            List <SectionModel> sections = _sectionRepository.GetSections();
            var sectionVM = SectionMappers.SectionModelToSectionViewModel(sections);

            _riskListRepository = new RiskRepository();

            var risks = _riskListRepository.GetRisks();

            //ValueChanged - обработчик событий. В калькуляторе у нас есть событие, которое вызывается при смене значения в калькуляторе(при добавлении и удаоении значений)
            /// мы подписываемся на изменение ValueChanged
            RiskCalculator.ValueChanged += RiskCalculatorValueChanged;

            Person1 = new PersonViewModel(countryVM)
            {
                PrevLiquidated  = new NegativeRiskCheckBoxViewModel(risks.PrevLiquidated),
                PrevBankruptcy  = new NegativeRiskCheckBoxViewModel(risks.PrevBankruptcy),
                PrevExecuteProc = new NegativeRiskCheckBoxViewModel(risks.PrevExecuteProc),
                PrevStateDebt   = new NegativeRiskCheckBoxViewModel(risks.PrevStateDebt),
                PrevTaxDebt     = new NegativeRiskCheckBoxViewModel(risks.PrevTaxDebt),
                NegativDataPers = new NegativeRiskCheckBoxViewModel(risks.NegativData)
            };

            Organization = new OrganizationViewModel(countryVM, sectionVM)
            {
                BrokerClient     = new PositiveRiskCheckBoxViewModel(risks.BrokerClient),
                PrevBrokerClient = new PositiveRiskCheckBoxViewModel(risks.PrevBrokerClient),
                Manufacturer     = new PositiveRiskCheckBoxViewModel(risks.Manufacturer),
                Reputation       = new PositiveRiskCheckBoxViewModel(risks.Reputation),
                OwnershipOrg     = new PositiveRiskCheckBoxViewModel(risks.OwnershipOrg),

                TaxDebt = new NegativeRiskCheckBoxViewModel(risks.TaxDebt),
                DebtsEnforcementDocuments = new NegativeRiskCheckBoxViewModel(risks.DebtsEnforcementDocuments),
                FalseBusiness             = new NegativeRiskCheckBoxViewModel(risks.FalseBusiness),
                SpecialRisc              = new NegativeRiskCheckBoxViewModel(risks.SpecialRisc),
                ExecuteProc              = new NegativeRiskCheckBoxViewModel(risks.ExecuteProc),
                BankruptcyProc           = new NegativeRiskCheckBoxViewModel(risks.BankruptcyProc),
                LiquidationProc          = new NegativeRiskCheckBoxViewModel(risks.LiquidationProc),
                NegativData              = new NegativeRiskCheckBoxViewModel(risks.NegativData),
                ExchengeTradingDisorders = new NegativeRiskCheckBoxViewModel(risks.ExchengeTradingDisorders),
            };

            SaveCommand       = new RelayCommand(Save, CanSave);
            ClearCommand      = new RelayCommand(Clear);
            Risk              = RiskCalculator.Value;
            AutoFill          = new RelayCommand(FillOracleDataOrgPers);
            AutoFillViewModel = new AutoFillViewModel();

            Countries = countryVM;
        }
コード例 #17
0
        public CountryEditModel GetCountryAsEditModel(Guid id)
        {
            var entity = _repository.Get(id);

            if (entity == null)
            {
                throw new Exception(LOCALIZATION_COUNTRY_NOT_FOUND);
            }

            return(CountryMapper.MapToCountryEditModel(entity));
        }
コード例 #18
0
        public void MapCountryToDTO_ShouldReturnEmptyDTOIfFailed()
        {
            //Arrange
            //Act
            var sut = CountryMapper.MapCountryToDTO(null);

            //Assert
            Assert.AreEqual(sut.ID, null);
            Assert.AreEqual(sut.Name, null);
            Assert.AreEqual(sut.Breweries, null);
        }
コード例 #19
0
 public ReferenceDataService(IUnitOfWork unitOfWork,
                             ICountryRestService countryRestService,
                             IExchangeRateService exchangeRateService,
                             CountryMapper countryMapper,
                             ExchangeRateMapper exchangeRateMapper)
 {
     this.unitOfWork          = unitOfWork;
     this.countryRestService  = countryRestService;
     this.exchangeRateService = exchangeRateService;
     this.countryMapper       = countryMapper;
     this.exchangeRateMapper  = exchangeRateMapper;
 }
コード例 #20
0
 public List <Country> GetCountries(int continentId)
 {
     try
     {
         List <CountryDB> countryDBs = context.Countries.Where(x => x.ContinentId == continentId).ToList();
         List <Country>   countries  = CountryMapper.CountryDBListToBusinessModel(countryDBs);
         return(countries);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #21
0
        protected void SetUp()
        {
            _countryRepository = new Mock <ICountryRepository>();

            var countryMapper = new CountryMapper();

            var countryService = new CountryService(_countryRepository.Object, countryMapper);

            _countriesController = new CountriesController(countryService)
            {
                Request       = new HttpRequestMessage(),
                Configuration = new HttpConfiguration()
            };
        }
コード例 #22
0
        public void MapDTOToCountry_ShouldReturnEmptyCountryIfFailed()
        {
            //Arrange
            //Act
            var sut = CountryMapper.MapDTOToCountry(null);

            //Assert
            Assert.AreEqual(sut.ID, null);
            Assert.AreEqual(sut.Name, null);
            Assert.AreEqual(sut.Breweries, null);
            Assert.AreEqual(sut.CreatedOn, default);
            Assert.AreEqual(sut.ModifiedOn, null);
            Assert.AreEqual(sut.DeletedOn, null);
            Assert.AreEqual(sut.IsDeleted, false);
        }
コード例 #23
0
        public void Arrange()
        {
            _geocodeService  = new Mock <IGeocodeService>();
            _mappingService  = new Mock <IMappingService>();
            _vacanciesApi    = new Mock <ILivevacanciesAPI>();
            _vacanciesMapper = new VacanciesMapper();
            _logger          = new Mock <ILogger <VacanciesRepository> >();
            _countryMapper   = new CountryMapper();

            _geocodeService.Setup(s => s.GetFromPostCode(It.IsAny <string>())).ReturnsAsync(coordinatesResponse);

            sut = new VacanciesRepository(_vacanciesApi.Object, _vacanciesMapper, _geocodeService.Object, _mappingService.Object, _logger.Object, _countryMapper, Mock.Of <IStandardsRepository>());

            _standardIds = null;
        }
コード例 #24
0
 public Country AddCountry(Country country)
 {
     try
     {
         CountryDB countryDB = CountryMapper.CountryToDBModel(country);
         context.Countries.Add(countryDB);
         context.SaveChanges();
         Country newCountry = CountryMapper.CountryDBToBusinessModel(countryDB, country.Continent);
         return(newCountry);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #25
0
 public void UpdateCountry(int id, Country countryUpdated, int newContinentId)
 {
     try
     {
         CountryDB countryDB        = context.Countries.Find(id);
         CountryDB countryDBUpdated = CountryMapper.CountryToDBModel(countryUpdated);
         countryDB.ContinentId = newContinentId;
         countryDB.Name        = countryDBUpdated.Name;
         countryDB.Population  = countryDBUpdated.Population;
         countryDB.Surface     = countryDBUpdated.Surface;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #26
0
 public Country Find(string countryName)
 {
     try
     {
         CountryDB countryDB = context.Countries.Where(x => x.Name == countryName).FirstOrDefault();
         if (countryDB != null)
         {
             return(CountryMapper.CountryDBToBusinessModel(countryDB));
         }
         return(null);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #27
0
        public ProductImportViewModel()
        {
            InitializeCommands();

            m_Suppliers  = SupplierMapper.GetAllSuppliers();
            m_Producers  = ProducerMapper.GetAllProducers();
            m_Sorts      = SortMapper.GetAllSorts();
            m_Categories = ToolConstants.DEFAULT_FRUIT_CATEGORIES;
            m_Products   = ProductMapper.GetAllProducts();
            m_Origins    = CountryMapper.GetAllCountries();


            RaisePropertyChanged(nameof(Products));
            RaisePropertyChanged(nameof(Sorts));
            RaisePropertyChanged(nameof(Categories));
            RaisePropertyChanged(nameof(Origins));
        }
        public void Arrange()
        {
            _geocodeService  = new Mock <IGeocodeService>();
            _mappingService  = new Mock <IMappingService>();
            _vacanciesApi    = new Mock <ILivevacanciesAPI>();
            _vacanciesMapper = new VacanciesMapper();
            _logger          = new Mock <ILogger <VacanciesRepository> >();
            _countryMapper   = new CountryMapper();

            _geocodeService.Setup(s => s.GetFromPostCode(It.IsAny <string>())).ReturnsAsync(coordinatesResponse);


            _vacanciesApi.Setup(s => s.SearchApprenticeshipVacanciesByLocationAsync(It.IsAny <double>(), It.IsAny <double>(),
                                                                                    It.IsAny <int>(), It.IsAny <int>(), It.IsAny <int>())).ReturnsAsync(GetSearchResults.MockSearchResults(coordinatesResponse));
            _mappingService.Setup(s => s.GetStaticMapsUrl(It.IsAny <SFA.DAS.Campaign.Domain.Vacancies.Location>())).Returns("url");


            sut = new VacanciesRepository(_vacanciesApi.Object, _vacanciesMapper, _geocodeService.Object, _mappingService.Object, _logger.Object, _countryMapper, Mock.Of <IStandardsRepository>());
        }
コード例 #29
0
 public Country Find(int continentId, int countryId)
 {
     try
     {
         CountryDB   countryDB   = context.Countries.Find(countryId);
         ContinentDB continentDB = context.Continents.Find(continentId);
         if (continentDB != null && countryDB != null)
         {
             countryDB.ContinentId = continentId;
             countryDB.Continent   = continentDB;
             Country country = CountryMapper.CountryDBToBusinessModel(countryDB);
             return(country);
         }
         return(null);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #30
0
        public void CountryMapper_Maps_Correctly()
        {
            var mapper = new CountryMapper();
            var source = new ApiCountry()
            {
                iso3166             = "IN",
                total_holidays      = 22,
                supported_languages = 2,
                uuid         = "foo",
                country_name = "India"
            };
            var destination = new Country();

            destination = mapper.Convert(source, destination, null);
            destination.ShouldNotBeNull();
            destination.CountryName.ShouldBe("India");
            destination.Iso3166.ShouldBe("IN");
            destination.TotalHolidays.ShouldBe(22);
            destination.Uuid.ShouldBe("foo");
            destination.SupportedLanguages.ShouldBe(2);
        }
コード例 #31
0
ファイル: Edit.aspx.cs プロジェクト: GramozKrasniqi/HRMS
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.QueryString["CountryId"] != null)
     {
         if (!IsPostBack)
         {
             CountryEntity entity = new CountryMapper().Get(new CountryEntity() { Id = Convert.ToInt32(Request.QueryString["CountryId"]) });
             if (entity != null)
             {
                 TitleTextBox.Text = entity.Title;
                 OtherInfoTextBox.Text = entity.Description;
             }
             else
             {
                 Response.Redirect("List.aspx");
             }
         }
     }
     else
     {
         Response.Redirect("List.aspx");
     }
 }
コード例 #32
0
        public CascadingDropDownNameValue[] GetCountrie(string knownCategoryValues, string category, string contextKey)
        {
            List<CascadingDropDownNameValue> values = new List<CascadingDropDownNameValue>();

            List<CountryEntity> list = new CountryMapper().List("");
            foreach (CountryEntity ent in list)
            {
                CascadingDropDownNameValue cdnv;

                if (ent.Title == contextKey)
                {
                    cdnv = new CascadingDropDownNameValue(ent.Title, ent.Id.ToString(), true);
                }
                else
                {
                    cdnv = new CascadingDropDownNameValue(ent.Title, ent.Id.ToString());
                }

                values.Add(cdnv);
            }

            return values.ToArray();
        }
コード例 #33
0
 /// <summary>
 /// Given certain conditions.
 /// </summary>
 protected override void Given()
 {
     input = new Country { Name = "Germany" };
     classUnderTest = new CountryMapper();
 }