示例#1
0
 public CreateAppVM()
 {
     ApplicationInfo = new Resume();
     States = new List<SelectListItem>();
     Degrees = new List<SelectListItem>();
     Positions = new List<SelectListItem>();
 }
示例#2
0
        public ResumeRepository()
        {
            _resumes.Clear();

            var files = Directory.GetFiles(_filePath);

            foreach (var file in files)
            {
                Resume newResume = new Resume();
                newResume.EmploymentHistory = new List<Employment>();
                newResume.EducationHistory = new List<Education>();

                var reader = File.ReadAllLines(file);

                newResume.ID = int.Parse(reader[0]);
                newResume.FirstName = reader[1];
                newResume.LastName = reader[2];
                newResume.PhoneNumber = reader[3];
                newResume.Email = reader[4];
                newResume.DateOfApplication = DateTime.Parse(reader[5]);
                newResume.Position = reader[6];
                newResume.DesiredSalary = decimal.Parse(reader[7]);

                int lineCount = 9;

                // Line 8 in the text file contain the number of employment entries
                for (int i = 0; i < int.Parse(reader[8]); i++)
                {
                    Employment employment = new Employment();

                    employment.CompanyName = reader[lineCount++];
                    employment.Position = reader[lineCount++];
                    employment.YearsOfEmployment = int.Parse(reader[lineCount++]);
                    employment.JobDescription = reader[lineCount++];

                    newResume.EmploymentHistory.Add(employment);

                }

                int numOfEdu = int.Parse(reader[lineCount]);
                lineCount++;

                for (int i = 0; i < numOfEdu ; i++)
                {
                    Education education = new Education();

                    education.Name = reader[lineCount++];
                    education.Type = reader[lineCount++];
                    education.Description = reader[lineCount++];

                    newResume.EducationHistory.Add(education);

                }

                _resumes.Add(newResume);

            }
        }
        public void Add(Resume newResume)
        {
            // ternary operator is saying:
            // if there are any resumes return the max resume id and add 1 to set our new resume id
            // else set to 1
            newResume.ID = (_resumes.Any()) ? _resumes.Max(r => r.ID) + 1 : 1;

            _resumes.Add(newResume);
        }
示例#4
0
        public ActionResult AddResume(Resume resume)
        {
            if (ModelState.IsValid)
            {
                var repo = Factory.CreateResumeRepository();

                resume.DateOfApplication = DateTime.Now;
                var resumes = repo.GetAll();
                resume.ID = resumes.Max(r => r.ID) + 1;
                repo.Add(resume);
                return View("Result");
            }
            return View("Index");
        }
示例#5
0
        //Add new application
        public Response AddAppToRepo(Resume newApp)
        {
            _repo.AddResume(newApp);

            var appInfo = _repo.GetResumeById(newApp.AppId);

            if (appInfo != null)
            {
                _response.Success = true;
                _response.Message = "You have successfully submitted your application.";
                _response.Application = newApp;
            }
            else
            {
                _response.Success = false;
                _response.Message = "Your application was not submitted.";
            }
            return _response;
        }
示例#6
0
        public void Add(Resume newResume)
        {
            newResume.ID = (_resumes.Any()) ? _resumes.Max(r => r.ID) + 1 : 1;

            _resumes.Add(newResume);
            WriteToFile(newResume);
        }
