Ejemplo n.º 1
0
        public IActionResult StepTwo(StepTwoModel model)
        {
            if (!CheckStep(2))
            {
                return(Redirect("1"));
            }

            var countries = new CountryHelper().GetCountryData();

            if (ModelState.IsValid)
            {
                var country = countries.Where(c => c.CountryShortCode == model.CountryCode);
                if (country.Any())
                {
                    GlobalSettings.Store("CONFIG_CompanyName", model.CompanyName);
                    GlobalSettings.Store("CONFIG_CompanySubject", model.CompanyName);
                    GlobalSettings.Store("CONFIG_CompanyCountryCode", country.First().CountryShortCode);
                    GlobalSettings.Store("CONFIG_URL", model.AppHost);

                    Helpers.ReplaceEnvVariableInFile(GlobalSettings.Get("CONFIG_FILE"), "SP_CONFIG_SETUPASSISTANT_STEP", "3");
                    GlobalSettings.Store("CONFIG_SETUPASSISTANT_STEP", "3");

                    return(Redirect("3"));
                }
                else
                {
                    ModelState.AddModelError(string.Empty, "Unknown country");
                }
            }

            model.CountryList = new Microsoft.AspNetCore.Mvc.Rendering.SelectList(countries, "CountryShortCode", "CountryName");

            return(View(model));
        }
Ejemplo n.º 2
0
        public ActionResult Form(Postulante model)
        {
            //MODEL IS VALID
            if (ModelState.IsValid)
            {
                string subject = string.Empty;
                if (model.cv_job_area != null)
                {
                    subject  = model.cv_job_area[0] + " - ";
                    subject += model.cv_salary;
                    subject += (model.cv_applyto.Equals("OTHER")) ? " (MULTIPLE)" : "";
                }
                else
                {
                    subject  = "No Job Area - ";
                    subject += model.cv_salary;
                    subject += (model.cv_applyto.Equals("OTHER")) ? " (MULTIPLE)" : "";
                }

                string body = ParseBody(model);


                MailHelper.SendMail(CountryHelper.getAddress(model.cv_applyto), body, subject, model.cv_file);

                return(this.RedirectToAction("Submit", "Upload", model.cv_name));
            }

            //INVALID MODEL
            return(View(model));
        }
Ejemplo n.º 3
0
        private void btnCodeRequest_Click(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(this.txtPhoneNumber.Text))
            {
                if (this.radVoice.Checked)
                {
                    this.method = "voice";
                }
                try
                {
                    this.number = this.txtPhoneNumber.Text;
                    this.TrimNumber();
                    WhatsAppApi.Parser.PhoneNumber phonenumber = new WhatsAppApi.Parser.PhoneNumber(this.number);
                    this.identity = WhatsAppApi.Register.WhatsRegisterV2.GenerateIdentity(phonenumber.Number, this.txtPassword.Text);
                    this.cc       = phonenumber.CC;
                    this.phone    = phonenumber.Number;
                    this.language = phonenumber.ISO639;
                    this.locale   = phonenumber.ISO3166;
                    this.mcc      = phonenumber.MCC;

                    CountryHelper chelp   = new CountryHelper();
                    string        country = string.Empty;
                    if (!chelp.CheckFormat(this.cc, this.phone, out country))
                    {
                        string msg = string.Format("Provided number does not match any known patterns for {0}", country);
                        this.Notify(msg);
                        return;
                    }
                }
                catch (Exception ex)
                {
                    string msg = String.Format("Error: {0}", ex.Message);
                    this.Notify(msg);
                    return;
                }
                string response = null;
                if (WhatsAppApi.Register.WhatsRegisterV2.RequestCode(this.cc, this.phone, out this.password, out response, this.method, this.identity, this.language, this.locale, this.mcc))
                {
                    if (!string.IsNullOrEmpty(this.password))
                    {
                        //password received
                        this.OnReceivePassword();
                    }
                    else
                    {
                        this.grpStep1.Enabled = false;
                        this.grpStep2.Enabled = true;
                    }
                }
                else
                {
                    string msg = string.Format("Could not request verification code\r\n{0}", response);
                    this.Notify(msg);
                }
            }
            else
            {
                this.Notify("Please enter a phone number");
            }
        }
