protected void Submit_Click(object sender, EventArgs e)
    {
        if (IsValid)
        {
            // 1) create CBO instance (the JobApplication object)
            JobApplication applicant = new JobApplication();

            // 2) get the info from the controls
            applicant.Name = FullName.Text;
            applicant.Email = EmailAddress.Text;
            applicant.PhoneNumber = PhoneNumber.Text;

            // get full or part time input
            if (FullOrPartTime.SelectedValue.Equals("Full time"))
            {
                applicant.IsFullTime = true;
            }

            //Get the jobs- I used the generc List<T> in my CBO
            //b/c it's easier to add items than a regular aray

            foreach (ListItem item in Jobs.Items)
            {
                if (item.Selected)
                {
                    applicant.Jobs.Add(item.Value);
                }
            }

            //put the output on the web page, just to show that we were able to create an object
            ShowTheFormResult(applicant);
        }
    }
 public void ShowTheFormResult(JobApplication Applicant)
 {
     string linebreak = "<br />";
     FormResults.Text = "the following object wascreated : " + linebreak;
     FormResults.Text += "Person: " + Applicant.Name;
     FormResults.Text += ", Phone: " + Applicant.PhoneNumber + linebreak;
     FormResults.Text += "Email: " + Applicant.Email + linebreak;
     FormResults.Text += "Number of jobs applied for: " + Applicant.Jobs.Count + linebreak;
 }
