コード例 #1
0
ファイル: JobInfoController.cs プロジェクト: dhnnjy11/AJJ
        public async Task <IActionResult> IndexAsync()
        {
            var jobs = await _jobsRepository.GetAllAsyn();

            List <JobDetailsViewModel> jobdetailList = new List <JobDetailsViewModel>();

            foreach (var job in jobs)
            {
                var client         = _clientRepository.GetById(job.ClientId);
                var businessStream = _businessStreamRepository.GetById(job.BusinessStreamID);
                var postalcode     = _postalCodeRepository.GetById(job.ClientId);
                //var postalcode = new PostalCode();
                //if (job.PostalCodeId != 0)
                //{
                //    postalcode = _postalCodeRepository.GetById(job.PostalCodeId);
                //}

                //var postalcode = _posta
                JobDetailsViewModel jobTempObj = new JobDetailsViewModel(job, client, businessStream, postalcode);
                jobdetailList.Add(jobTempObj);
            }

            IEnumerable <JobDetailsViewModel> list = jobdetailList.AsEnumerable();

            // return Ok(jobdetailList);
            return(View(list));
        }
コード例 #2
0
        public IActionResult Index(TaxCalculateViewModel lendViewModel)
        {
            // update the database
            var postalCode = _postalCodeRepository.GetById(lendViewModel.SelectedPostalCodeId);

            var incomeTax = _incomeTaxRepository.GetFullIncomeTax(postalCode.IncomeTaxId);

            var result = TaxCalculatorServiceFactory.GetTaxCalculatorService(
                (DataContracts.TaxType)Enum.Parse(typeof(DataContracts.TaxType),
                                                  incomeTax.IncomeTaxType)).Calculate(incomeTax, lendViewModel.TaxableIncome);

            TaxResultViewModel taxResultViewModel = new TaxResultViewModel()
            {
                TaxableIncome = lendViewModel.TaxableIncome,
                TaxAmount     = result.TotalAmount,
                TaxType       = incomeTax.IncomeTaxType
            };

            var log = new TaxQueryLog()
            {
                DateQueried   = DateTime.Now,
                PostCode      = postalCode.PostCode,
                TaxableIncome = lendViewModel.TaxableIncome,
                TaxAmount     = result.TotalAmount
            };

            _taxQueryLogRepository.Create(log);

            return(RedirectToAction("TaxResult", taxResultViewModel));
        }
コード例 #3
0
        public async Task <IActionResult> Update(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }
            var item = await _repo.GetById(id);

            return(View(item));
        }
コード例 #4
0
ファイル: JobController.cs プロジェクト: dhnnjy11/AJJ
        //public async Task<IActionResult> Chiba(int page = 1)
        //{
        //    var jobs = _IJobsRepository.GetJobsByProvince("chiba");
        //    var model = await PagingList.CreateAsync<Job>(jobs, 10, page, "Chiba");
        //    ViewData["TotalJobsFound"] = model.TotalRecordCount;
        //    return View(model);
        //}

        //public async Task<IActionResult> Tokyo(int page = 1)
        //{
        //    var jobs = _IJobsRepository.GetJobsByProvince("tokyo");
        //    var model = await PagingList.CreateAsync<Job>(jobs, 10, page, "tokyo");
        //    ViewData["TotalJobsFound"] = model.TotalRecordCount;
        //    return View(model);
        //}

        //public async Task<IActionResult> Gunma(int page = 1)
        //{
        //    var jobs = _IJobsRepository.GetJobsByProvince("gunma");
        //    var model = await PagingList.CreateAsync<Job>(jobs, 10, page, "Gunma");
        //    ViewData["TotalJobsFound"] = model.TotalRecordCount;
        //    return View(model);
        //}

        //public async Task<IActionResult> Ibaraki(int page = 1)
        //{
        //    var jobs = _IJobsRepository.GetJobsByProvince("ibaraki");
        //    var model = await PagingList.CreateAsync<Job>(jobs, 10, page, "Ibaraki");
        //    ViewData["TotalJobsFound"] = model.TotalRecordCount;
        //    return View(model);
        //}

        //public async Task<IActionResult> Kanagawa(int page = 1)
        //{
        //    var jobs = _IJobsRepository.GetJobsByProvince("kanagawa");
        //    var model = await PagingList.CreateAsync<Job>(jobs, 10, page, "Kanagawa");
        //    ViewData["TotalJobsFound"] = model.TotalRecordCount;
        //    return View(model);
        //}

        //public async Task<IActionResult> Saitma(int page = 1)
        //{
        //    var jobs = _IJobsRepository.GetJobsByProvince("saitma");
        //    var model = await PagingList.CreateAsync<Job>(jobs, 10, page, "Saitma");
        //    ViewData["TotalJobsFound"] = model.TotalRecordCount;
        //    return View(model);
        //}

        //public async Task<IActionResult> Tochigi(int page = 1)
        //{
        //    var jobs = _IJobsRepository.GetJobsByProvince("tochigi");
        //    var model = await PagingList.CreateAsync<Job>(jobs, 10, page, "Tochigi");
        //    ViewData["TotalJobsFound"] = model.TotalRecordCount;
        //    return View(model);
        //}

        //[Authorize(Roles = "candidate")]

        public IActionResult JobDetails(long id, string returnUrl = null)
        {
            Job    job            = _IJobsRepository.GetJobsById(id);
            Client client         = _clientRepository.GetById(job.ClientId);
            var    businessStream = _businessStreamRepository.GetById(job.BusinessStreamID);
            var    postalcode     = new PostalCode();

            if (job.PostalCodeId != 0)
            {
                postalcode = _postalCodeRepository.GetById(job.PostalCodeId);
            }
            JobDetailsViewModel model = new JobDetailsViewModel(job, client, businessStream, postalcode);

            return(View(model));
        }
