Ejemplo n.º 1
0
        /// <summary>
        /// 报名(填写和编辑报名表)
        /// </summary>
        /// <param name="id">JobId</param>
        /// <returns></returns>
        public ActionResult Enroll(int id)
        {
            var user = this.CurrentUser();

            var job = this.jobStore.Jobs.EnrollableJobs().FirstOrDefault(j => j.Id == id);

            if (job == null)
            {
                return(HttpNotFound());
            }

            //每个招聘计划只允许填写一份报名表。
            if (user.ApplicationForms.Any(a => a.Job.PlanId == job.PlanId))
            {
                return(View("OnlyOneFormPerPlanAllowed"));
            }


            ChineseIDCardNumber number = ChineseIDCardNumber.Parse(user.IDCardNumber);

            //准备下拉框及相关数据
            this.InitModelSelectionData(job, this.ViewData);

            ApplicationFormEditViewModel model = new ApplicationFormEditViewModel()
            {
                Job             = job,
                Resume          = "格式:\r\n 高中  1995.07-1998.09  曲靖一中   学生\r\n",
                Accomplishments = "",
            };

            return(View(model));
        }
Ejemplo n.º 2
0
        public ActionResult Edit(int id)
        {
            var form = this.GetEditableFormOfLoginUser(id);

            if (form == null)
            {
                return(HttpNotFound());
            }

            this.InitModelSelectionData(form.Job, this.ViewData);

            var model = new ApplicationFormEditViewModel
            {
                Job                   = form.Job,
                NativePlace           = form.NativePlace,
                Source                = form.Source,
                PoliticalStatus       = form.PoliticalStatus,
                Health                = form.Health,
                Marriage              = form.Marriage,
                School                = form.School,
                Major                 = form.Major,
                SelectedMajor         = form.SelectedMajor,
                YearOfGraduated       = form.YearOfGraduated,
                EducationalBackground = form.EducationalBackground,
                AcademicCertNumber    = form.AcademicCertNumber,
                Degree                = form.Degree,
                DegreeCertNumber      = form.DegreeCertNumber,
                Resume                = form.Resume,
                Accomplishments       = form.Accomplishments,
            };

            return(View(model));
        }
Ejemplo n.º 3
0
        public async Task <ActionResult> Enroll(int id, ApplicationFormEditViewModel model)
        {
            var user = this.CurrentUser();

            var job = this.jobStore.Jobs.EnrollableJobs().FirstOrDefault(j => j.Id == id);

            if (job == null)
            {
                return(HttpNotFound());
            }

            model.Job = job;

            this.InitModelSelectionData(job, this.ViewData);
            if (!this.ModelState.IsValid)
            {
                return(View(model));
            }

            if (user.ApplicationForms.Any(a => a.Job.PlanId == job.PlanId))
            {
                return(HttpNotFound("您已在此招聘计划中填写过报名表。"));
            }


            var form = new ApplicationForm(job, user)
            {
                NativePlace           = model.NativePlace,
                Source                = model.Source,
                PoliticalStatus       = model.PoliticalStatus,
                Health                = model.Health,
                Marriage              = model.Marriage,
                School                = model.School,
                Major                 = model.Major,
                SelectedMajor         = model.SelectedMajor,
                YearOfGraduated       = model.YearOfGraduated,
                EducationalBackground = model.EducationalBackground,
                AcademicCertNumber    = model.AcademicCertNumber,
                DegreeCertNumber      = model.DegreeCertNumber,
                Degree                = model.Degree,
                Resume                = model.Resume,
                Accomplishments       = model.Accomplishments,
            };

            try
            {
                await this.manager.EnrollAsync(form);

                //转到传送文件。
                return(RedirectToAction("Files", new { id = form.Id }));
            }
            catch (Exception ex)
            {
                this.ModelState.AddModelError("", ex.Message);
                return(View(model));

                throw;
            }
        }
Ejemplo n.º 4
0
        public async Task <ActionResult> Edit(int id, ApplicationFormEditViewModel model)
        {
            var form = this.GetEditableFormOfLoginUser(id);

            if (form == null)
            {
                return(HttpNotFound());
            }

            model.Job = form.Job;
            this.InitModelSelectionData(form.Job, this.ViewData);

            if (!this.ModelState.IsValid)
            {
                return(View(model));
            }

            form.NativePlace           = model.NativePlace;
            form.Source                = model.Source;
            form.PoliticalStatus       = model.PoliticalStatus;
            form.Health                = model.Health;
            form.Marriage              = model.Marriage;
            form.School                = model.School;
            form.Major                 = model.Major;
            form.SelectedMajor         = model.SelectedMajor;
            form.YearOfGraduated       = model.YearOfGraduated;
            form.EducationalBackground = model.EducationalBackground;
            form.AcademicCertNumber    = model.AcademicCertNumber;
            form.Degree                = model.Degree;
            form.DegreeCertNumber      = model.DegreeCertNumber;
            form.Resume                = model.Resume;
            form.Accomplishments       = model.Accomplishments;

            await this.manager.ModifyAsync(form);

            return(RedirectToAction("Detail", new { id = form.Id }));
        }