Ejemplo n.º 4
0
        protected override VendorViewModel SetViewModelData(VendorViewModel viewModel)
        {
            var accountService = new AccountService(UnitOfWork);
            var businessId     = User.Identity.GetBusinessId();

            if (businessId == null)
            {
                return(viewModel);
            }
            viewModel.PaymentAccounts = accountService.GetPaymentAccounts((Guid)businessId).Select(o => new SelectListItem
            {
                Text  = o.Name,
                Value = o.Id.ToString()
            }).ToList();

            viewModel.ExpenseAccounts = accountService.GetIncomeAccounts((Guid)businessId).Select(o => new SelectListItem
            {
                Text  = o.Name,
                Value = o.Id.ToString()
            }).ToList();


            viewModel.Countries = CountryHelper.CountryList().Select(o => new SelectListItem
            {
                Text  = o.Name,
                Value = o.Code
            }).ToList();

            return(viewModel);
        }
Ejemplo n.º 5
0
        public ActionResult <IEnumerable <RegionStatisticDto> > RegionStatistic()
        {
            var countryCodes = (CountryCode[])Enum.GetValues(typeof(CountryCode));

            var availableCountryCodes = from CountryCode countryCode in countryCodes
                                        where DateSystem.GetPublicHoliday(DateTime.Today.Year, countryCode).Any()
                                        select countryCode;

            var missingCountryCodes = countryCodes.Except(availableCountryCodes);

            var availableCountries = availableCountryCodes.Select(o => this._countryProvider.GetCountry(o.ToString()));
            var missingCountries   = missingCountryCodes.Select(o => this._countryProvider.GetCountry(o.ToString()));

            var regions = (Region[])Enum.GetValues(typeof(Region));

            var regionStatistic = from Region region in regions
                                  where region != Region.None
                                  select new RegionStatisticDto
            {
                RegionName         = region.ToString(),
                AvailableCountries = availableCountries.Where(o => o.Region == region)
                                     .Select(o => CountryHelper.Convert(o))
                                     .OrderBy(o => o.CommonName)
                                     .ToArray(),
                MissingCountries = missingCountries.Where(o => o.Region == region)
                                   .Select(o => CountryHelper.Convert(o))
                                   .OrderBy(o => o.CommonName)
                                   .ToArray(),
            };

            return(View(regionStatistic));
        }
Ejemplo n.º 6
0
        public bool GetCountry(Country country)
        {
            int  CountryID = 0;
            bool Result    = false;

            try
            {
                CountryHelper chelper    = new CountryHelper();
                DataSet       dscountry  = chelper.getCountry();
                string        xmlcountry = dscountry.GetXml();
                if (xmlcountry != null)
                {
                    CountryID = country.CompanyId;
                    Result    = true;
                }
                else
                {
                    Result = false;
                }
            }

            catch
            {
                throw;
            }
            return(Result);
        }
