Пример #1
0
        private async Task SaveGBUserToAJJAsync(GBUser gbUser, JobSeeker jobseeker)
        {
            if (!String.IsNullOrEmpty(gbUser.country))
            {
                var findCountry = await _countryRepository.FindByAsyn(x => x.Name == gbUser.country);

                foreach (var nationality in findCountry)
                {
                    jobseeker.Country = nationality;
                }
            }

            if (jobseeker.Country == null)
            {
                jobseeker.Country = new Country();
            }

            if (!String.IsNullOrEmpty(gbUser.thestate))
            {
                var findCountry = await _provinceRepository.FindByAsyn(x => x.Name_Jp == gbUser.thestate);

                foreach (var prefecture in findCountry)
                {
                    jobseeker.Province = prefecture;
                }
            }

            if (jobseeker.Province == null)
            {
                jobseeker.Province = new Province();
            }

            jobseeker.FirstName    = gbUser.first_name;
            jobseeker.LastName     = gbUser.last_name;
            jobseeker.BirthYear    = gbUser.birth_year;
            jobseeker.BirthMonth   = gbUser.birth_month;
            jobseeker.BirthDay     = gbUser.birth_day;
            jobseeker.OtherCountry = gbUser.thestate_other;
            jobseeker.Origin       = "GB";
            if (!String.IsNullOrEmpty(gbUser.radio_sex))
            {
                if (gbUser.radio_sex.ToLower().Trim() == "male")
                {
                    jobseeker.Gender = 'M';
                }
                else if (gbUser.radio_sex.ToLower().Trim() == "female")
                {
                    jobseeker.Gender = 'F';
                }
            }

            jobseeker.PostalAddrss = gbUser.zip;
            jobseeker.Address      = gbUser.addr1;
            jobseeker.Age          = gbUser.birth_age;
            jobseeker.Visa         = gbUser.visa;
            string visacat = gbUser.visa;
            string subvisa = "";


            if (!String.IsNullOrEmpty(gbUser.vopen1))
            {
                subvisa = gbUser.vopen1;
                jobseeker.SubVisaType = gbUser.vopen1;
            }
            else if (!String.IsNullOrEmpty(gbUser.vopen2))
            {
                if (gbUser.vopen2 == "No")
                {
                    jobseeker.IsPermitToWork = false;
                }
                else
                {
                    jobseeker.IsPermitToWork = true;
                }
            }
            else if (!String.IsNullOrEmpty(gbUser.vopen3))
            {
                if (gbUser.vopen3 == "No")
                {
                    jobseeker.IsPermitToWork = false;
                }
                else
                {
                    jobseeker.IsPermitToWork = true;
                }
            }
            else if (!String.IsNullOrEmpty(gbUser.vopen4))
            {
                if (gbUser.vopen4 == "No")
                {
                    jobseeker.IsPermitToWork = false;
                }
                else
                {
                    jobseeker.IsPermitToWork = true;
                }
            }
            else if (!String.IsNullOrEmpty(gbUser.vopen5))
            {
                subvisa = gbUser.vopen5;
                jobseeker.SubVisaType = gbUser.vopen5;
            }
            else if (!String.IsNullOrEmpty(gbUser.vopen6))
            {
                subvisa = gbUser.vopen6;
                jobseeker.SubVisaType = gbUser.vopen6;
            }

            var visa = _jobSeekerService.GetVisa(visacat, subvisa);

            jobseeker.VisaCategory    = visa;
            jobseeker.VisaExpiryYear  = gbUser.visa_year;
            jobseeker.VisaExpiryMonth = gbUser.visa_month;
            jobseeker.VisaExpiryDay   = gbUser.visa_day;
        }