private void Validate(InquireModel model, IFormFile uploadedResume)
        {
            if (_resumeValidator.UploadedResumeIsValid(uploadedResume, out var errorMessage))
            {
                model.AttachResume(uploadedResume);
            }
            else
            {
                ModelState.AddModelError("Resume", errorMessage);
            }

            if (!model.Availability.Any(l => l.Checked))
            {
                ModelState.AddModelError(nameof(model.Availability), "At least one value should be selected.");
            }
            else if (model.Availability.Any(l => l.Checked && string.IsNullOrWhiteSpace(l.Hours)))
            {
                ModelState.AddModelError(nameof(model.Availability), $"{DisplayNameHelper.GetDisplayName(model.GetType(), nameof(model.Availability))} is required.");
            }

            if (model.JobType == JobTypeEnum.Doctor.Description() && string.IsNullOrWhiteSpace(model.Specialty))
            {
                ModelState.AddModelError(nameof(model.Specialty), $"{DisplayNameHelper.GetDisplayName(model.GetType(), nameof(model.Specialty))} is required.");
            }

            if (model.WorkExperience == WorkExperienceEnum.Other.ToString() && string.IsNullOrWhiteSpace(model.WorkExperienceOther))
            {
                ModelState.AddModelError(nameof(model.WorkExperienceOther), $"{DisplayNameHelper.GetDisplayName(model.GetType(), nameof(model.WorkExperienceOther))} is required.");
            }
        }
Exemple #2
0
 public static void AttachResume(this InquireModel model, IFormFile uploadedFile)
 {
     if (!string.IsNullOrEmpty(uploadedFile?.FileName) && uploadedFile.Length > 0)
     {
         model.Resume = new EmailAttachment
         {
             Data     = uploadedFile.OpenReadStream(),
             Filename = $"Resume{Path.GetExtension(uploadedFile.FileName)}"
         };
     }
 }
        public async Task <IActionResult> Inquire(InquireModel model, IFormFile resumeUploader)
        {
            await ValidateReCaptcha();

            Validate(model, resumeUploader);

            if (!ModelState.IsValid)
            {
                this.CreateAlert(AlertTypeEnum.Warning, ModelState.Values.SelectMany(v => v.Errors).Select(e => e.ErrorMessage).ToList());
                return(View(nameof(Inquire), model));
            }

            GenerateAndSendEmail(model);
            return(RedirectToAction(nameof(ThankYouController.Index), "ThankYou"));
        }
Exemple #4
0
        private IEnumerable <EmailAttachment> GenerateEmailAttachments(InquireModel model)
        {
            var attachments =
                new List <EmailAttachment>
            {
                GenerateCsvAttachmentForFields(model, "Practice Transitions.csv")
            };

            if (model.Resume != null)
            {
                attachments.Add(model.Resume);
            }

            return(attachments);
        }
        public IActionResult Inquire()
        {
            var model = new InquireModel
            {
                Availability = new List <InquireAvailabilityModel>(
                    Enumerable.Range(1, 7)
                    .Select(dow => new InquireAvailabilityModel
                {
                    Day     = Enum.GetName(typeof(DayOfWeek), dow % 7).ToString(),
                    Hours   = null,
                    Checked = false
                })
                    )
            };

            return(View(nameof(Inquire), model));
        }