コード例 #5
0
        public async Task <IActionResult> EditProfile()
        {
            var model = new ClientEditViewModel();
            var user  = await _userManager.GetUserAsync(HttpContext.User);

            var userId   = _userManager.GetUserId(HttpContext.User);
            var username = _userManager.GetUserName(HttpContext.User);

            if (userId != null)
            {
                var client = _clientRepository.GetClientByUserId(userId);

                model.Provinces = await _autoFillService.AddProvinceListAsync();

                model.FirstName   = user.FirstName;
                model.PhoneNumber = user.PhoneNumber;
                model.LastName    = user.LastName;
                model.ClientID    = client.Id;
                model.CompanyName = client.CompanyName;
                //model.ContactPerson = client.ContactPerson;
                model.ClientID      = client.Id;
                model.UserName      = username;
                model.WebsiteUrl    = client.WebsiteUrl;
                model.ContactPerson = client.ContactPerson;
                //model.PhoneNumber = client.ContactNumber;
                model.BusinessStreamID = client.BusinessstreamID;

                PostalCode postalcode = _postalCodeRepository.GetById(client.PostalCodeID);

                string[] postalcodeArry = postalcode.Code.Split("-");
                if (postalcodeArry.Count() > 0)
                {
                    model.PostalAddrss1 = postalcodeArry[0];
                    model.PostalAddrss2 = postalcodeArry[1];
                }
                model.ProvinceID = postalcode.ProvinceID;
                model.Address    = client.Address;
                model.CityName   = client.PostalCode.CityName;
                model.Town       = client.PostalCode.Town;
                //}
            }
            return(View(model));
        }
