コード例 #1
0
        // GET: CV_Generator
        public ActionResult Index()
        {
            CV_ViewModel cvModel = new CV_ViewModel();


            return(View(cvModel));
        }
コード例 #2
0
        public ActionResult GenerateCV(CV_ViewModel model)
        {
            if (ModelState.IsValid)
            {
            }


            return(View(model));
        }
コード例 #3
0
        // GET: CandidateList
        public ActionResult Index()
        {
            CV_ViewModel cvModel = new CV_ViewModel();

            using (ApplicationDbContext data = new ApplicationDbContext())
            {
                var CandicateResults = from a in data.Candidates select a;

                cvModel.CandidateList = CandicateResults.ToList <Candidate>();
            }

            return(View("Index", cvModel));
        }
コード例 #4
0
        public ActionResult SaveData(CV_ViewModel cvModel, string ButtonName)
        {
            if (Session["Strengths"] != null)
            {
                cvModel.StrengthList = new List <Strength>();
                cvModel.StrengthList.AddRange((List <Strength>)Session["Strengths"]);
            }

            if (Session["Achievements"] != null)
            {
                cvModel.AchievementList = new List <Achievement>();
                cvModel.AchievementList.AddRange((List <Achievement>)Session["Achievements"]);
            }

            if (Session["Skills"] != null)
            {
                cvModel.SkillList = new List <Skill>();
                cvModel.SkillList.AddRange((List <Skill>)Session["Skills"]);
            }

            if (Session["Languages"] != null)
            {
                cvModel.LanguageList = new List <Language>();
                cvModel.LanguageList.AddRange((List <Language>)Session["Languages"]);
            }

            if (Session["Qualifications"] != null)
            {
                cvModel.QualificationList = new List <Qualification>();
                cvModel.QualificationList.AddRange((List <Qualification>)Session["Qualifications"]);
            }

            if (Session["WorkExperiences_Summary"] != null)
            {
                cvModel.WorkExperience_SummaryList = new List <WorkExperienceSummary>();
                cvModel.WorkExperience_SummaryList.AddRange((List <WorkExperienceSummary>)Session["WorkExperiences_Summary"]);
            }

            if (Session["Comp1Responsibilities"] != null)
            {
                cvModel.Comp1ResponsibilityList = new List <Company1Responsibility>();
                cvModel.Comp1ResponsibilityList.AddRange((List <Company1Responsibility>)Session["Comp1Responsibilities"]);
            }

            if (Session["Comp2Responsibilities"] != null)
            {
                cvModel.Comp2ResponsibilityList = new List <Company2Responsibility>();
                cvModel.Comp2ResponsibilityList.AddRange((List <Company2Responsibility>)Session["Comp2Responsibilities"]);
            }

            if (Session["References"] != null)
            {
                cvModel.ReferenceList = new List <Reference>();
                cvModel.ReferenceList.AddRange((List <Reference>)Session["References"]);
            }

            if (ButtonName == "Add Strength to List")
            {
                if (cvModel.StrengthList == null)
                {
                    cvModel.StrengthList = new List <Strength>();
                    cvModel.StrengthList.Add(cvModel.SingleStrength);
                    Session["Strengths"]   = cvModel.StrengthList;
                    cvModel.SingleStrength = new Strength();
                    return(View("Index", cvModel));
                }
                else
                {
                    cvModel.StrengthList.Add(cvModel.SingleStrength);
                    Session["Strengths"]   = cvModel.StrengthList;
                    cvModel.SingleStrength = new Strength();
                    return(View("Index", cvModel));
                }
            }
            else if (ButtonName == "Add Achievement to List")
            {
                if (cvModel.AchievementList == null)
                {
                    cvModel.AchievementList = new List <Achievement>();
                    cvModel.AchievementList.Add(cvModel.SingleAchievement);
                    Session["Achievements"]   = cvModel.AchievementList;
                    cvModel.SingleAchievement = new Achievement();
                    return(View("Index", cvModel));
                }
                else
                {
                    cvModel.AchievementList.Add(cvModel.SingleAchievement);
                    Session["Achievements"]   = cvModel.AchievementList;
                    cvModel.SingleAchievement = new Achievement();
                    return(View("Index", cvModel));
                }
            }
            else if (ButtonName == "Add Skill to List")
            {
                if (cvModel.SkillList == null)
                {
                    cvModel.SkillList = new List <Skill>();
                    cvModel.SkillList.Add(cvModel.SingleSkill);
                    Session["Skills"]   = cvModel.SkillList;
                    cvModel.SingleSkill = new Skill();
                    return(View("Index", cvModel));
                }
                else
                {
                    cvModel.SkillList.Add(cvModel.SingleSkill);
                    Session["Skills"]   = cvModel.SkillList;
                    cvModel.SingleSkill = new Skill();
                    return(View("Index", cvModel));
                }
            }
            else if (ButtonName == "Add Language to List")
            {
                if (cvModel.LanguageList == null)
                {
                    cvModel.LanguageList = new List <Language>();
                    cvModel.LanguageList.Add(cvModel.SingleLanguage);
                    Session["Languages"]   = cvModel.LanguageList;
                    cvModel.SingleLanguage = new Language();
                    return(View("Index", cvModel));
                }
                else
                {
                    cvModel.LanguageList.Add(cvModel.SingleLanguage);
                    Session["Languages"]   = cvModel.LanguageList;
                    cvModel.SingleLanguage = new Language();
                    return(View("Index", cvModel));
                }
            }
            else if (ButtonName == "Add Qualification to List")
            {
                if (cvModel.QualificationList == null)
                {
                    cvModel.QualificationList = new List <Qualification>();
                    cvModel.QualificationList.Add(cvModel.SingleQualification);
                    Session["Qualifications"]   = cvModel.QualificationList;
                    cvModel.SingleQualification = new Qualification();
                    return(View("Index", cvModel));
                }
                else
                {
                    cvModel.QualificationList.Add(cvModel.SingleQualification);
                    Session["Qualifications"]   = cvModel.QualificationList;
                    cvModel.SingleQualification = new Qualification();
                    return(View("Index", cvModel));
                }
            }
            else if (ButtonName == "Add Summary to List")
            {
                if (cvModel.WorkExperience_SummaryList == null)
                {
                    cvModel.WorkExperience_SummaryList = new List <WorkExperienceSummary>();
                    cvModel.WorkExperience_SummaryList.Add(cvModel.SingleWorkExperience_Summary);
                    Session["WorkExperiences_Summary"]   = cvModel.WorkExperience_SummaryList;
                    cvModel.SingleWorkExperience_Summary = new WorkExperienceSummary();
                    return(View("Index", cvModel));
                }
                else
                {
                    cvModel.WorkExperience_SummaryList.Add(cvModel.SingleWorkExperience_Summary);
                    Session["WorkExperiences_Summary"]   = cvModel.WorkExperience_SummaryList;
                    cvModel.SingleWorkExperience_Summary = new WorkExperienceSummary();
                    return(View("Index", cvModel));
                }
            }
            else if (ButtonName == "Add CO.1 Responsibility to List")
            {
                if (cvModel.Comp1ResponsibilityList == null)
                {
                    cvModel.Comp1ResponsibilityList = new List <Company1Responsibility>();
                    cvModel.Comp1ResponsibilityList.Add(cvModel.Comp1SingleResponsibility);
                    Session["Comp1Responsibilities"]  = cvModel.Comp1ResponsibilityList;
                    cvModel.Comp1SingleResponsibility = new Company1Responsibility();
                    return(View("Index", cvModel));
                }
                else
                {
                    cvModel.Comp1ResponsibilityList.Add(cvModel.Comp1SingleResponsibility);
                    Session["Comp1Responsibilities"]  = cvModel.Comp1ResponsibilityList;
                    cvModel.Comp1SingleResponsibility = new Company1Responsibility();
                    return(View("Index", cvModel));
                }
            }
            else if (ButtonName == "Add CO.2 Responsibility to List")
            {
                if (cvModel.Comp2ResponsibilityList == null)
                {
                    cvModel.Comp2ResponsibilityList = new List <Company2Responsibility>();
                    cvModel.Comp2ResponsibilityList.Add(cvModel.Comp2SingleResponsibility);
                    Session["Comp2Responsibilities"]  = cvModel.Comp2ResponsibilityList;
                    cvModel.Comp2SingleResponsibility = new Company2Responsibility();
                    return(View("Index", cvModel));
                }
                else
                {
                    cvModel.Comp2ResponsibilityList.Add(cvModel.Comp2SingleResponsibility);
                    Session["Comp2Responsibilities"]  = cvModel.Comp2ResponsibilityList;
                    cvModel.Comp2SingleResponsibility = new Company2Responsibility();
                    return(View("Index", cvModel));
                }
            }

            else if (ButtonName == "Add Reference to List")
            {
                if (cvModel.ReferenceList == null)
                {
                    cvModel.ReferenceList = new List <Reference>();
                    cvModel.ReferenceList.Add(cvModel.SingleReference);
                    Session["References"]   = cvModel.ReferenceList;
                    cvModel.SingleReference = new Reference();
                    return(View("Index", cvModel));
                }
                else
                {
                    cvModel.ReferenceList.Add(cvModel.SingleReference);
                    Session["References"]   = cvModel.ReferenceList;
                    cvModel.SingleReference = new Reference();
                    return(View("Index", cvModel));
                }
            }
            else if (ButtonName == "Save Profile")
            {
                using (ApplicationDbContext data = new ApplicationDbContext())
                {
                    Candidate candidate = new Candidate();

                    candidate.FirstName                  = cvModel.FirstName;
                    candidate.LastName                   = cvModel.LastName;
                    candidate.IDNumber                   = cvModel.IDNumber;
                    candidate.PhoneNumber                = cvModel.PhoneNumber;
                    candidate.Email                      = cvModel.Email;
                    candidate.CountryOfBirth             = cvModel.CountryOfBirth;
                    candidate.BEEStatus                  = cvModel.BEEStatus;
                    candidate.Gender                     = cvModel.Gender;
                    candidate.ProfileStatement           = cvModel.ProfileStatement;
                    candidate.StrengthList               = cvModel.StrengthList;
                    candidate.AchievementList            = cvModel.AchievementList;
                    candidate.SkillList                  = cvModel.SkillList;
                    candidate.LanguageList               = cvModel.LanguageList;
                    candidate.QualificationList          = cvModel.QualificationList;
                    candidate.WorkExperience_SummaryList = cvModel.WorkExperience_SummaryList;

                    candidate.ReferenceList = cvModel.ReferenceList;

                    candidate.PermanentPosition = cvModel.PermanentPosition;
                    candidate.ContractPosition  = cvModel.ContractPosition;
                    candidate.wasPermanent      = cvModel.wasPermanent;

                    candidate.CommencementAvailability = cvModel.CommencementAvailability;
                    candidate.LeavePlanned             = cvModel.LeavePlanned;
                    candidate.LeavePlannedDate         = cvModel.LeavePlannedDate;
                    candidate.Disclosures = cvModel.Disclosures;
                    candidate.Comments    = cvModel.Comments;

                    candidate.CompanyOne = cvModel.CompanyOne;
                    candidate.CompanyTwo = cvModel.CompanyTwo;

                    candidate.CompanyOne.Comp1ResponsibilityList = cvModel.Comp1ResponsibilityList;
                    candidate.CompanyTwo.Comp2ResponsibilityList = cvModel.Comp2ResponsibilityList;

                    if (candidate.IDNumber == null)
                    {
                        TempData["Incomplete"] = true;
                    }

                    data.Candidates.Add(candidate);

                    data.SaveChanges();
                }
                return(View("Index", cvModel));
            }
            else
            {
                return(View("Index", cvModel));
            }
        }
