示例#1
0
        public ActionResult Details(int?id = 0)
        {
            if (id == 0)
            {
                return(RedirectToAction("Index"));
            }
            //var entities = new JobDbEntities();
            var entities = new Job_Candidate_Application_Entities();

            Session["hasApplied"] = "";
            //Job jobs = entities.Jobs.Where(x=>x.Job_Id == id).Select(x =>
            //    new Job
            //    )

            Tbl_Jobs jobs  = entities.Tbl_Jobs.Find(id);
            var      user  = new Models.Apply();
            var      email = User.Identity.Name;

            if (jobs == null)
            {
                return(HttpNotFound());
            }
            else if (user.hasApplied(email, jobs.Job_Id) == true)
            {
                Session["hasApplied"] = "You have applied for this job";
            }

            return(View(jobs));
        }
示例#2
0
        public ActionResult Apply(int?id = 0)
        {
            if (id == null)
            {
                return(RedirectToAction("Index", "JobSearch"));
            }

            if (User.Identity.IsAuthenticated)
            {
                var applyJob = new Models.Apply();
                var email    = User.Identity.Name;

                var entities = new Job_Candidate_Application_Entities();

                var job      = entities.Tbl_Jobs.Find(id);
                var userInfo = entities.Tbl_Users.Find(email);

                if (applyJob.hasApplied(email, job.Job_Id) == false)
                {
                    applyJob.JobPosition     = job.Position;
                    applyJob.JobId           = job.Job_Id;
                    applyJob.EmailId         = userInfo.Email_Id;
                    applyJob.FirstName       = userInfo.User_First_Name;
                    applyJob.LastName        = userInfo.User_Last_Name;
                    applyJob.Street          = userInfo.User_Street;
                    applyJob.City            = userInfo.User_City;
                    applyJob.State           = userInfo.User_State;
                    applyJob.Country         = userInfo.User_Country;
                    applyJob.PhoneNumber     = userInfo.User_Phone_Number;
                    applyJob.Skills          = userInfo.Skills;
                    applyJob.ExperienceYears = userInfo.Exp_Years;
                    //if (userInfo.Resume_Upload == null)
                    //{
                    //    applyJob.ResumePath = null;
                    //}
                    //else
                    //{
                    applyJob.ResumePath = userInfo.Resume_Upload;
                    //}

                    //var errors = ModelState.Select(x => x.Value.Errors)
                    //           .where(y => y.count > 0)
                    //           .tolist();

                    return(View(applyJob));
                }
                else
                {
                    Session["submitApplication"] = "You have already applied for the job";
                    return(View("SubmitApplication"));
                }
            }
            else
            {
                return(RedirectToAction("Login", "User"));
            }
        }
示例#3
0
        public async Task <Models.Apply> PostApply(Models.Apply apply)
        {
            UriBuilder builder = new UriBuilder(AppSettings.AppliesEndpoint);
            string     uri     = builder.ToString();

            var token = await _loginService.GetOAuthToken();

            return(await _requestService.PostAsync <Models.Apply, Models.Apply>(uri, apply, token));
        }
示例#4
0
        public ActionResult Apply(Models.Apply applyJob, HttpPostedFileBase resume)
        {
            //var user = new Models.Apply();
            string email           = applyJob.EmailId;
            int    jobId           = applyJob.JobId;
            string firstName       = applyJob.FirstName;
            string lastName        = applyJob.LastName;
            string street          = applyJob.Street;
            string city            = applyJob.City;
            string state           = applyJob.State;
            string country         = applyJob.Country;
            string phoneNumber     = applyJob.PhoneNumber;
            string skills          = applyJob.Skills;
            int?   experienceYears = applyJob.ExperienceYears;

            bool   useExistingResume = applyJob.UseExistingResume;
            string resumePath        = null;

            if (User.Identity.IsAuthenticated)
            {
                if (useExistingResume)
                {
                    var entities = new Job_Candidate_Application_Entities();
                    var user     = entities.Tbl_Users.Find(email);
                    resumePath = user.Resume_Upload;
                }
                else if (resume != null)
                {
                    var entities         = new Job_Candidate_Application_Entities();
                    var user             = entities.Tbl_Users.Find(email);
                    var allowedExtension = new[] { ".pdf", ".txt", ".doc", ".docx" };
                    var model            = new Models.UploadResume();

                    string firstNameInitial = user.User_First_Name[0].ToString(); //user first name initial
                    string date             = DateTime.Now.ToString();            //current date and time to make file unique

                    //remove unsupported characters in file name
                    date = date.Replace('/', '-');
                    date = date.Replace(':', '.');

                    //name of uploaded document
                    string fileName  = Path.GetFileName(resume.FileName);
                    string extension = Path.GetExtension(fileName);

                    //validate extension of uploaded file
                    if (!allowedExtension.Contains(extension))
                    {
                        ModelState.AddModelError("", "Document not supported. Only upload pdf, txt, doc or docx documents only!");

                        if (!String.IsNullOrWhiteSpace(user.Resume_Upload))
                        {
                            applyJob.ResumePath = user.Resume_Upload;
                        }

                        return(View(applyJob));
                    }

                    string tempFileName = fileName;

                    //unique file name
                    fileName = lastName + "_" + firstNameInitial + "_" + date + "_" + tempFileName;

                    resumePath = Path.Combine(Server.MapPath("~/App_Data/Applicant's Resumes"), fileName);
                    resume.SaveAs(resumePath);
                }

                //if (model.StoreResumePathInJobApplicationProfile(email, path))
                //{
                //    return View();
                //}
                //else
                //{
                //    ModelState.AddModelError("", "Error occured in uploading resume. Try again.");
                //    return View();
                //}

                if (ModelState.IsValid)
                {
                    if (applyJob.submitApplication(email, jobId, firstName, lastName, street, city, state, country, phoneNumber, skills, experienceYears, resumePath))
                    {
                        Session["submitApplication"] = "Application was submitted successfully. Thank you for your interest.";
                    }
                    else
                    {
                        Session["submitApplication"] = "There was an error in submitting your application. Please try again. Sorry for the inconvenience";
                    }

                    return(View("SubmitApplication"));
                }
                else
                {
                    ModelState.AddModelError("", "Error submitting application. Make sure required fields are not empty");
                    return(View(applyJob));
                }

                //error tracing
                //var errors = ModelState.Select(x => x.Value.Errors)
                //            .Where(y => y.Count > 0)
                //           .ToList();
            }
            else
            {
                return(RedirectToAction("Index", "JobSearch"));
            }

            return(RedirectToAction("Index", "JobSearch"));
        }
示例#5
0
 public async Task ApplyCommandExecute(Models.Apply apply)
 {
     await _navigation.PushModalAsync(new Views.ApplyPage(_requestService, apply, true));
 }
示例#6
0
 public Task <Models.Apply> PostApply(Models.Apply apply)
 {
     return(Task.FromResult(Applies.First()));
 }
示例#7
0
 public ApplyPage(IRequestService requestService, Models.Apply apply, bool isEvaluation = false)
 {
     InitializeComponent();
     BindingContext = new ViewModels.ApplyViewModel(Navigation, requestService, apply, isEvaluation);
 }