コード例 #6
0
        public async Task <IActionResult> EditJob(long id)
        {
            ClientJobViewModel model = new ClientJobViewModel();

            model.businessstreams = new List <SelectListItem>();
            model.businessstreams.Add(new SelectListItem
            {
                Value = "",
                Text  = "-- 業界選択 --"
            });

            var businessstreams = _businessRepository.GetAll();

            foreach (var BusinessStrem in businessstreams)
            {
                model.businessstreams.Add(new SelectListItem
                {
                    Value = Convert.ToString(BusinessStrem.Id),
                    Text  = BusinessStrem.Name_jp
                });
            }

            if (model.Provinces.Count == 0)
            {
                model.Provinces = new List <SelectListItem>();
                model.Provinces.Add(new SelectListItem
                {
                    Value = "",
                    Text  = "--Choose--"
                });

                var provinces = _provinceRepository.GetAll();

                foreach (var prov in provinces)
                {
                    model.Provinces.Add(new SelectListItem
                    {
                        Value = Convert.ToString(prov.Id),
                        Text  = prov.Name_Jp
                    });
                }
            }

            Job job           = _jobsRepository.GetJobsById(id);
            var jobCategories = await _jobCategoryRepository.FindByAsyn(x => x.BusinessStreamId == job.BusinessStreamID);

            var postalCode = _postalCodeRepository.GetById(job.PostalCodeId);
            var province   = _provinceRepository.GetById(postalCode.ProvinceID);

            List <SelectListItem> jobCategoryList = new List <SelectListItem>();

            foreach (var jobcategory in jobCategories)
            {
                jobCategoryList.Add(new SelectListItem()
                {
                    Value = Convert.ToString(jobcategory.Id),
                    Text  = jobcategory.CategoryName_JP,
                });
            }
            var postalArry = postalCode.Code.Split('-');

            if (postalArry.Length > 0)
            {
                model.PostalAddrss1 = postalArry[0];
                model.PostalAddrss2 = postalArry[1];
            }
            model.ProvinceID         = province.Id;
            model.CityName           = postalCode.CityName;
            model.Town               = postalCode.Town;
            model.JobCategories      = jobCategoryList;
            model.JobId              = job.Id;
            model.Workinghour        = job.Workinghour;
            model.WorkingDaysPerWeek = job.WorkingdaysPerweek;
            model.JapaneseLevel      = job.JapaneseLevel_Text;
            model.BusinessstreamID   = job.BusinessStreamID;
            model.ClientID           = job.ClientId;
            model.ContractType       = job.ContractType_Text;
            model.Salary_Monthly     = job.Salary_Monthly;
            model.Salary_Hourly      = job.Salary_Hourly;
            model.NeededStaff        = job.NeededStaff;
            model.TransportationFee  = job.Transporationfee;
            model.Address            = job.WorkLocationAddress;
            model.ProvinceName       = job.provinceName;
            model.JobCategoryId      = job.JobTitle;
            model.WorkStartTime      = job.StartWorkingTime;
            model.WorkEndTime        = job.EndWorkingTime;
            model.Status             = job.Status;
            //if (!string.IsNullOrEmpty(job.WorkingTime))
            //{
            //    string []workingtime = job.WorkingTime.Split("-");
            //    if(workingtime.Length > 0)
            //    {
            //        model.WorkStartTime = workingtime[0];
            //        model.WorkEndTime = workingtime[1];
            //    }
            //}
            model.MinAge = job.MinAge;
            model.MaxAge = job.MaxAge;

            //if (!string.IsNullOrEmpty(job.RequiredAge))
            //{
            //    string[] requiredages = job.RequiredAge.Split("-");
            //    if(requiredages.Length > 0)
            //    {
            //        model.MinAge = Convert.ToInt32(requiredages[0]);
            //        model.MaxAge = Convert.ToInt32(requiredages[1]);
            //    }
            //}
            return(View(model));
        }
コード例 #7
0
        public async Task <IActionResult> EditClientAsync(int id)
        {
            Client             client = _clientRepository.GetById(id);
            AddClientViewModel model  = new AddClientViewModel();

            model.Id               = id;
            model.CompanyName      = client.CompanyName;
            model.WebsiteUrl       = client.WebsiteUrl;
            model.ContactEmail     = client.ContactEmail;
            model.ContactPerson    = client.ContactPerson;
            model.ContactNumber    = client.ContactNumber;
            model.BusinessstreamID = client.BusinessstreamID;
            model.Address          = client.Address;
            model.AboutCompany     = client.AboutCompany;

            //model.businessstreams = new List<SelectListItem>();
            //model.businessstreams.Add(new SelectListItem
            //{
            //    Value = "",
            //    Text = "-- Choose Industry --"
            //});

            //var businessstreams = _businessRepository.GetAll();

            //foreach (var BusinessStrem in businessstreams)
            //{
            //    model.businessstreams.Add(new SelectListItem
            //    {
            //        Value = Convert.ToString(BusinessStrem.Id),
            //        Text = BusinessStrem.Name
            //    });
            //}
            model.Provinces = await _autoFillService.AddProvinceListAsync();

            //if (model.Provinces.Count == 0)
            //{
            //    model.Provinces = new List<SelectListItem>();
            //    model.Provinces.Add(new SelectListItem
            //    {
            //        Value = "",
            //        Text = "--Choose--"
            //    });

            //    var provinces = _provinceRepository.GetAll();

            //    foreach (var province in provinces)
            //    {
            //        model.Provinces.Add(new SelectListItem
            //        {
            //            Value = Convert.ToString(province.Id),
            //            Text = province.Name
            //        });
            //    }
            //}
            //model.BusinessstreamID = client.BusinessstreamID;
            //string postalcode = model.PostalAddrss1 + "-" + model.PostalAddrss2;
            PostalCode postalcodeobj = _postalCodeRepository.GetById(client.PostalCodeID);
            string     postalarea    = postalcodeobj.Code.Split('-')[0];
            string     postalcode    = postalcodeobj.Code.Split('-')[1];

            model.PostalAddrss1 = postalarea;
            model.PostalAddrss2 = postalcode;
            model.CityName      = postalcodeobj.CityName;
            model.Town          = postalcodeobj.Town;
            model.ProvinceID    = client.PostalCode.ProvinceID;
            return(View(model));
        }