示例#7
0
        private void WriteToFile(Resume resume)
        {
            string resumeFilePath = _filePath + "Resume" + resume.ID + ".txt";

            if (File.Exists(resumeFilePath))
            {
                File.Delete(resumeFilePath);
            }

            using (var writer = File.CreateText(resumeFilePath))
            {

                writer.WriteLine("{0}", resume.ID);
                writer.WriteLine("{0}", resume.FirstName);
                writer.WriteLine("{0}", resume.LastName);
                writer.WriteLine("{0}", resume.PhoneNumber);
                writer.WriteLine("{0}", resume.Email);
                writer.WriteLine("{0}", resume.DateOfApplication);
                writer.WriteLine("{0}", resume.Position);
                writer.WriteLine("{0}", resume.DesiredSalary);

                // Remove blank entries from list before writing to file
                resume.EmploymentHistory.RemoveAll(r => r.CompanyName == null);

                // Note the number of employment entries in the text file
                writer.WriteLine("{0}", resume.EmploymentHistory.Count);

                foreach (var employer in resume.EmploymentHistory)
                {
                    writer.WriteLine("{0}", employer.CompanyName);
                    writer.WriteLine("{0}", employer.Position);
                    writer.WriteLine("{0}", employer.YearsOfEmployment);
                    writer.WriteLine("{0}", employer.JobDescription);
                }

                // Remove blank entries from list before writing to file
                resume.EducationHistory.RemoveAll(r => r.Name == null);

                // Note the number of education entries in the text file
                writer.WriteLine("{0}", resume.EducationHistory.Count);

                foreach (var education in resume.EducationHistory)
                {
                    writer.WriteLine("{0}", education.Name);
                    writer.WriteLine("{0}", education.Type);
                    writer.WriteLine("{0}", education.Description);
                }
            }
        }
示例#8
0
 public void Edit(Resume resume)
 {
     Delete(resume.ID);
     _resumes.Add(resume);
 }
示例#9
0
 public Response()
 {
     Application = new Resume();
     ApplicationsList = new List<Resume>();
 }
示例#10
0
        public void InitializeMockResumeList()
        {
            Resume newApp = new Resume()
            {
                AppId = 1,
                ApplicantContactInfo = new ContactInfo()
                {
                    FirstName = "Dean",
                    LastName = "Choi",
                    MiddleInitial = "J",
                    Prefix = "Mr.",
                    Email = "*****@*****.**",
                    PhoneNumber = "440-263-5132",
                    Address = new Address()
                    {
                        AddressLine1 = "8993 Crooked Creek Ln",
                        City = "Broadview Heights",
                        State = "OH",
                        Zipcode = "44147"
                    }
                },
                Position = new Position()
                {
                    PositionId = 4,
                    PositionName = "New Victor",
                    Description = "The \"New\" Victor of The Guild",
                    PostedDate = DateTime.Parse("10/01/2015"),
                    ClosingDate = DateTime.Parse("12/01/2015")
                },
                Experiences = new List<Experience>()
                {
                    new Experience()
                    {
                        Company = "National Institues of Health",
                        Title = "Post-bac IRTA",
                        StartDate = DateTime.Parse("08/01/2009"),
                        EndDate = DateTime.Parse("07/01/2010"),
                        Location = new Address()
                        {
                            City = "Bethesda",
                            State = "MD"
                        },
                        Description = "Neuroscience Researcher on TIP39 at the NIMH.",
                        SupervisorName = "Ted Usdin, MD-PhD",
                        SupervisorPhone = "202-867-5309",
                        SupervisorEmail = "*****@*****.**"
                    }
                },
                Education = new List<EducationInfo>()
                {
                    new EducationInfo()
                    {
                        Degree = new Degree()
                        {
                            DegreeAbbr = "B.S.",
                            DegreeName = "Bachelor's of Science"
                        },
                        Institution = "Duke University",
                        Location = new Address()
                        {
                            City = "Durham",
                            State = "NC"
                        },
                        StartDate = DateTime.Parse("08/01/2005"),
                        GraduationDate = DateTime.Parse("05/15/2009"),
                        GPA = 3.75M,
                        Concentration = "Biology & Chemistry"
                    }
                },
                DesiredSalary = 100000,
                AppDate = DateTime.Parse("10/31/2015")
            };

            AppsList.Add(newApp);
        }