示例#3
0
        public async Task <ActionResult> Create(JobApplicationCreateView model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var application = new JobApplication
            {
                JobOfferId   = model.JobOfferId,
                FirstName    = model.FirstName,
                LastName     = model.LastName,
                PhoneNumber  = model.PhoneNumber,
                EmailAddress = model.EmailAddress,
                CoverLetter  = model.CoverLetter,
                DateOfBirth  = model.DateOfBirth
            };

            await _context.JobApplications.AddAsync(application);

            await _context.SaveChangesAsync();

            return(RedirectToAction("Index", "JobOffer"));
        }
        public async Task <ActionResult> SaveForm([FromForm] JobApplication application, IFormFile CV)
        {
            var    offer = context.JobOffers.Include(o => o.Company).Include(o => o.JobApplications).FirstOrDefault(o => o.Id == application.OfferId);
            string type  = "";

            if (CV != null)
            {
                type = CV.ContentType.ToLower();
            }
            if (CV == null || CV.Length == 0 || (type != "application/pdf" && type != "application/msword" && type != "application/vnd.openxmlformats-officedocument.wordprocessingml.document"))
            {
                ModelState.AddModelError("cvMessage", "Upload your CV in one of these formats: PDF, DOC, DOCX");
            }
            else
            {
                if (ModelState.IsValid)
                {
                    string name = application.FirstName + " " + application.LastName + " " + DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss");
                    using (StreamReader streamReader = new StreamReader(CV.OpenReadStream()))
                    {
                        var blob = container.GetBlockBlobReference(name);
                        blob.Properties.ContentType = CV.ContentType;
                        await blob.UploadFromStreamAsync(streamReader.BaseStream);

                        application.CvUrl = blob.Uri.AbsoluteUri;
                    }
                    SendEmail(name);
                    offer.JobApplications.Add(application);
                    context.JobApplications.Add(application);
                    await context.SaveChangesAsync();

                    return(View("~/Views/JobOffer/Details.cshtml", offer));
                }
            }
            return(View("~/Views/JobApplication/Form.cshtml", offer));
        }
        public JobApplication MapJobApplication(IDataReader reader, out int JobKey)
        {
            JobApplication d     = new JobApplication();
            int            index = 0;

            d.ApplicantKey   = reader.GetSafeInt32(index++);
            d.FirstName      = reader.GetSafeString(index++);
            d.LastName       = reader.GetSafeString(index++);
            d.Phone          = reader.GetSafeString(index++);
            d.Email          = reader.GetSafeString(index++);
            d.JoinDate       = reader.GetDateTime(index++);
            d.JobKey         = reader.GetSafeInt32(index++);
            d.CategoryName   = reader.GetSafeString(index++);
            d.ProductionName = reader.GetSafeString(index++);
            d.JobDescription = reader.GetSafeString(index++);
            d.ProductionDate = reader.GetDateTime(index++);
            d.CallTime       = reader.GetSafeString(index++);
            d.TimeCommitment = reader.GetSafeString(index++);
            d.Notes          = reader.GetSafeString(index++);

            JobKey = d.JobKey;

            return(d);
        }
        // GET: JobApplications/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            JobApplication jobApplication = db.JobApplications.Find(id);

            if (jobApplication == null)
            {
                return(HttpNotFound());
            }
            if (User.IsInRole("Employer"))
            {
                if (jobApplication.Replied == true)
                {
                    TempData["Replied"] = "You have already replied to this application.";
                }
            }
            ViewBag.JobAppID = db.JobApplications.Where(i => i.JobApplicationID == id);
            ViewBag.JobID    = new SelectList(db.Jobs, "JobID", "EmployerID", jobApplication.JobID);
            ViewBag.WorkerID = new SelectList(db.Workers, "WorkerID", "WorkerID", jobApplication.WorkerID);
            return(View(jobApplication));
        }
        public async Task <ActionResult> Create(JobApplicationWithOfferName model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            string         nameToSave = Guid.NewGuid().ToString() + DateTime.Now.ToString("_yyyy-MM-dd-HH-mm-ss_") + model.File.FileName;
            CloudBlockBlob blockBlob  = blobContainer.GetBlockBlobReference(nameToSave);

            using (var memoryStream = new MemoryStream())
            {
                model.File.CopyTo(memoryStream);
                byte[] file = memoryStream.ToArray();
                await blockBlob.UploadFromByteArrayAsync(file, 0, file.Length);
            }

            string url = blockBlob.Uri.AbsoluteUri;

            JobApplication jobApplication = new JobApplication
            {
                ContactAgreement = model.ContactAgreement,
                CvUrl            = url,
                DateOfBirth      = model.DateOfBirth,
                EmailAddress     = model.EmailAddress,
                FirstName        = model.FirstName,
                JobOfferId       = model.JobOfferId,
                Lastname         = model.Lastname,
                PhoneNumber      = model.PhoneNumber
            };

            dataContext.JobApplications.Add(jobApplication);
            await dataContext.SaveChangesAsync();

            return(RedirectToAction("Details", "JobOffer", new { id = model.JobOfferId }));
        }
 public ActionResult Apply(int id)
 {
     try
     {
         if (id == 0)
         {
             return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
         }
         JobRequisition job = db.JobRequisitions.Find(id);
         if (job == null)
         {
             return(HttpNotFound());
         }
         var application = new JobApplication();
         //get the details of the applicant
         var IsProfileCompleted = checkalluserfields();
         if (IsProfileCompleted)
         {
             //Display Message to indicate Success
             try
             {
             }
             catch
             {
             }
             //Create new Job Application
         }
         //Obtain List of Fields to be Updated
         //Display Message to indicate Success
         return(View());
     }
     catch
     {
         return(View("Error"));
     }
 }
        public async void GivenRejectJobApplication_WhenRejectingAJobApplication_ThenJobApplicationIsRejected()
        {
            var testGuid   = Guid.NewGuid();
            var testJobApp = new JobApplication(testGuid, Guid.NewGuid(), Guid.NewGuid(), 2);

            //Given
            var mockRepo = Substitute.For <JobApplicationRepository>();

            mockRepo.GetById(testGuid)
            .Returns(Task.FromResult(testJobApp));
            var mockRepoFile = Substitute.For <FileRepository>();

            mockRepo.Update(testJobApp)
            .Returns(Task.FromResult(testJobApp));
            var mockLogger = Substitute.For <ILoggerManager>();

            var _jobApplcaitionService = new JobApplicationService(mockRepo, mockRepoFile, mockLogger);
            //When
            await _jobApplcaitionService.UpdateStatusOfJobApplication(testGuid.ToString(), 3);


            //Then
            Assert.True(testJobApp.StatusId == 3);
        }
