/// <summary> /// /// </summary> /// <exception cref="WebException">Throws when there is no internet connection</exception> /// <param name="isoCode"></param> /// <returns></returns> public tCountryInfo GetFullCoutryInfo(string isoCode) { try { if (_countryInfoService == null) { _countryInfoService = new CountryInfoService(); } var info = _countryInfoService.FullCountryInfo(isoCode); //info.sCapitalCity; //info.Languages; //info.sCountryFlag; //info.sCurrencyISOCode; //info.sPhoneCode; //info.sContinentCode; //info.sName; return(info); } catch (WebException e) { Debug.WriteLine(e.Message); //throw new WebException("No internet connection", e); MessageBox.Show("Could not connect to web service, please try again later", "Internet connection (Country Info)"); return(null); } }
public ActionResult EditCostOfLiving(EditCostOfLivingInfoView editModel) { var service = new CountryInfoService(); service.EditCostOfLiving(editModel.Id, editModel.Value); Session["CreateTxt"] = "Successfully edited value."; return(RedirectToAction("CostOfLiving")); }
public ActionResult Create(CreateCrimeRateInfo createModel) { var service = new CountryInfoService(); var model = AutoMapper.Mapper.Map <CreateCrimeRateInfo, CrimeRateInfo>(createModel); Session["CreateTxt"] = service.CreateCrimeRate(model); return(RedirectToAction("Index")); }
public ActionResult EditCrimeRate(EditCrimeRateInfo editModel) { var service = new CountryInfoService(); service.EditCrimeRate(editModel.Id, editModel.Value); Session["CreateTxt"] = "Successfully edited value."; return(RedirectToAction("CrimeRate")); }
public ActionResult DeleteCostOfLiving(int id) { var service = new CountryInfoService(); service.DeleteCostOfLiving(id); Session["DeleteTxt"] = "Successfully deleted value."; return(RedirectToAction("CostOfLiving")); }
public ActionResult Create(CreateCostOfLivingInfoView createModel) { var service = new CountryInfoService(); var model = AutoMapper.Mapper.Map <CreateCostOfLivingInfoView, CostOfLivingInfo>(createModel); Session["CreateTxt"] = service.CreateCostOfLiving(model); return(RedirectToAction("Index")); }
public ActionResult Delete(int id) { var service = new CountryInfoService(); service.DeleteCrimeRate(id); Session["DeleteTxt"] = "Successfully deleted value."; return(RedirectToAction("UserCrimeRateInput")); }
public ActionResult Index() { var service = new CountryInfoService(); var model = new MainView(); model.Countries = service.GetCountries(); return(View(model)); }
public ActionResult Search(string actionP, string controllerP) { var service = new CountryInfoService(); var model = new SearchView(); model.action = actionP; model.controller = controllerP; model.Countries = service.GetCountries(); model.CountryId = (int?)Session["countryId"]; return(PartialView("_PartialSearch", model)); }
public ActionResult Create(int?countryInfoId, string type) { ViewBag.PriceType = type; var userService = new UserService(); var service = new CountryInfoService(); var model = new CreateCrimeRateInfo(); model.CountryInfoID = (int)countryInfoId; model.CrimeRateTypeID = service.GetCrimeRateType(type).Id; model.ApplicationUserId = userService.GetUser(User.Identity.Name).Id; return(View("CreateCrimeRate", model)); }
public ActionResult Edit(int id) { var userService = new UserService(); var service = new CountryInfoService(); var result = service.GetCrimeRateInfo(id); var model = new EditCrimeRateInfo() { Value = result.Value, Id = id }; return(View("Edit", model)); }
public ActionResult EditCostOfLiving(int id) { var userService = new UserService(); var service = new CountryInfoService(); var result = service.GetCostOfLivingInfo(id); var model = new EditCostOfLivingInfoView() { Value = result.Value, Id = id }; return(View("EditCostOfLiving", model)); }
// GET: CrimeRate public ActionResult Index() { if (Session["countryId"] == null) { var service = new CountryInfoService(); var model = new MainView(); model.Countries = service.GetCountries(); return(View("CrimeRate", model)); } else { return(Index((int)Session["countryId"])); } }
public ActionResult BasicInfo() { if (Session["countryId"] != null) { var service = new CountryInfoService(); var model = service.GetCountryInfoValues((int)Session["countryId"]); Session["countryId"] = model.Country.Id; Session["countryCode"] = model.Country.Code; return(View("Details", model)); } else { return(RedirectToAction("Index")); } }
public ActionResult Index(int?countryId = null, string countryName = null) { var service = new CountryInfoService(); try { var model = service.GetCountryInfoValues(countryId, countryName); Session["countryId"] = model.Country.Id; Session["countryCode"] = model.Country.Code; return(View("DetailsCrimeRate", model)); } catch { return(View("~/Views/Home/NoCountryInfo.cshtml")); } }
public ActionResult CostOfLiving(string username = null, int?countryId = null, string countryName = null) { var service = new CountryInfoService(); var userService = new UserService(); var model = new UserValueForCostView(); model.Countries = service.GetCountries(); if (username != null) { Session["selectedUser"] = username; model.CostList = userService.GetUserCostOfLiving(username, countryId); } else { model.CostList = userService.GetUserCostOfLiving(null, countryId); } return(View("CostOfLiving", model)); }
public string GetCurrencyName(string isoCurrencyCode) { try { if (_countryInfoService == null) { _countryInfoService = new CountryInfoService(); } var name = _countryInfoService.CurrencyName(isoCurrencyCode); return(name); } catch (WebException e) { Debug.WriteLine(e.Message); //throw new WebException("No internet connection", e); MessageBox.Show("Could not connect to web service, please try again later", "Internet connection (Currency name)"); return(null); } }
public ActionResult UserCrimeRateInput(string username = null, int?countryId = null, string countryName = null) { var service = new CountryInfoService(); var userService = new UserService(); var model = new UserCrimeRateInputView(); model.Countries = service.GetCountries(); if (username != null) { Session["selectedUser"] = username; model.CrimeRateList = userService.GetUserCrimeRateInfo(username, countryId); } else { model.CrimeRateList = userService.GetUserCrimeRateInfo(User.Identity.Name, countryId); } return(View("UserCrimeRateInput", model)); }
public CountryInfoServiceTests() { this._mockRestCountriesClient = new Mock <IRestCountriesClient>(); this._mockLocalCache = new Mock <ILocalCache>(); this._subject = new CountryInfoService(this._mockRestCountriesClient.Object, this._mockLocalCache.Object); }
//public IEnumerable<ChannelAccProfile> GetAllChannelAccProfile() //{ // try // { // var _ListChannelAccProfile = _IUoW.mTakaDbQuery().GetAllChannelAccProfile_LQ(); // return _ListChannelAccProfile; // } // catch (Exception ex) // { // _ObjErrorLogService = new ErrorLogService(); // _ObjErrorLogService.AddErrorLog(ex, string.Empty, "GetAllChannelAccProfile()", string.Empty); // return null; // } //} public List <ChannelAccProfile> GetAllChannelAccProfile() { try { List <ChannelAccProfile> OBJ_LIST_ChannelAccProfile = new List <ChannelAccProfile>(); var _ListChannelAccProfile = _IUoW.Repository <ChannelAccProfile>().Get(x => x.AuthStatusId == "A" && x.LastAction != "DEL").OrderByDescending(x => x.AccountProfileId); foreach (var item in _ListChannelAccProfile) { ChannelAccProfile OBJ_ChannelAccProfile = new ChannelAccProfile(); ChannelAccProfileService OBJ_ChannelAccProfileService = new ChannelAccProfileService(); AccCategoryService OBJ_AccCategoryService = new AccCategoryService(); AccTypeService OBJ_AccTypeService = new AccTypeService(); CustomerAccProfileService OBJ_CustomerAccProfileService = new CustomerAccProfileService(); CountryInfoService OBJ_CountryInfoService = new CountryInfoService(); CityInfoService OBJ_CityInfoService = new CityInfoService(); DistrictInfoService OBJ_DistrictInfoService = new DistrictInfoService(); PSInfoService OBJ_PSInfoService = new PSInfoService(); AreaInfoService OBJ_AreaInfoService = new AreaInfoService(); BankInfoService OBJ_BankInfoService = new BankInfoService(); BranchInfoService OBJ_BranchInfoService = new BranchInfoService(); AccStatusSetupService OBJ_AccStatusSetupService = new AccStatusSetupService(); ManagerTypeService OBJ_ManagerTypeService = new ManagerTypeService(); ManagerAccProfileService OBJ_ManagerProfileService = new ManagerAccProfileService(); OBJ_ChannelAccProfile.AccountProfileId = item.AccountProfileId; ////OBJ_ChannelAccProfile.AccountCategoryId = item.AccountCategoryId; ////foreach (var item1 in OBJ_AccCategoryService.GetAccCategoryForDD()) ////{ //// if (item1.Value == OBJ_ChannelAccProfile.AccountCategoryId) //// { //// OBJ_ChannelAccProfile.AccountCategoryNm = item1.Text; //// } ////} OBJ_ChannelAccProfile.AccountTypeId = item.AccountTypeId; foreach (var item1 in OBJ_AccTypeService.GetAccTypeForDD()) { if (item1.Value == OBJ_ChannelAccProfile.AccountTypeId) { OBJ_ChannelAccProfile.AccountTypeNm = item1.Text; } } OBJ_ChannelAccProfile.WalletAccountNo = item.WalletAccountNo; OBJ_ChannelAccProfile.UserName = item.UserName; OBJ_ChannelAccProfile.FatherNm = item.FatherNm; OBJ_ChannelAccProfile.MotherNm = item.MotherNm; OBJ_ChannelAccProfile.DateofBirth = item.DateofBirth; OBJ_ChannelAccProfile.NationalityId = item.NationalityId; OBJ_ChannelAccProfile.Gender = item.Gender; foreach (var item1 in OBJ_CustomerAccProfileService.GetGender()) { if (item1.Value == OBJ_ChannelAccProfile.Gender) { OBJ_ChannelAccProfile.GenderNm = item1.Text; } } OBJ_ChannelAccProfile.TAXIdNo = item.TAXIdNo; OBJ_ChannelAccProfile.PassportNo = item.PassportNo; OBJ_ChannelAccProfile.PresentAddress1 = item.PresentAddress1; OBJ_ChannelAccProfile.PresentAddress2 = item.PresentAddress2; OBJ_ChannelAccProfile.PresentCountryId = item.PresentCountryId; foreach (var item1 in OBJ_CountryInfoService.GetCountryInfoForDD()) { if (item1.Value == OBJ_ChannelAccProfile.PresentCountryId) { OBJ_ChannelAccProfile.PresentCountryNm = item1.Text; } } OBJ_ChannelAccProfile.PresentCityId = item.PresentCityId; foreach (var item1 in OBJ_CityInfoService.GetCityInfoForDD()) { if (item1.Value == OBJ_ChannelAccProfile.PresentCityId) { OBJ_ChannelAccProfile.PresentCityNm = item1.Text; } } OBJ_ChannelAccProfile.PresentDistrictId = item.PresentDistrictId; foreach (var item1 in OBJ_DistrictInfoService.GetDistrictInfoForDD()) { if (item1.Value == OBJ_ChannelAccProfile.PresentDistrictId) { OBJ_ChannelAccProfile.PresentDistrictNm = item1.Text; } } OBJ_ChannelAccProfile.PresentPoliceStationId = item.PresentPoliceStationId; foreach (var item1 in OBJ_PSInfoService.GetPSInfoForDD()) { if (item1.Value == OBJ_ChannelAccProfile.PresentPoliceStationId) { OBJ_ChannelAccProfile.PresentPoliceStationNm = item1.Text; } } OBJ_ChannelAccProfile.PresentAreaId = item.PresentAreaId; foreach (var item1 in OBJ_AreaInfoService.GetAreaInfoForDD()) { if (item1.Value == OBJ_ChannelAccProfile.PresentAreaId) { OBJ_ChannelAccProfile.PresentAreaNm = item1.Text; } } //OBJ_ChannelAccProfile.PresentPhoneNo = item.PresentPhoneNo; OBJ_ChannelAccProfile.PermanentAddress1 = item.PermanentAddress1; OBJ_ChannelAccProfile.PermanentAddress2 = item.PermanentAddress2; OBJ_ChannelAccProfile.PermanentCountryId = item.PermanentCountryId; foreach (var item1 in OBJ_CountryInfoService.GetCountryInfoForDD()) { if (item1.Value == OBJ_ChannelAccProfile.PermanentCountryId) { OBJ_ChannelAccProfile.PermanentCountryNm = item1.Text; } } OBJ_ChannelAccProfile.PermanentCityId = item.PermanentCityId; foreach (var item1 in OBJ_CityInfoService.GetCityInfoForDD()) { if (item1.Value == OBJ_ChannelAccProfile.PermanentCityId) { OBJ_ChannelAccProfile.PermanentCityNm = item1.Text; } } OBJ_ChannelAccProfile.PermanentDistrictId = item.PermanentDistrictId; foreach (var item1 in OBJ_DistrictInfoService.GetDistrictInfoForDD()) { if (item1.Value == OBJ_ChannelAccProfile.PermanentDistrictId) { OBJ_ChannelAccProfile.PermanentDistrictNm = item1.Text; } } OBJ_ChannelAccProfile.PermanentPoliceStationId = item.PermanentPoliceStationId; foreach (var item1 in OBJ_PSInfoService.GetPSInfoForDD()) { if (item1.Value == OBJ_ChannelAccProfile.PermanentPoliceStationId) { OBJ_ChannelAccProfile.PermanentPoliceStationNm = item1.Text; } } OBJ_ChannelAccProfile.PermanentAreaId = item.PermanentAreaId; foreach (var item1 in OBJ_AreaInfoService.GetAreaInfoForDD()) { if (item1.Value == OBJ_ChannelAccProfile.PermanentAreaId) { OBJ_ChannelAccProfile.PermanentAreaNm = item1.Text; } } //OBJ_ChannelAccProfile.PermanentPhoneNo = item.PermanentPhoneNo; OBJ_ChannelAccProfile.BankId = item.BankId; foreach (var item1 in OBJ_BankInfoService.GetBankInfoForDD()) { if (item1.Value == OBJ_ChannelAccProfile.BankId) { OBJ_ChannelAccProfile.BankNm = item1.Text; } } OBJ_ChannelAccProfile.BranchId = item.BranchId; foreach (var item1 in OBJ_BranchInfoService.GetBranchInfoForDD()) { if (item1.Value == OBJ_ChannelAccProfile.BranchId) { OBJ_ChannelAccProfile.BranchNm = item1.Text; } } OBJ_ChannelAccProfile.BankAccountNo = item.BankAccountNo; OBJ_ChannelAccProfile.ParentAccountTypeId = item.ParentAccountTypeId; foreach (var item1 in OBJ_AccTypeService.GetAccTypeForDD()) { if (item1.Value == OBJ_ChannelAccProfile.ParentAccountTypeId) { OBJ_ChannelAccProfile.ParentAccountTypeNm = item1.Text; } } OBJ_ChannelAccProfile.ParentAccountProfileId = item.ParentAccountProfileId; foreach (var item1 in OBJ_ChannelAccProfileService.GetChannelAccProfileForDD()) { if (item1.Value == OBJ_ChannelAccProfile.ParentAccountProfileId) { OBJ_ChannelAccProfile.ParentChannelAccProfileNm = item1.Text; } } OBJ_ChannelAccProfile.CompanyNm = item.CompanyNm; OBJ_ChannelAccProfile.Occupation = item.Occupation; OBJ_ChannelAccProfile.NationalIdNo = item.NationalIdNo; OBJ_ChannelAccProfile.VatRegistrationNo = item.VatRegistrationNo; OBJ_ChannelAccProfile.AccountStatusId = item.AccountStatusId; foreach (var item1 in OBJ_AccStatusSetupService.GetAccStatusSetupForDD()) { if (item1.Value == OBJ_ChannelAccProfile.AccountStatusId) { OBJ_ChannelAccProfile.AccountStatusName = item1.Text; } } OBJ_ChannelAccProfile.TradeLicenseNo = item.TradeLicenseNo; ////OBJ_ChannelAccProfile.ManagerTypeId = item.ManagerTypeId; ////foreach (var item1 in OBJ_ManagerTypeService.GetManagerTypeForDD()) ////{ //// if (item1.Value == OBJ_ChannelAccProfile.ManagerTypeId) //// { //// OBJ_ChannelAccProfile.ManagerTypeNm = item1.Text; //// } ////} OBJ_ChannelAccProfile.ManagerAccountProfileId = item.ManagerAccountProfileId; foreach (var item1 in OBJ_ManagerProfileService.GetManagerForDD()) { if (item1.Value == OBJ_ChannelAccProfile.ManagerAccountProfileId) { OBJ_ChannelAccProfile.ManagerProfileNm = item1.Text; } } OBJ_ChannelAccProfile.AuthStatusId = item.AuthStatusId; OBJ_ChannelAccProfile.LastAction = item.LastAction; OBJ_ChannelAccProfile.LastUpdateDT = item.LastUpdateDT; OBJ_ChannelAccProfile.MakeBy = item.MakeBy; OBJ_ChannelAccProfile.MakeDT = item.MakeDT; OBJ_ChannelAccProfile.TransDT = item.TransDT; OBJ_LIST_ChannelAccProfile.Add(OBJ_ChannelAccProfile); } return(OBJ_LIST_ChannelAccProfile); } catch (Exception ex) { _ObjErrorLogService = new ErrorLogService(); _ObjErrorLogService.AddErrorLog(ex, string.Empty, "GetAllChannelAccProfile()", string.Empty); throw ex; } }
public void Setup() { _mockHttpMessageHandler = new Mock <HttpMessageHandler>(); _httpClientProvider = new HttpClientProvider(_mockHttpMessageHandler.Object); _countryInfoService = new CountryInfoService(_httpClientProvider); }
public CountryFilterAPIController() { this.countryInfoService = new CountryInfoService(); }