コード例 #5
0
        public ActionResult Index(CV_ViewModel cvModel, int id)
        {
            using (ApplicationDbContext data = new ApplicationDbContext())
            {
                var CandicateResults             = (from a in data.Candidates where a.CandidateID == id select a).SingleOrDefault();
                var SkillsResults                = from a in data.Skill where a.CandidateID == id select a;
                var AchievementsResults          = from a in data.Achievement where a.CandidateID == id select a;
                var StrengthsResults             = from a in data.Strength where a.CandidateID == id select a;
                var LanguagesResults             = from a in data.Language where a.CandidateID == id select a;
                var ReferencesResults            = from a in data.Reference where a.CandidateID == id select a;
                var QualificationsResults        = from a in data.Qualification where a.CandidateID == id select a;
                var WorkExperienceSummaryResults = from a in data.WorkExperienceSummary where a.CandidateID == id select a;

                var ContractResults  = (from a in data.Contract where a.ContractID == CandicateResults.ContractID select a).SingleOrDefault();
                var PermanentResults = (from a in data.Permanent where a.PermanentID == CandicateResults.PermanentID select a).SingleOrDefault();

                var Company1Results = (from a in data.WorkExperienceDetailed_CompanyOne where a.Company1WorkExpDetID == CandicateResults.Company1WorkExpDetID select a).SingleOrDefault();
                var Company1ResponsibilityResults = from a in data.Company1Responsibility where a.Company1WorkExpDetID == Company1Results.Company1WorkExpDetID select a;

                var Company2Results = (from a in data.WorkExperienceDetailed_CompanyTwo where a.Company2WorkExpDetID == CandicateResults.Company2WorkExpDetID select a).SingleOrDefault();
                var Company2ResponsibilityResults = from a in data.Company2Responsibility where a.Company2WorkExpDetID == Company2Results.Company2WorkExpDetID select a;

                cvModel.FirstName                = CandicateResults.FirstName;
                cvModel.LastName                 = CandicateResults.LastName;
                cvModel.CountryOfBirth           = CandicateResults.CountryOfBirth;
                cvModel.BEEStatus                = CandicateResults.BEEStatus;
                cvModel.Gender                   = CandicateResults.Gender;
                cvModel.ProfileStatement         = CandicateResults.ProfileStatement;
                cvModel.CommencementAvailability = CandicateResults.CommencementAvailability;
                cvModel.Disclosures              = CandicateResults.Disclosures;
                cvModel.Comments                 = CandicateResults.Comments;
                cvModel.LeavePlanned             = CandicateResults.LeavePlanned;
                cvModel.LeavePlannedDate         = CandicateResults.LeavePlannedDate;
                cvModel.IDNumber                 = CandicateResults.IDNumber;

                //cvModel.ContractPosition = new Contract();
                cvModel.ContractPosition = ContractResults;

                //cvModel.PermanentPosition = new Permanent();
                cvModel.PermanentPosition = PermanentResults;

                cvModel.CompanyOne = new WorkExperienceDetailed_CompanyOne();
                cvModel.CompanyOne = Company1Results;
                cvModel.Comp1ResponsibilityList = new List <Company1Responsibility>();
                cvModel.Comp1ResponsibilityList = Company1ResponsibilityResults.ToList();

                cvModel.CompanyTwo = new WorkExperienceDetailed_CompanyTwo();
                cvModel.CompanyTwo = Company2Results;
                cvModel.Comp2ResponsibilityList = new List <Company2Responsibility>();
                cvModel.Comp2ResponsibilityList = Company2ResponsibilityResults.ToList();

                cvModel.SkillList = new List <Skill>();
                cvModel.SkillList = SkillsResults.ToList();

                cvModel.WorkExperience_SummaryList = new List <WorkExperienceSummary>();
                cvModel.WorkExperience_SummaryList = WorkExperienceSummaryResults.ToList();

                cvModel.AchievementList = new List <Achievement>();
                cvModel.AchievementList = AchievementsResults.ToList();

                cvModel.LanguageList = new List <Language>();
                cvModel.LanguageList = LanguagesResults.ToList();

                cvModel.StrengthList = new List <Strength>();
                cvModel.StrengthList = StrengthsResults.ToList();

                cvModel.QualificationList = new List <Qualification>();
                cvModel.QualificationList = QualificationsResults.ToList();

                cvModel.ReferenceList = new List <Reference>();
                cvModel.ReferenceList = ReferencesResults.ToList();
            }

            return(View("Khono", cvModel));
        }