示例#11
0
        public List<Resume> GetAllResumes()
        {
            AppsList = new List<Resume>();
            XDocument xDoc = XDocument.Load(RootPath + "Resumes.xml");
            var applications = xDoc.Descendants("resumes");

            foreach (var app in applications.Descendants("resume"))
            {
                Resume resume = new Resume();

                resume.AppId = int.Parse(app.Element("AppID").Value);

                foreach (var info in app.Descendants("ContactInfo"))
                {
                    resume.ApplicantContactInfo.FirstName = info.Element("FirstName").Value;
                    resume.ApplicantContactInfo.LastName = info.Element("LastName").Value;
                    resume.ApplicantContactInfo.MiddleInitial = info.Element("MiddleInitial").Value;
                    resume.ApplicantContactInfo.Prefix = info.Element("Prefix").Value;
                    resume.ApplicantContactInfo.Suffix = info.Element("Suffix").Value;
                    resume.ApplicantContactInfo.Email = info.Element("Email").Value;
                    resume.ApplicantContactInfo.PhoneNumber = info.Element("PhoneNumber").Value;
                }

                foreach (var address in app.Descendants("Address"))
                {
                    resume.ApplicantContactInfo.Address.AddressLine1 = address.Element("AddressLine1").Value;
                    resume.ApplicantContactInfo.Address.AddressLine2 = address.Element("AddressLine2").Value;
                    resume.ApplicantContactInfo.Address.City = address.Element("City").Value;
                    resume.ApplicantContactInfo.Address.State = address.Element("State").Value;
                    resume.ApplicantContactInfo.Address.Zipcode = address.Element("Zipcode").Value;
                }

                foreach (var pos in app.Descendants("Position"))
                {
                    resume.Position.PositionId = int.Parse(pos.Element("PositionID").Value);
                    resume.Position.PositionName = pos.Element("PositionName").Value;
                    resume.Position.Description = pos.Element("Description").Value;
                    resume.Position.PostedDate = DateTime.Parse(pos.Element("PostedDate").Value);
                    //resume.Position.ClosingDate = DateTime.Parse(pos.Element("ClosingDate").Value);
                }

                foreach (var exp in app.Descendants("Experience"))
                {
                    Experience experience = new Experience();
                    List<Experience> experiences = new List<Experience>();

                    experience.Company = exp.Element("Company").Value;
                    experience.Title = exp.Element("Title").Value;
                    experience.StartDate = DateTime.Parse(exp.Element("StartDate").Value);
                    experience.EndDate = DateTime.Parse(exp.Element("EndDate").Value);

                    foreach (var address in exp.Descendants("Location"))
                    {
                        experience.Location.City = address.Element("City").Value;
                        experience.Location.State = address.Element("State").Value;
                    }
                    experience.Description = exp.Element("Description").Value;
                    experience.SupervisorName = exp.Element("SupervisorName").Value;
                    experience.SupervisorPhone = exp.Element("SupervisorPhone").Value;
                    experience.SupervisorEmail = exp.Element("SupervisorEmail").Value;

                    experiences.Add(experience);

                    resume.Experiences = experiences;
                }

                foreach (var edu in app.Descendants("Education"))
                {

                    EducationInfo education = new EducationInfo();
                    List<EducationInfo> educations = new List<EducationInfo>();

                    education.Degree.DegreeAbbr = edu.Element("Degree").Value;
                    education.Institution = edu.Element("Institution").Value;

                    foreach (var address in edu.Elements("Location"))
                    {
                        education.Location.City = address.Element("City").Value;
                        education.Location.State = address.Element("State").Value;
                    }

                    education.StartDate = DateTime.Parse(edu.Element("StartDate").Value);
                    education.GraduationDate = DateTime.Parse(edu.Element("GraduationDate").Value);
                    education.GPA = decimal.Parse(edu.Element("GPA").Value);
                    education.Concentration = edu.Element("Concentration").Value;

                    educations.Add(education);

                    resume.Education = educations;

                }

                resume.DesiredSalary = int.Parse(app.Element("DesiredSalary").Value);
                resume.AppDate = DateTime.Parse(app.Element("AppDate").Value);

                AppsList.Add(resume);
            }

            return AppsList;
        }