Exemple #6
0
        private EmailAttachment GenerateCsvAttachmentForFields(InquireModel model, string filename)
        {
            var type    = model.GetType();
            var columns = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("Type", "Job Hunter"),
                new KeyValuePair <string, string>("Benco Customer Number", string.Empty),
                new KeyValuePair <string, string>("Owner or Associate or Student Resident Associate", string.Empty),
                new KeyValuePair <string, string>(DisplayNameHelper.GetColumnName(type, nameof(model.FirstName)), model.FirstName),
                new KeyValuePair <string, string>(DisplayNameHelper.GetColumnName(type, nameof(model.LastName)), model.LastName),
                new KeyValuePair <string, string>(DisplayNameHelper.GetColumnName(type, nameof(model.ContactNumber)), model.ContactNumber),
                new KeyValuePair <string, string>(DisplayNameHelper.GetColumnName(type, nameof(model.ContactEmail)), model.ContactEmail),
                new KeyValuePair <string, string>("TR Name", string.Empty),
                new KeyValuePair <string, string>("Emailed Date", string.Empty),
                new KeyValuePair <string, string>("Partner Referred", string.Empty),
                new KeyValuePair <string, string>(DisplayNameHelper.GetColumnName(type, nameof(model.HowDidYouHearAboutUs)), EnumHelper.HowDidYouHearAboutUsEnumNameToDescription(model.HowDidYouHearAboutUs)),
                new KeyValuePair <string, string>(DisplayNameHelper.GetColumnName(type, nameof(model.HowDidYouHearAboutUsDetail)), model.HowDidYouHearAboutUsDetail),
                new KeyValuePair <string, string>("Type/Practice(Ops, Collections)", string.Empty),
                new KeyValuePair <string, string>("Date Partner was contacted (cc yourself on email and keep on file)", string.Empty),
                new KeyValuePair <string, string>("Initial Contact Date", DateTime.Now.ToShortDateString()),
                new KeyValuePair <string, string>("Recent Contact Date", string.Empty),
                new KeyValuePair <string, string>("Next Contact Date", string.Empty),
                new KeyValuePair <string, string>("Comment/Next Steps", string.Empty),
                new KeyValuePair <string, string>("Interested State(s)", string.Empty),
                new KeyValuePair <string, string>("Eval Started", string.Empty),
                new KeyValuePair <string, string>("Eval Completed", string.Empty),
                new KeyValuePair <string, string>("Listing Signed", string.Empty),
                new KeyValuePair <string, string>("Listing $", string.Empty),
                new KeyValuePair <string, string>("Closing Date", string.Empty),
                new KeyValuePair <string, string>("Merch Rev Saved or Increased", string.Empty),
                new KeyValuePair <string, string>("Partner Check Received", string.Empty),
                new KeyValuePair <string, string>("Non-Partner Trans", string.Empty),
                new KeyValuePair <string, string>("Bank / Approved/ $ Amount", string.Empty),
                new KeyValuePair <string, string>("Type Of Practice", string.Empty),
                new KeyValuePair <string, string>("Years Practicing", string.Empty),
                new KeyValuePair <string, string>("Years to Ownership", string.Empty),
                new KeyValuePair <string, string>("Grad Date/Age", string.Empty),
                new KeyValuePair <string, string>("Placement Date", string.Empty),
                new KeyValuePair <string, string>("Placed in Benco Office Y/N", string.Empty),
                new KeyValuePair <string, string>("Benco Merch Rev Increase", string.Empty),
                new KeyValuePair <string, string>("Did Placement in Non-Benco Office Result in Merch Rev Y/N", string.Empty),
                new KeyValuePair <string, string>("# of Evaluations", string.Empty),
                new KeyValuePair <string, string>("# of Listings", string.Empty),
                new KeyValuePair <string, string>("# of Closings", string.Empty),
                new KeyValuePair <string, string>("Partner Revenue to Benco", string.Empty),
                new KeyValuePair <string, string>("# of Contacts", string.Empty),
                new KeyValuePair <string, string>("# of Non-Partner Trans", string.Empty),
                new KeyValuePair <string, string>("Practice Name", string.Empty),
                new KeyValuePair <string, string>(DisplayNameHelper.GetColumnName(type, nameof(model.JobLocation)), model.JobLocation),
                new KeyValuePair <string, string>(DisplayNameHelper.GetColumnName(type, nameof(model.Address)), model.Address),
                new KeyValuePair <string, string>("Address 2", string.Empty),
                new KeyValuePair <string, string>("City", string.Empty),
                new KeyValuePair <string, string>("State", string.Empty),
                new KeyValuePair <string, string>("Zip Code", string.Empty),
                new KeyValuePair <string, string>("Asking Price", string.Empty),
                new KeyValuePair <string, string>("Appraisal Needed?", string.Empty),
                new KeyValuePair <string, string>("Min Purchase Amount", string.Empty),
                new KeyValuePair <string, string>("Max Purchase Amount", string.Empty),
                new KeyValuePair <string, string>("Min Collections Amount", string.Empty),
                new KeyValuePair <string, string>("Max Collections Amount", string.Empty),
                new KeyValuePair <string, string>("Working Operatories", string.Empty),
                new KeyValuePair <string, string>("Expandable Operatories", string.Empty),
                new KeyValuePair <string, string>("Doctor Stay On?", string.Empty),
                new KeyValuePair <string, string>(DisplayNameHelper.GetColumnName(type, nameof(model.JobType)), model.JobType),
                new KeyValuePair <string, string>(DisplayNameHelper.GetColumnName(type, nameof(model.Specialty)), model.Specialty),
                new KeyValuePair <string, string>("Job Requirements", string.Empty),
                new KeyValuePair <string, string>(DisplayNameHelper.GetColumnName(type, nameof(model.WorkExperience)), model.WorkExperienceOther ?? model.WorkExperience),
            };

            columns.AddRange(CsvColumnUtility.CreateEmptyDayOfWeekColumns("Schedule"));
            foreach (var availability in model.Availability)
            {
                columns.Add(new KeyValuePair <string, string>($"{availability.Day} Available", $" {availability.Hours ?? string.Empty}"));
            }
            columns.AddRange(new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>(DisplayNameHelper.GetColumnName(type, nameof(model.LinkedInAccount)), model.LinkedInAccount),
                new KeyValuePair <string, string>("Real Estate Option", string.Empty),
                new KeyValuePair <string, string>(DisplayNameHelper.GetColumnName(type, nameof(model.AdditionalNotes)), model.AdditionalNotes)
            });

            return(_emailAttachmentGenerator.GenerateCsvEmailAttachment(columns, filename));
        }