示例#10
0
        public ContentResult Apply(FormCollection form)
        {
            JObject json = new JObject();

            json["error"]   = false;
            json["message"] = "";

            string[] keys = new string[] { "id" };

            if (this.HasValues(form, keys))
            {
                if (this.IsLoggedIn() && this.GetAccount().Type == AccountType.Applicant)
                {
                    DBHandler db = new DBHandler();

                    try
                    {
                        JobPosting     job         = new JobPosting(Int32.Parse(form.GetValue("id").AttemptedValue));
                        JobApplication application = new JobApplication();
                        application.JobPosting = job;
                        application.Status     = JobApplicationStatus.Undecided;
                        application.Applicant  = ((Applicant)this.GetAccount().Profile);

                        application.Create();
                        json["message"] = "You have applied for: " + job.JobTitle
                                          + "; please wait for the HR to contact you";
                        using (DataTable dt = db.Execute <DataTable>(
                                   CRUD.READ,
                                   "SELECT E.Profile FROM Employee E INNER JOIN Department D ON E.Department = D.DepartmentID WHERE D.Type = "
                                   + ((int)DepartmentType.HumanResources)))
                        {
                            foreach (DataRow row in dt.Rows)
                            {
                                Notification notifHR = new Notification();
                                notifHR.Account   = new Account().FindByProfile(Int32.Parse(row["Profile"].ToString()));
                                notifHR.TimeStamp = DateTime.Now;
                                notifHR.Status    = NotificationStatus.Unread;
                                notifHR.Message   = "An applicant has applied for the job: <b>" + job.JobTitle + "</b>";

                                notifHR.Create();
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        json["error"]   = true;
                        json["message"] = e.Message;
                    }
                }
                else
                {
                    json["error"]   = true;
                    json["message"] = "You are not authorized to continue";
                }
            }
            else
            {
                json["error"]   = true;
                json["message"] = "Form is incomplete";
            }

            return(Content(json.ToString(), "application/json"));
        }
        public async Task CreateJobApplicationAsync(JobApplication jobApplication)
        {
            await _applicationDbContext.JobApplications.AddAsync(jobApplication);

            await _applicationDbContext.SaveChangesAsync();
        }
 public void Update(JobApplication application)
 {
     _db.Entry(application).State = EntityState.Modified;
 }
示例#13
0
 public async Task CreateApplication(JobApplication newApplication)
 {
     await collection.InsertOneAsync(newApplication);
 }
示例#14
0
 public JobApplicationViewModel(JobApplication jo)
 {
     _jobApp = jo;
 }
示例#15
0
 public void Create(JobApplication jobApplication)
 {
     unitOfWork.JobApplicationRepository.Add(jobApplication);
 }
        /// <summary>
        /// Create JobApplication
        /// </summary>
        /// <param name="model">JobApplication DTO</param>
        /// <param name="userId">User ID</param>
        /// <returns>JobApplication DTO</returns>
        public async Task <JobApplicationMinWithJoRes> CreateAsync(JobApplicationWithJoReq model, int userId)
        {
            JobOffer jobOffer = await _context.JobOffers
                                .Include(jo => jo.Group)
                                .Include(jo => jo.Address)
                                .FirstOrDefaultAsync(jo => jo.JobOfferId == model.JobOfferId);

            // jobOffer not found
            if (jobOffer == null)
            {
                throw new AppLogicException("Nabídka nenalezena");
            }

            Student student = await _context.Students
                              .Include(student => student.User)
                              .Where(student => student.User.UserId == userId)
                              .Include(st => st.JobApplications)
                              .ThenInclude(ja => ja.JobOffer)
                              .FirstOrDefaultAsync();

            // check if job offer start date is in future
            if (jobOffer.Start <= DateTime.UtcNow)
            {
                throw new AppLogicException("Nabídka již započala");
            }

            // check if job offer is not full yet
            int freeSpaces = await _jobOfferService.GetFreeSpacesAsync(jobOffer.JobOfferId);

            if (freeSpaces <= 0)
            {
                throw new AppLogicException("Nejsou žádná volná místa");
            }

            // check if job application for this job offer already exists
            bool applicationExists = await _context.JobApplications.AnyAsync((ja) =>
                                                                             ja.JobOfferId == jobOffer.JobOfferId &&
                                                                             ja.StudentId == student.StudentId);

            if (applicationExists)
            {
                throw new AppLogicException("Přihláška pro tuto nabídku již existuje");
            }

            // check if job application in the same time interval already exists
            foreach (var ja in student.JobApplications)
            {
                if (ja.JobOffer.Start <= jobOffer.End && ja.JobOffer.End >= jobOffer.Start)
                {
                    throw new AppLogicException("Přihláška se překrývá s termínem jiné přihlášky");
                }
            }

            // create job application
            JobApplication jobApplication = new JobApplication
            {
                State    = JobApplicationStates.Pending,
                Student  = student,
                JobOffer = jobOffer
            };

            _context.JobApplications.Add(jobApplication);
            await _context.SaveChangesAsync();

            return(new JobApplicationMinWithJoRes(jobApplication));
        }
示例#17
0
        public JsonResult SubmitPitch(FormCollection fc, long jobId)  //to be scraped
        {
            //check if the user has an active periodic sub, if yes, create the job app with the pitch URL

            //if no sub,redirect to createSub in sub Controller passing the pitchurl and jobAppId. save the job with the sub

            var user = userManager.FindById(User.Identity.GetUserId());

            if (user == null)
            {
                return(Json(new { msg = "You must be logged in" }));
            }
            if (jobSubService.CheckSingleSubscriptionStatus(user))
            {
                var singleSub = uow.jobSubscriptionRepository.GetActiveSingleSubscription(user.Id);
                if (singleSub == null)
                {
                    return(Json(new { msg = "Unable to retrieve your subscription" }));
                }


                //save the pitch and get the location
                string pitchUrl = "";
                //submit jobApp here
                var            job    = uow.jobRepository.Get(jobId);
                JobApplication jobApp = new JobApplication
                {
                    user = user,
                    job  = job,
                    applicationStatus = ApplicationStatus.PendingSubmission,
                    Subscribed        = true,
                    DateCreated       = DateTime.Now,
                    DateModified      = DateTime.Now,
                    pitchLocation     = pitchUrl,
                    //SubscriptionId = singleSub.ID
                };


                jobApplicationService.PostJobApplication(jobApp);
                return(Json(new { subStatus = "1", msg = "Job submitted!" }));
            }
            if (jobSubService.CheckPeriodicSubscriptionStatus(user))
            {
                var periodicSub = uow.jobSubscriptionRepository.GetActivePeriodicSubscription(user.Id);
                if (periodicSub == null)
                {
                    return(Json(new { msg = "Unable to retrieve your subscription" }));
                }


                //save the pitch and get the location
                string pitchUrl = "";
                //submit jobApp here
                var            job    = uow.jobRepository.Get(jobId);
                JobApplication jobApp = new JobApplication
                {
                    user = user,
                    job  = job,
                    applicationStatus = ApplicationStatus.PendingSubmission,
                    Subscribed        = true,
                    DateCreated       = DateTime.Now,
                    DateModified      = DateTime.Now,
                    pitchLocation     = pitchUrl,
                    //SubscriptionId = singleSub.ID
                };

                jobApplicationService.PostJobApplication(jobApp);
                return(Json(new { subStatus = "1", msg = "Job submitted!" }));
            }
            //if we get this far, there's no active subscription
            return(Json(new { subStatus = "0", msg = "No active subscription" }));
            //return RedirectToAction("Create", "JobSubscriptions", new { returnUrl = "" });
        }
示例#18
0
 public void Delete(JobApplication jobApplication)
 {
     Console.Write("Using {0}\n", this.GetType().ToString());
 }
示例#19
0
        public ContentResult CreateSchedule(FormCollection form)
        {
            JObject json = new JObject();

            json["error"]   = false;
            json["message"] = "";

            string[] keys = new string[]
            {
                "start", "id"
            };

            if (this.HasValues(form, keys))
            {
                if (!this.CheckLogin(AccountType.Applicant) && ((Employee)this.GetAccount().Profile).Department.Type
                    == DepartmentType.HumanResources)
                {
                    DateTime Start = DateTime.Parse(form.GetValue("start").AttemptedValue);

                    try
                    {
                        JobApplication a = new JobApplication(Int32.Parse(form.GetValue("id").AttemptedValue), byPrimary: true);
                        if (a.Status != JobApplicationStatus.Schedule)
                        {
                            a.Status = JobApplicationStatus.Schedule;
                            a.Update(false);

                            Schedule sc = new Schedule();
                            sc.JobApplication = a;
                            sc.HR             = ((Employee)this.GetAccount().Profile);
                            sc.TimeStart      = Start;
                            sc.TimeEnd        = Start.AddHours(1);

                            sc.Create();

                            Notification notif = new Notification();
                            notif.Account   = new Account().FindByProfile(a.Applicant.Profile.ProfileID, false);
                            notif.TimeStamp = DateTime.Now;
                            notif.Status    = NotificationStatus.Unread;
                            notif.Message   = "<b>Info: </b> You have been scheduled for an interview with the HR department on "
                                              + Start.ToString("yyyy/MM/dd") + " " + Start.ToString("hh:mm tt") + " - "
                                              + sc.TimeEnd.ToString("hh:mm tt");
                            notif.Create();
                            json["message"] = "Schedule successfully created...";
                        }
                        else
                        {
                            json["error"]   = true;
                            json["message"] = "An interview has already been scheduled for this applicant";
                        }
                    }
                    catch (Exception e)
                    {
                        json["error"]   = true;
                        json["message"] = e.Message;
                    }
                }
                else
                {
                    json["error"]   = true;
                    json["message"] = "You are not authorized to continue";
                }
            }
            else
            {
                json["error"]   = true;
                json["message"] = "Form is incomplete";
            }
            return(Content(json.ToString(), "application/json"));
        }
 public void Add(JobApplication application)
 {
     _db.applications.Add(application);
 }
示例#21
0
        public ContentResult UpdateStatus(FormCollection form)
        {
            JObject json = new JObject();

            json["error"]   = false;
            json["message"] = "";

            string[] keys = new[] { "id", "status" };

            if (this.IsLoggedIn())
            {
                if (this.GetAccount().Type != AccountType.Applicant && ((Employee)this.GetAccount().Profile).Department.Type == DepartmentType.HumanResources)
                {
                    try
                    {
                        JobApplication ja = new JobApplication(Int32.Parse(form.GetValue("id").AttemptedValue), true);
                        ja.Status = (JobApplicationStatus)Int32.Parse(form.GetValue("status").AttemptedValue);
                        ja.Update(false);

                        if (ja.Status == JobApplicationStatus.Rejected)
                        {
                            json["message"] = (int)JobApplicationStatus.Rejected;
                        }
                        else if (ja.Status == JobApplicationStatus.Accepted)
                        {
                            json["message"] = "Accepted";

                            // create employee data containing applicant profile
                            Employee e = new Employee();
                            e.EmploymentDate = DateTime.Now;
                            e.Position       = ja.JobPosting.JobTitle;
                            e.Code           = Guid.NewGuid().ToString();
                            e.Profile        = ja.Applicant.Profile;

                            DBHandler db = new DBHandler();

                            // update applicant account if it exists
                            using (DataTable dt = db.Execute <DataTable>(
                                       CRUD.READ,
                                       "SELECT * FROM Account WHERE Profile = " + ja.Applicant.Profile.ProfileID))
                            {
                                if (dt.Rows.Count == 1)
                                {
                                    Account ac = new Account().FindById(
                                        Int32.Parse(dt.Rows[0]["AccountID"].ToString()),
                                        false);
                                    ac.Type    = AccountType.Employee;
                                    ac.Profile = e;

                                    ac.Update(recursive: false);

                                    Notification notif = new Notification();
                                    notif.Account = ac;
                                    notif.Message =
                                        "Congratulations! You've been approved for employment, please wait for further information, you will be contacted through phone or email.";
                                    notif.Status    = NotificationStatus.Unread;
                                    notif.TimeStamp = DateTime.Now;

                                    notif.Create();
                                }
                            }

                            using (DataTable dt = db.Execute <DataTable>(
                                       CRUD.READ,
                                       "SELECT * FROM Account WHERE Type = " + ((int)AccountType.DepartmentHead)))
                            {
                                if (dt.Rows.Count >= 1)
                                {
                                    Account ac = new Account().FindById(
                                        Int32.Parse(dt.Rows[0]["AccountID"].ToString()),
                                        false);

                                    Notification notif = new Notification();
                                    notif.Account   = ac;
                                    notif.Message   = "Info: An Applicant has been approved for employment";
                                    notif.Status    = NotificationStatus.Unread;
                                    notif.TimeStamp = DateTime.Now;

                                    notif.Create();
                                }
                            }

                            // delete applicant data
                            foreach (JobApplication jobApp in ja.Applicant.GetApplications(ja.Applicant.ApplicantID))
                            {
                                jobApp.Schedule.Delete();
                                jobApp.Delete();
                            }

                            ja.JobPosting.Delete();
                            ja.Applicant.Delete();

                            e.Create();
                            json["message"] = "Applicant is now a company employee";
                        }
                    }
                    catch (Exception e)
                    {
                        json["error"]   = true;
                        json["message"] = e.Message;
                    }
                }
                else
                {
                    json["error"]   = true;
                    json["message"] = "You are not authorized to continue";
                }
            }
            else
            {
                json["error"]   = true;
                json["message"] = "You must be logged in to continue";
            }
            return(Content(json.ToString(), "application/json"));
        }
    // ReSharper disable once FunctionComplexityOverflow
    void Save()
    {
        var objContact = new Candidate
        {
            CandidateId = int.Parse(lblContactId.Text),
            Title = ddlTitle.SelectedValue,
            Forename = txtForename.Text,
            Surname = txtSurname.Text,
            ClientId = int.Parse(txtSelectedCompanyID.Text),
            Employer = txtCompany.Text,
            JobTitle = txtJobTitle.Text,
            Email = txtEmail.Text,
            HomePhone = txtHomePhone.Text,
            WorkPhone = txtWorkPhone.Text,
            Mobile = txtMobile.Text,
            Website = txtWebsite.Text,
            Source = new Source { SourceId = int.Parse(ddlSource.SelectedValue) },
            SourceOther = txtSourceOther.Text,
            LinkedIn = txtLinkedIn.Text,
            Newsletter = rbtnNewsLetterYes.Checked,
            DoNotEmail = rbtnDonotemailYes.Checked,
            MinSalary = int.Parse(ddlMinSalary.SelectedValue),
            MaxSalary = int.Parse(ddlMaxSalary.SelectedValue),
            VacancyType = ddlVacancyType.SelectedValue,
            Hours = ddlHours.SelectedValue,
            PersonalSummary = txtPersonalSummary.Text,
            Location = new Location { LocationId = Convert.ToInt32(txtSelectedLocationID.Text) },
            SectorIds = String.Join(",", chbListSectors.Items.Cast<ListItem>().Where(i => i.Selected).Select(i => i.Value)),
            LastUpdatedBy = LoginUser.GetLoggedInUserId()
        };

        //create job applicaiton object 
        var jobApplication = new JobApplication
        {
            JobApplicationId = -1,
            Candidate = objContact,
            ApplicationStatusId = Convert.ToInt32(ddlApplicationStatus.SelectedValue),
            JobId = Convert.ToInt32(lblJobId.Text),
            UpdatedBy = Convert.ToInt32(lblUserID.Text),
            ApplicationDate = DateTime.Now,
            ContactId = objContact.CandidateId,
            SendConfirmationEmail = rbtnSendEmailYes.Checked,
            UrlReferrer = "http://doris.resonatesearch.co.uk"
        };
        int candidateId;
        int jobApplicationId;
        var response = new JobApplications().AddUpdateJobApplication(jobApplication);
        if (response != null && response.ContactId > 0 && response.JobApplicationId > 0)
        {
            candidateId = response.ContactId;
            jobApplicationId = response.JobApplicationId;
        }
        else
        {
            ulErrors.Controls.Add(new LiteralControl("<li>Error saving the application.</li>"));
            divErrors.Visible = true;
            divSuccess.Visible = false;
            return;
        }

        // upload documents
        var docList = new List<Document>();
        if (FileUploadProfileImage.HasFile)
            docList.Add(new Document { FileName = FileUploadProfileImage.FileName, PostedFile = FileUploadProfileImage.PostedFile, DocumentTypeValue = 3, UploadedBy = Convert.ToInt32(lblUserID.Text) });
        if (FileUploadCv.HasFile)
            docList.Add(new Document { FileName = FileUploadCv.FileName, PostedFile = FileUploadCv.PostedFile, DocumentTypeValue = 4, SubRefId = Convert.ToInt32(lblJobId.Text), UploadedBy = Convert.ToInt32(lblUserID.Text) });
        else
        {
            // get the current cv
            var cvs = Documents.GetDocumentByDocType(new[] { 4 }, candidateId).ToList();
            if (cvs.Count > 0)
            {
                var latestCv = cvs[0];
                docList.Add(new Document { FileName = latestCv.FileName, UploadUrl = latestCv.DownloadUrl, DocumentTypeValue = 4, SubRefId = Convert.ToInt32(lblJobId.Text), UploadedBy = Convert.ToInt32(lblUserID.Text) });
            }
        }
        if (FileUploadCoverLetter.HasFile)
            docList.Add(new Document { FileName = FileUploadCoverLetter.FileName, PostedFile = FileUploadCoverLetter.PostedFile, DocumentTypeValue = 5, SubRefId = Convert.ToInt32(lblJobId.Text), UploadedBy = Convert.ToInt32(lblUserID.Text) });

        if (FileUploadRef.HasFile)
            docList.Add(new Document { FileName = FileUploadRef.FileName, PostedFile = FileUploadRef.PostedFile, DocumentTypeValue = 6, UploadedBy = Convert.ToInt32(lblUserID.Text) });
        //set the ref id and guid
        docList.ForEach(t => { t.DocGuid = Guid.NewGuid().ToString(); t.RefId = candidateId; });
        new Documents().SaveDocuments(docList);
        //save killer questions
        SaveKillerQuestion(jobApplicationId);


        //load
        //  LoadContact(contactId);
    }
示例#23
0
 public ActionResult Applyforjob(int?id, int vcid, Student student, JobApplication jobApplication, Sollicitatiemodel sollicitatiemodel)
 {
     return(View(sollicitatiemodel));
 }
        public async Task <IActionResult> JobApplication(JobApplication application, IFormFile file)
        {
            var user = await _userManager.GetUserAsync(User);

            if (user == null)
            {
                return(RedirectToAction("Error"));
            }

            var vm = new JobApplicationViewModel()
            {
                Application = application
            };

            if (string.IsNullOrEmpty(application.CourseName) || string.IsNullOrEmpty(application.VideoLink) || file == null)
            {
                return(View(vm));
            }



            //Adding file
            if (file.Length > 25 * 1024 * 1024)
            {
                ModelState.AddModelError("fileError", "{{$t('message.largeFileMax25')}}");
                return(View(vm));
            }


            var fileName      = file.FileName;
            var acceptedFiles = new List <string>()
            {
                "application/msword", "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
                "application/vnd.ms-excel", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
                "application/vnd.openxmlformats-officedocument.presentationml.presentation",
                "application/vnd.ms-powerpoint",
                "application/pdf", "application/vnd.geogebra.file", "image/png", "image/jpeg"
            };

            if (!acceptedFiles.Contains(file.ContentType))
            {
                ModelState.AddModelError("fileError", "{{$t('message.fileTypeNotSupported')}}");
                return(RedirectToAction("Error"));
            }


            fileName = Guid.NewGuid().ToString().Split("-")[0] + fileName;


            var          envRoot    = _environment.ContentRootPath;
            const string root       = "wwwroot";
            const string fileFolder = "Files";
            const string contact    = "JobApplicationCvs";


            var fileSaveTargetPath = Path.Combine(envRoot, root, fileFolder, contact, fileName);
            var fileGetPath        = "~/" + fileFolder + "/" + contact + "/" + fileName;

            if (Directory.GetDirectories(envRoot + "/" + root, fileFolder).Length == 0)
            {
                Directory.CreateDirectory(Path.Combine(envRoot + "/" + root + "/" + fileFolder));
            }

            if (Directory.GetDirectories(envRoot + "/" + root + "/" + fileFolder, contact).Length == 0)
            {
                Directory.CreateDirectory(Path.Combine(envRoot + "/" + root + "/" + fileFolder + "/" + contact));
            }



            try
            {
                using (var stream = new FileStream(fileSaveTargetPath, FileMode.Create))
                {
                    file.CopyToAsync(stream).Wait();
                }


                application.CvRootPath = fileSaveTargetPath;
                application.CvWebPath  = fileGetPath;
                application.User       = user;

                if (!application.VideoLink.Contains("http", StringComparison.CurrentCultureIgnoreCase))
                {
                    application.VideoLink = $"https://{application.VideoLink}";
                }

                await _context.AddAsync(application);

                await _context.SaveChangesAsync();

                await _email.JobApplicationReceived(application.Id);

                return(Ok());
            }

            catch (Exception e)
            {
                Console.WriteLine(e);
                return(View(vm));
            }
        }
示例#25
0
 public bool InsertJobApplication(JobApplication jobApplication)
 {
     return(_jobApplicationRepo.InsertJobApplication(jobApplication).Result);
 }
 public JobApplicationSubmittedDomainEvent(JobApplication jobApplication)
 {
     JobApplication = jobApplication;
 }
示例#27
0
 public bool UpdatejobApplication(JobApplication jobApplication)
 {
     return(_jobApplicationRepo.UpdateJobApplication(jobApplication).Result);
 }
 public async Task UpdateJobApplicationAsync(JobApplication jobApplication)
 {
     _applicationDbContext.JobApplications.Update(jobApplication);
     await _applicationDbContext.SaveChangesAsync();
 }
示例#29
0
 public JobApplicationMinWithStudRes(JobApplication jobApplication)
 {
     JobApplicationId = jobApplication.JobApplicationId;
     State            = jobApplication.State;
     Student          = new StudentMinRes(jobApplication.Student);
 }
示例#30
0
 public ActionResult <JobApplication> Post(JobApplication jobApplication)
 {
     _context.Add(jobApplication);
     _context.SaveChanges();
     return(CreatedAtAction(nameof(GetById), new { id = jobApplication.Id }, jobApplication));
 }
示例#31
0
 public JobApplicationMinWithJoRes(JobApplication jobApplication)
 {
     JobApplicationId = jobApplication.JobApplicationId;
     State            = jobApplication.State;
     JobOffer         = new JobOfferMinRes(jobApplication.JobOffer);
 }
        public IHttpActionResult DeleteJobApplication(int id)
        {
            JobApplication jobApplication = db.DeleteJobApplication(id);

            return(Ok(jobApplication));
        }
示例#33
0
 public JobApplicationWithJoRes(JobApplication jobApplication, int freeSpaces)
 {
     JobApplicationId = jobApplication.JobApplicationId;
     State            = jobApplication.State;
     JobOffer         = new JobOfferRes(jobApplication.JobOffer, freeSpaces);
 }