Ejemplo n.º 7
0
        private void CliRequestCode()
        {
            this.GetArgs();
            this.TrimNumber();
            try
            {
                WhatsAppApi.Parser.PhoneNumber pn = new WhatsAppApi.Parser.PhoneNumber(this.number);
                this.identity = WhatsAppApi.Register.WhatsRegisterV2.GenerateIdentity(pn.Number, this.password);
                CountryHelper ch       = new CountryHelper();
                string        country  = string.Empty;
                string        response = string.Empty;
                if (ch.CheckFormat(pn.CC, pn.Number, out country))
                {
                    bool result = WhatsAppApi.Register.WhatsRegisterV2.RequestCode(pn.CC, pn.Number, out this.password, out response, this.method, null, pn.ISO639, pn.ISO3166, pn.MCC, this.password);

                    //return raw
                    if (this.raw)
                    {
                        Console.WriteLine(response);
                        return;
                    }

                    if (result)
                    {
                        if (!string.IsNullOrEmpty(this.password))
                        {
                            Console.WriteLine("Got password:"******"Code requested");
                        }
                    }
                    else
                    {
                        if (response == "iplimit")
                        {
                            Console.WriteLine("Daily 10 unique phone number limit reached.");
                            Console.WriteLine("Try again tomorrow or email me at [email protected] to add you to my whitelist");
                        }
                        else
                        {
                            Console.WriteLine("Error:");
                            Console.WriteLine(response);
                        }
                    }
                }
                else
                {
                    Console.WriteLine(string.Format("Invalid phone number for {0}", country));
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
        // GET: ShippingAddresses/Create
        public IActionResult Create(Guid?id)
        {
            var countries = new CountryHelper(_context).GetShippingCountries(1);             //default 1 deutschland

            ViewData["Countries"]  = new SelectList(countries, "ID", "Name");
            ViewData["CustomerId"] = id;

            return(View());
        }
        /// <summary>
        /// Does this provider include special type of regions?
        /// </summary>
        /// <param name="regionCode"></param>
        /// <returns></returns>
        public override bool DoesIncludeRegion(string regionCode)
        {
            if (string.IsNullOrWhiteSpace(regionCode))
            {
                return(false);
            }

            regionCode = CountryHelper.FixRegionCode(Country.UnitedKingdom, regionCode);

            switch (regionCode)
            {
            case "GB-GG":
                return(InternalSingleInstanceServiceLocator.HolidayProviderManager.ContainsRegion(CountryCode.GG));

            case "GB-JE":
                return(InternalSingleInstanceServiceLocator.HolidayProviderManager.ContainsRegion(CountryCode.JE));

            case "GB-IM":
                return(InternalSingleInstanceServiceLocator.HolidayProviderManager.ContainsRegion(CountryCode.IM));

            case "GB-GI":
                return(InternalSingleInstanceServiceLocator.HolidayProviderManager.ContainsRegion(CountryCode.GI));

            case "GB-BM":
                return(InternalSingleInstanceServiceLocator.HolidayProviderManager.ContainsRegion(CountryCode.BM));

            case "GB-KY":
                return(InternalSingleInstanceServiceLocator.HolidayProviderManager.ContainsRegion(CountryCode.KY));

            case "GB-TC":
                return(InternalSingleInstanceServiceLocator.HolidayProviderManager.ContainsRegion(CountryCode.TC));

            case "GB-VG":
                return(InternalSingleInstanceServiceLocator.HolidayProviderManager.ContainsRegion(CountryCode.VG));

            case "GB-AI":
                return(InternalSingleInstanceServiceLocator.HolidayProviderManager.ContainsRegion(CountryCode.AI));

            case "GB-MS":
                return(InternalSingleInstanceServiceLocator.HolidayProviderManager.ContainsRegion(CountryCode.MS));

            case "GB-SH":
                return(InternalSingleInstanceServiceLocator.HolidayProviderManager.ContainsRegion(CountryCode.SH));

            case "GB-GS":
                return(InternalSingleInstanceServiceLocator.HolidayProviderManager.ContainsRegion(CountryCode.GS));

            case "GB-IO":
                return(InternalSingleInstanceServiceLocator.HolidayProviderManager.ContainsRegion(CountryCode.IO));

            case "GB-PN":
                return(InternalSingleInstanceServiceLocator.HolidayProviderManager.ContainsRegion(CountryCode.PN));

            default:
                return(base.DoesIncludeRegion(regionCode));
            }
        }
Ejemplo n.º 10
0
        public ActionResult EditDetails(string id)
        {
            ViewBag.BranchDetails      = new BranchMasterEntity();
            ViewBag.CountryList        = CountryHelper.GetCountryData();
            ViewBag.StateByCountryList = StateByCountryHelper.GetStateByCountryData("0");
            List <BranchMasterEntity> _branchEntity = BranchHelper.GetBranchData(id);

            return(View("Index", _branchEntity.FirstOrDefault()));
        }
Ejemplo n.º 11
0
 /// <summary>
 /// Gets real region's code.<br />
 /// 获取真实的地区编码。<br />
 /// If <see cref="RegionCode"/> is empty, returns the name of <see cref="CountryCode"/> witch converted from <see cref="Country"/>.<br />
 /// 如果地区编码 <see cref="RegionCode"/> 为空,则返回转换自 <see cref="Country"/> 的 <see cref="CountryCode"/> 的名称。<br />
 /// <br />
 /// If this holiday belongs to the whole nation, returns empty.<br />
 /// 如果本节日属于国家级的节日(非地区级别的),则返回空 empty。
 /// </summary>
 /// <returns></returns>
 public virtual string GetRegionCode()
 {
     if (RegionCodes.Any())
     {
         return(Joiner.On(',').Join(RegionCodes));
     }
     return(string.IsNullOrWhiteSpace(RegionCode)
         ? CountryHelper.GetRegionCode(Country, BelongsToCountry)
         : RegionCode);
 }
Ejemplo n.º 12
0
        private void PopulateCountriesDropDownList(object selectedCountry = null)
        {
            var countries = CountryHelper.GetCountriesByIso3166().Select(x => new
            {
                code = x.TwoLetterISORegionName,
                name = x.EnglishName
            });

            ViewBag.CountryList = new SelectList(countries, "code", "name", selectedCountry);
        }
Ejemplo n.º 13
0
        static void Main(string[] args)
        {
            string        path      = Path.Combine(Environment.CurrentDirectory, @"Data\", @"PopByLargest20.csv");
            CountryHelper csvReader = new CountryHelper(path);

            ShowMenu(csvReader);
            //csvReader.PrintCountries();
            //CsvReader csvReader = new CsvReader(path);
            //csvReader.GetCountriesFromFile();
            //PrintnCountries(csvReader);
        }
        /// <inheritdoc />
        public override bool DoesIncludeRegion(string regionCode)
        {
            if (string.IsNullOrWhiteSpace(regionCode))
            {
                return(false);
            }

            regionCode = CountryHelper.FixRegionCode(Country.Australia, regionCode);

            return(OverseasRegionCache.Contains(regionCode) || base.DoesIncludeRegion(regionCode));
        }
Ejemplo n.º 15
0
        private string BindCountry()
        {
            CountryHelper helper        = new CountryHelper();
            DataSet       dsCountries   = helper.getCountry();
            UtilityHelper utilityHelper = new UtilityHelper();

            dsCountries = utilityHelper.ConvertNullsToEmptyString(dsCountries);
            string xmlCountries = dsCountries.GetXml();

            return(xmlCountries);
        }
Ejemplo n.º 16
0
        private string BindState(int countryID)
        {
            CountryHelper countryhelper = new CountryHelper();
            DataSet       dsStates      = countryhelper.getState(countryID);
            UtilityHelper utilityHelper = new UtilityHelper();

            dsStates = utilityHelper.ConvertNullsToEmptyString(dsStates);
            string xmlStates = dsStates.GetXml();

            return(xmlStates);
        }
Ejemplo n.º 17
0
        private string BindCity(int stateID)
        {
            CountryHelper countryhelper = new CountryHelper();
            DataSet       dsCities      = countryhelper.getCity(stateID);
            UtilityHelper utilityHelper = new UtilityHelper();

            dsCities = utilityHelper.ConvertNullsToEmptyString(dsCities);
            string xmlCities = dsCities.GetXml();

            return(xmlCities);
        }
Ejemplo n.º 18
0
        // GET: Company

        public ActionResult Index()
        {
            CompanyEntity _companyEntity = new CompanyEntity();

            ViewBag.companyDetails = _companyEntity;

            ViewBag.CountryList = CountryHelper.GetCountryData();

            ViewBag.StateByCountryList = StateByCountryHelper.GetStateByCountryData("0");

            return(View());
        }
Ejemplo n.º 19
0
 /// <summary>
 /// Match region
 /// </summary>
 /// <param name="regionCode"></param>
 /// <returns></returns>
 public bool MatchRegion(string regionCode)
 {
     if (RegionCodes.Any())
     {
         return(RegionCodes.Contains(regionCode));
     }
     if (!string.IsNullOrWhiteSpace(RegionCode))
     {
         return(RegionCode == regionCode);
     }
     return(CountryHelper.GetRegionCode(Country, BelongsToCountry) == regionCode);
 }
Ejemplo n.º 20
0
        public string GetRegionInfo(string nativeName)
        {
            var helper = new CountryHelper();
            var data   = helper.GetCountryData();


            var region = data.Where(country => country.CountryName == nativeName)
                         .Select(r => r.CountryShortCode).FirstOrDefault();

            Console.WriteLine("Region :" + region);
            return(region);
        }
 public AccountController(
     UserManager <ApplicationUser> userManager,
     SignInManager <ApplicationUser> signInManager,
     IEmailSender emailSender,
     ILogger <AccountController> logger, ApplicationDbContext context)
 {
     _userManager   = userManager;
     _signInManager = signInManager;
     _emailSender   = emailSender;
     _logger        = logger;
     _context       = context;
     countryHelper  = new CountryHelper(_context);
 }
Ejemplo n.º 22
0
        private void CliRequestCode()
        {
            this.GetArgs();
            this.TrimNumber();
            try
            {
                WhatsAppApi.Parser.PhoneNumber pn = new WhatsAppApi.Parser.PhoneNumber(this.number);
                this.identity = WhatsAppApi.Register.WhatsRegisterV2.GenerateIdentity(pn.Number, this.password);
                CountryHelper ch       = new CountryHelper();
                string        country  = string.Empty;
                string        response = string.Empty;
                if (ch.CheckFormat(pn.CC, pn.Number, out country))
                {
                    bool result = WhatsAppApi.Register.WhatsRegisterV2.RequestCode(this.number, out this.password, out response, this.method, this.identity);

                    //return raw
                    if (this.raw)
                    {
                        Console.WriteLine(response);
                        return;
                    }

                    if (result)
                    {
                        if (!string.IsNullOrEmpty(this.password))
                        {
                            Console.WriteLine("Got password:"******"Code requested");
                        }
                    }
                    else
                    {
                        Console.WriteLine("Error:");
                        Console.WriteLine(response);
                    }
                }
                else
                {
                    Console.WriteLine(string.Format("Invalid phone number for {0}", country));
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
 /// <summary>
 /// Get region code list
 /// </summary>
 /// <returns></returns>
 protected virtual List <string> GetRegionCodeList()
 {
     if (RegionCodes.Any())
     {
         return(RegionCodes);
     }
     return(!string.IsNullOrWhiteSpace(RegionCode)
         ? new List <string> {
         RegionCode
     }
         : new List <string> {
         CountryHelper.GetRegionCode(Country, BelongsToCountry)
     });
 }
Ejemplo n.º 24
0
        public ActionResult <CountryInfoDto> CountryInfo(
            [FromRoute][Required] string countryCode = null)
        {
            var country = new Country.CountryProvider().GetCountry(countryCode);

            if (country == null)
            {
                return(this.StatusCode(StatusCodes.Status404NotFound));
            }

            var countryInfo = CountryHelper.Convert(country);

            return(this.StatusCode(StatusCodes.Status200OK, countryInfo));
        }
Ejemplo n.º 25
0
        /// <summary>
        /// Does this provider include such region?
        /// </summary>
        /// <param name="regionCode"></param>
        /// <returns></returns>
        public virtual bool DoesIncludeRegion(string regionCode)
        {
            var regions = IncludeRegions().ToList();

            if (!regions.Any())
            {
                return(true);
            }
            if (string.IsNullOrWhiteSpace(regionCode))
            {
                return(false);
            }
            regionCode = CountryHelper.FixRegionCode(Country, regionCode);
            return(regions.Any(x => x == regionCode));
        }
Ejemplo n.º 26
0
        // GET: Branch

        public ActionResult Index()
        {
            //BranchMasterEntity _BranchMasterEntity = new BranchMasterEntity();
            //return View(_BranchMasterEntity);

            BranchMasterEntity _BranchMasterEntity = new BranchMasterEntity();

            ViewBag.BranchDetails = _BranchMasterEntity;

            ViewBag.CountryList = CountryHelper.GetCountryData();

            ViewBag.StateByCountryList = StateByCountryHelper.GetStateByCountryData("0");

            return(View());
        }
Ejemplo n.º 27
0
 protected override void InitializeControls(GenericContainer container)
 {
     if (CheckIfConfiguredShowErrorIfNot())
     {
         HideShippingRelatedInfoIfCartDoesntHaveShippableItems();
         List <CountryElement> countries = CountryHelper.GetCountriesList();
         BindCountryDropDown(countries, CountryShipping);
         BindCountryDropDown(countries, CountryBilling);
         BindStateDropDown(StateShipping);
         BindStateDropDown(StateBilling);
         BindUserProfileInformation();
         BindShippingMethods(ShippingMethodsList);
         BindPreviewGrid(ShoppingCartGrid);
         AttachPlacerOrderButtonEvent();
     }
 }
Ejemplo n.º 28
0
        /// <summary>
        /// Prepares the view bags.
        /// </summary>
        private void PrepareViewBags()
        {
            var types = new List <EnumTypePerson>();

            types.Add(EnumTypePerson.NATURAL);
            types.Add(EnumTypePerson.LEGAL);
            ViewBag.Types = types;

            var genders = new List <EnumGender>();

            genders.Add(EnumGender.MALE);
            genders.Add(EnumGender.FEMALE);
            ViewBag.Genders = genders;

            ViewBag.Countries = CountryHelper.GetAllCountries();
        }
Ejemplo n.º 29
0
        private void btnExist_Click(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(this.txtPhoneNumber.Text))
            {
                try
                {
                    this.number = this.txtPhoneNumber.Text;
                    this.TrimNumber();
                    WhatsAppApi.Parser.PhoneNumber phonenumber = new WhatsAppApi.Parser.PhoneNumber(this.number);
                    this.identity = WhatsAppApi.Register.WhatsRegisterV2.GenerateIdentity(phonenumber.Number, this.txtPassword.Text);
                    this.cc       = phonenumber.CC;
                    this.phone    = phonenumber.Number;

                    CountryHelper chelp   = new CountryHelper();
                    string        country = string.Empty;
                    if (!chelp.CheckFormat(this.cc, this.phone, out country))
                    {
                        string msg = string.Format("Provided number does not match any known patterns for {0}", country);
                        this.Notify(msg);
                        return;
                    }
                }
                catch (Exception ex)
                {
                    string msg = String.Format("Error: {0}", ex.Message);
                    this.Notify(msg);
                    return;
                }
                string response = null;
                this.password = WhatsAppApi.Register.WhatsRegisterV2.RequestExist(this.number, out response, this.identity);

                if (!string.IsNullOrEmpty(this.password))
                {
                    //password received
                    this.OnReceivePassword();
                }
                else
                {
                    string msg = string.Format("Could not verify existing registration\r\n{0}", response);
                    this.Notify(msg);
                }
            }
            else
            {
                this.Notify("Please enter a phone number");
            }
        }
Ejemplo n.º 30
0
        public void Execute(object parameter)
        {
            //registriation viewmodel
            RegistriationViewModel registriationViewModel = new RegistriationViewModel();
            CountryHelper          countryHelper          = new CountryHelper();

            registriationViewModel.RegionInfos = countryHelper.GetCountries();
            registriationViewModel.CountryName = "Azerbaijan";
            var phoneCode = countryHelper.GetCountryPhoneCode(registriationViewModel.CountryName);

            registriationViewModel.PhoneCode          = phoneCode;
            registriationViewModel.VerifyStateContent = "PhoneNumber";
            RegistriationUserControl registriationUserControl = new RegistriationUserControl(registriationViewModel);

            LoginViewModel.MyGrid.Children.Clear();
            LoginViewModel.MyGrid.Children.Add(registriationUserControl);
        }