示例#12
0
        public void AddResume(Resume newApp)
        {
            XDocument doc = XDocument.Load(RootPath + "Resumes.xml");
            doc.Element("resumes").Add(new XElement("resume",
                                                new XElement("AppID", newApp.AppId),
                                                new XElement("ContactInfo",
                                                    new XElement("FirstName", newApp.ApplicantContactInfo.FirstName),
                                                    new XElement("LastName", newApp.ApplicantContactInfo.LastName),
                                                    new XElement("MiddleInitial", newApp.ApplicantContactInfo.MiddleInitial),
                                                    new XElement("Prefix", newApp.ApplicantContactInfo.Prefix),
                                                    new XElement("Suffix", newApp.ApplicantContactInfo.Suffix),
                                                    new XElement("Email", newApp.ApplicantContactInfo.Email),
                                                    new XElement("PhoneNumber", newApp.ApplicantContactInfo.PhoneNumber)),
                                                new XElement("Address",
                                                    new XElement("AddressLine1", newApp.ApplicantContactInfo.Address.AddressLine1),
                                                    new XElement("AddressLine2", newApp.ApplicantContactInfo.Address.AddressLine2),
                                                    new XElement("City", newApp.ApplicantContactInfo.Address.City),
                                                    new XElement("State", newApp.ApplicantContactInfo.Address.State),
                                                    new XElement("Zipcode", newApp.ApplicantContactInfo.Address.Zipcode)),
                                                new XElement("Position",
                                                     new XElement("PositionID", newApp.Position.PositionId),
                                                     new XElement("PositionName", newApp.Position.PositionName),
                                                     new XElement("Description", newApp.Position.Description),
                                                     new XElement("PostedDate", newApp.Position.PostedDate),
                                                     new XElement("ClosingDate", newApp.Position.ClosingDate)),
                                                new XElement("Experience",
                                                     newApp.Experiences.Select(e => new XElement("Company", e.Company)),
                                                     newApp.Experiences.Select(e => new XElement("Title", e.Title)),
                                                     newApp.Experiences.Select(e => new XElement("StartDate", e.StartDate)),
                                                     newApp.Experiences.Select(e => new XElement("EndDate", e.EndDate)),
                                                new XElement("Location",
                                                     newApp.Experiences.Select(e => new XElement("AddressLine1", e.Location.AddressLine1)),
                                                     newApp.Experiences.Select(e => new XElement("AddressLine2", e.Location.AddressLine2)),
                                                     newApp.Experiences.Select(e => new XElement("City", e.Location.City)),
                                                     newApp.Experiences.Select(e => new XElement("State", e.Location.State)),
                                                     newApp.Experiences.Select(e => new XElement("Zipcode", e.Location.Zipcode))),
                                                    newApp.Experiences.Select(e => new XElement("Description", e.Description)),
                                                    newApp.Experiences.Select(e => new XElement("SupervisorName", e.SupervisorName)),
                                                    newApp.Experiences.Select(e => new XElement("SupervisorPhone", e.SupervisorPhone)),
                                                    newApp.Experiences.Select(e => new XElement("SupervisorEmail", e.SupervisorEmail))),
                                               new XElement("Education",
                                                     newApp.Education.Select(e => new XElement("Degree", e.Degree.DegreeAbbr)),
                                                     newApp.Education.Select(e => new XElement("Institution", e.Institution)),
                                                new XElement("Location",
                                                     newApp.Education.Select(e => new XElement("AddressLine1", e.Location.AddressLine1)),
                                                     newApp.Education.Select(e => new XElement("AddressLine2", e.Location.AddressLine2)),
                                                     newApp.Education.Select(e => new XElement("City", e.Location.City)),
                                                     newApp.Education.Select(e => new XElement("State", e.Location.State)),
                                                     newApp.Education.Select(e => new XElement("Zipcode", e.Location.Zipcode))),
                                                     newApp.Education.Select(e => new XElement("StartDate", e.StartDate)),
                                                     newApp.Education.Select(e => new XElement("GraduationDate", e.GraduationDate)),
                                                     newApp.Education.Select(e => new XElement("GPA", e.GPA)),
                                                     newApp.Education.Select(e => new XElement("Concentration", e.Concentration))),
                                               new XElement("DesiredSalary", newApp.DesiredSalary),
                                               new XElement("AppDate", newApp.AppDate)
                                                ));

            doc.Save(RootPath + "Resumes.xml");

            //AppsList.Add(newApp);
        }
示例#13
0
 //var rootPath = Server.MapPath("~/");
 //http://csharp.net-tutorials.com/xml/introduction/
 //http://forums.asp.net/t/1416938.aspx?How+to+create+add+multiple+nodes+in+xml+file+please+help
 //http://stackoverflow.com/questions/11492705/how-to-create-xml-document-using-xmldocument
 //http://www.dotnetcurry.com/linq/564/linq-to-xml-tutorials-examples
 public void AddResume(Resume newApp)
 {
     throw new NotImplementedException();
 }