コード例 #6
0
        public ActionResult PopulateCV(int id, string ButtonName, CV_ViewModel cvModel)
        {
            if (ButtonName == "Generate Khonology CV")
            {
                using (ApplicationDbContext data = new ApplicationDbContext())
                {
                    var CandicateResults = (from a in data.Candidates
                                            .Include("CompanyOne.Comp1ResponsibilityList")
                                            .Include("CompanyTwo.Comp2ResponsibilityList")
                                            .Include("SkillList")
                                            .Include("AchievementList")
                                            .Include("StrengthList")
                                            .Include("LanguageList")
                                            .Include("ReferenceList")
                                            .Include("QualificationList")
                                            .Include("WorkExperience_SummaryList")
                                            .Include("CompanyOne")
                                            .Include("CompanyTwo")
                                            .Include("PermanentPosition")
                                            .Include("ContractPosition")
                                            where a.CandidateID == id
                                            select a).SingleOrDefault();

                    //return View("Khonology", CandicateResults);
                    return(new Rotativa.ViewAsPdf("Khonology", CandicateResults));
                }
            }
            else if (ButtonName == "Generate Optim CV")
            {
                using (ApplicationDbContext data = new ApplicationDbContext())
                {
                    var CandicateResults = (from a in data.Candidates
                                            .Include("CompanyOne.Comp1ResponsibilityList")
                                            .Include("CompanyTwo.Comp2ResponsibilityList")
                                            .Include("SkillList")
                                            .Include("AchievementList")
                                            .Include("StrengthList")
                                            .Include("LanguageList")
                                            .Include("ReferenceList")
                                            .Include("QualificationList")
                                            .Include("WorkExperience_SummaryList")
                                            .Include("CompanyOne")
                                            .Include("CompanyTwo")
                                            .Include("PermanentPosition")
                                            .Include("ContractPosition")
                                            where a.CandidateID == id
                                            select a).SingleOrDefault();


                    //return View("Optim", CandicateResults);
                    return(new Rotativa.ViewAsPdf("Optim", CandicateResults));
                }
            }
            else if (ButtonName == "Submit Review")
            {
                using (ApplicationDbContext data = new ApplicationDbContext())
                {
                    var candidate = (from a in data.Candidates where a.CandidateID == id select a).SingleOrDefault();

                    candidate.isReviewed = cvModel.isReviewed;
                    data.Entry(candidate).Property(m => m.isReviewed).IsModified = true;

                    data.SaveChanges();

                    var CandicateResults = from a in data.Candidates select a;

                    cvModel.CandidateList = CandicateResults.ToList <Candidate>();
                }

                return(View("Index", cvModel));
            }
            else
            {
                using (ApplicationDbContext data = new ApplicationDbContext())
                {
                    var candidate = (from a in data.Candidates where a.CandidateID == id select a).SingleOrDefault();

                    candidate.isApproved = cvModel.isApproved;
                    data.Entry(candidate).Property(m => m.isApproved).IsModified = true;

                    data.SaveChanges();

                    var CandicateResults = from a in data.Candidates select a;

                    cvModel.CandidateList = CandicateResults.ToList <Candidate>();
                }

                return(View("Index", cvModel));
            }
        }