<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace CSDHRProject.Models
{
    public class ViewModel
    {
        public ApplicationUser NewHire { get;set;}
        public RegisterViewModel Account { get; set; }
    }
}<file_sep>﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Mvc;
using CSDHRProject.Models;
using System.IO;

namespace CSDHRProject.Controllers
{
    public class JobApplicationsController : Controller
    {
        private ApplicationDbContext db = new ApplicationDbContext();

        // GET: JobApplications
        public ActionResult Index()
        {
            return View(db.JobApplications.ToList());
        }

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

        // GET: JobApplications/Create
        public ActionResult Create()
        {
            return View();
        }

        // POST: JobApplications/Create
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for 
        // more details see http://go.microsoft.com/fwlink/?LinkId=317598.
        [HttpPost]
        [ValidateAntiForgeryToken]
        public ActionResult Create([Bind(Include = "JobApplicationId,ApplicantFirstName,ApplicantLastName,ApplicantEmail,ResumeFileName,CoverLetterFileName,ApplicantStatus")] JobApplication jobApplication)
        {
            if (ModelState.IsValid)
            {
                db.JobApplications.Add(jobApplication);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(jobApplication);
        }
        
        [HttpPost]
        [ValidateAntiForgeryToken]
        public ActionResult CreateJobApplication(ApplicationEditViewModel jevm)
        {
            JobApplication jobApplication = jevm.Item;
            
            if (ModelState.IsValid)
            {
                if(jevm.ResumeFile != null && jevm.ResumeFile.ContentLength > 0)
                {
                    var applicationFolder = "/Content/JobApplications/";
                    var filename = DateTime.Now.ToBinary().ToString("x") +
                        Path.GetFileName(jevm.ResumeFile.FileName);
                    var path = Path.Combine(Server.MapPath("~" + applicationFolder), filename);
                    jevm.ResumeFile.SaveAs(path);
                    jevm.Item.ResumeFileName = applicationFolder + filename;

                }

                if (jevm.CoverLetterFile != null && jevm.CoverLetterFile.ContentLength > 0)
                {
                    var applicationFolder = "/Content/JobApplications/";
                    var filename = DateTime.Now.ToBinary().ToString("x") +
                        Path.GetFileName(jevm.CoverLetterFile.FileName);
                    var path = Path.Combine(Server.MapPath("~" + applicationFolder), filename);
                    jevm.CoverLetterFile.SaveAs(path);
                    jevm.Item.CoverLetterFileName = applicationFolder + filename;
                }
                db.JobApplications.Add(jobApplication);
                db.SaveChanges();
                return RedirectToAction("Index");
            }
            return RedirectToAction("Index");

        }

        // 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();
            }
            return View(jobApplication);
        }

        // POST: JobApplications/Edit/5
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for 
        // more details see http://go.microsoft.com/fwlink/?LinkId=317598.
        [HttpPost]
        [ValidateAntiForgeryToken]
        public ActionResult Edit([Bind(Include = "JobApplicationId,ApplicantFirstName,ApplicantLastName,ApplicantEmail,ResumeFileName,CoverLetterFileName,ApplicantStatus")] JobApplication jobApplication)
        {
            if (ModelState.IsValid)
            {
                db.Entry(jobApplication).State = EntityState.Modified;
                db.SaveChanges();
                return RedirectToAction("Index");
            }
            return View(jobApplication);
        }

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

        // POST: JobApplications/Delete/5
        [HttpPost, ActionName("Delete")]
        [ValidateAntiForgeryToken]
        public ActionResult DeleteConfirmed(int id)
        {
            JobApplication jobApplication = db.JobApplications.Find(id);
            db.JobApplications.Remove(jobApplication);
            db.SaveChanges();
            return RedirectToAction("Index");
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                db.Dispose();
            }
            base.Dispose(disposing);
        }


  

        // POST: JobApplications/Details/5
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for 
        // more details see http://go.microsoft.com/fwlink/?LinkId=317598.
        [HttpPost]
        [ValidateAntiForgeryToken]
        public ActionResult Details([Bind(Include = "ApplicantStatus")] JobApplication jobApplication)
        {
            if (ModelState.IsValid)
            {
                db.Entry(jobApplication).State = EntityState.Modified;
                db.SaveChanges();
                return RedirectToAction("Index");
            }
            return View(jobApplication);
        }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Mvc;
using CSDHRProject.Models;
using Microsoft.AspNet.Identity.Owin;
using Microsoft.AspNet.Identity;

namespace CSDHRProject.Controllers
{
    public class BenefitRegistrationsController : Controller
    {
        private ApplicationDbContext db = new ApplicationDbContext();

        // GET: BenefitRegistrations
        public ActionResult Index()
        {
      
            return View(db.BenefitRegistrations.ToList());
        }

        // GET: BenefitRegistrations/Details/5
        public ActionResult Details(int? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            BenefitRegistration benefitRegistration = db.BenefitRegistrations.Find(id);
            if (benefitRegistration == null)
            {
                return HttpNotFound();
            }
            return View(benefitRegistration);
        }

        // GET: BenefitRegistrations/Create
        public ActionResult Create()
        {
            return View();
        }

        // POST: BenefitRegistrations/Create
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for 
        // more details see http://go.microsoft.com/fwlink/?LinkId=317598.
        [HttpPost]
        [ValidateAntiForgeryToken]
        public ActionResult Create([Bind(Include = "Id,RealtionshipStatus,BenefitType,Dental,Optical,Paramedical")] BenefitRegistration benefitRegistration)
        {
            if (ModelState.IsValid)
            {
                db.BenefitRegistrations.Add(benefitRegistration);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(benefitRegistration);
        }

        // GET: BenefitRegistrations/Edit/5
        public ActionResult Edit(int? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            BenefitRegistration benefitRegistration = db.BenefitRegistrations.Find(id);
            if (benefitRegistration == null)
            {
                return HttpNotFound();
            }
            return View(benefitRegistration);
        }

        // POST: BenefitRegistrations/Edit/5
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for 
        // more details see http://go.microsoft.com/fwlink/?LinkId=317598.
        [HttpPost]
        [ValidateAntiForgeryToken]
        public ActionResult Edit([Bind(Include = "Id,RealtionshipStatus,BenefitType,Dental,Optical,Paramedical")] BenefitRegistration benefitRegistration)
        {
            if (ModelState.IsValid)
            {
                db.Entry(benefitRegistration).State = EntityState.Modified;
                db.SaveChanges();
                return RedirectToAction("Index");
            }
            return View(benefitRegistration);
        }

        // GET: BenefitRegistrations/Delete/5
        public ActionResult Delete(int? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            BenefitRegistration benefitRegistration = db.BenefitRegistrations.Find(id);
            if (benefitRegistration == null)
            {
                return HttpNotFound();
            }
            return View(benefitRegistration);
        }

        // POST: BenefitRegistrations/Delete/5
        [HttpPost, ActionName("Delete")]
        [ValidateAntiForgeryToken]
        public ActionResult DeleteConfirmed(int id)
        {
            BenefitRegistration benefitRegistration = db.BenefitRegistrations.Find(id);
            db.BenefitRegistrations.Remove(benefitRegistration);
            db.SaveChanges();
            return RedirectToAction("Index");
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                db.Dispose();
            }
            base.Dispose(disposing);
        }
        public ActionResult BenefitSelection()
        {
            return RedirectToAction("/Index");
        }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace CSDHRProject.Models
{
    public class JobPosting
    {

        public int JobPostingId { get; set; }
        public String JobTitle { get; set; }
        public DateTime JobPostingDeadline { get; set; }
        public String JobDepartmentName { get; set; }

        //part for job posting view

       
        public String JobPostingFileName { get; set; }


    }

    public class JobApplication
    {
        public int JobApplicationId { get; set; }
        public String ApplicantFirstName { get; set; }
        public String ApplicantLastName { get; set; }
        public String ApplicantEmail { get; set; }
        public String ResumeFileName { get; set; }
        public String CoverLetterFileName { get; set; }

      
        //part for hr/manager 

        public String ApplicantStatus { get; set; }
        public virtual JobPosting JobPost { get; set; }
    }

    public class JobEditViewModel
    {
        public JobPosting Item { get; set; }
        public HttpPostedFileBase JobPostFile { get; set; }
    }

    public class ApplicationEditViewModel
    {
        public JobApplication Item { get; set; }
        public HttpPostedFileBase ResumeFile { get; set; }

        public HttpPostedFileBase CoverLetterFile { get; set; }
    }
}<file_sep># CSD4354-HRProject
The Phoenix Corporation project for CSD-4354 - Advanced Web Apps using C#, ASP.NET

### HOW TO COMMIT USING VISUAL STUDIO

https://www.visualstudio.com/en-us/docs/git/share-your-code-in-git-vs

### Alternatively if you are having problems with this come see Matt and he will show you how.

# DON'T FORGET TO USE THE BRANCHING MODEL AS SEEN HERE http://nvie.com/posts/a-successful-git-branching-model/

# ATTN: Styles 
This goes inside Views/Shared/_Layout.cshtml (between head tags) => https://pastebin.com/0X4Fu9WH
Use this for the jumbotron (if you need one) => https://pastebin.com/LVjADvSC
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Mvc;
using CSDHRProject.Models;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.Owin;

namespace CSDHRProject.Controllers
{
    public class EmployeeClaimsController : Controller
    {
        private ApplicationDbContext db = new ApplicationDbContext();

        // GET: EmployeeClaims
        public ActionResult Index()
        {
            return View(db.EmployeeClaims.ToList());
        }

        // GET: EmployeeClaims/Details/5
        public ActionResult Details(int? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            EmployeeClaim employeeClaim = db.EmployeeClaims.Find(id);
            if (employeeClaim == null)
            {
                return HttpNotFound();
            }
            return View(employeeClaim);
        }

        // GET: EmployeeClaims/Create
        public ActionResult Create()
        {
            return View();
        }

        // POST: EmployeeClaims/Create
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for 
        // more details see http://go.microsoft.com/fwlink/?LinkId=317598.
        [HttpPost]
        [ValidateAntiForgeryToken]
        public ActionResult Create([Bind(Include = "Id,Name,Amount,Date,Service")] EmployeeClaim employeeClaim)
        {
            if (ModelState.IsValid)
            {
                db.EmployeeClaims.Add(employeeClaim);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(employeeClaim);
        }

        // GET: EmployeeClaims/Edit/5
        public ActionResult Edit(int? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            EmployeeClaim employeeClaim = db.EmployeeClaims.Find(id);
            if (employeeClaim == null)
            {
                return HttpNotFound();
            }
            return View(employeeClaim);
        }

        // POST: EmployeeClaims/Edit/5
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for 
        // more details see http://go.microsoft.com/fwlink/?LinkId=317598.
        [HttpPost]
        [ValidateAntiForgeryToken]
        public ActionResult Edit([Bind(Include = "Id,Name,Amount,Date,Service")] EmployeeClaim employeeClaim)
        {
            if (ModelState.IsValid)
            {
                db.Entry(employeeClaim).State = EntityState.Modified;
                db.SaveChanges();
                return RedirectToAction("Index");
            }
            return View(employeeClaim);
        }

        // GET: EmployeeClaims/Delete/5
        public ActionResult Delete(int? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            EmployeeClaim employeeClaim = db.EmployeeClaims.Find(id);
            if (employeeClaim == null)
            {
                return HttpNotFound();
            }
            return View(employeeClaim);
        }

        // POST: EmployeeClaims/Delete/5
        [HttpPost, ActionName("Delete")]
        [ValidateAntiForgeryToken]
        public ActionResult DeleteConfirmed(int id)
        {
            EmployeeClaim employeeClaim = db.EmployeeClaims.Find(id);
            db.EmployeeClaims.Remove(employeeClaim);
            db.SaveChanges();
            return RedirectToAction("Index");
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                db.Dispose();
            }
            base.Dispose(disposing);
        }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Mvc;
using CSDHRProject.Models;
using System.IO;

namespace CSDHRProject.Controllers
{
    public class JobPostingsController : Controller
    {
        private ApplicationDbContext db = new ApplicationDbContext();

        // GET: JobPostings
        public ActionResult Index()
        {
            return View(db.JobPostings.ToList());
        }

        // GET: JobPostings/Details/5
        public ActionResult Details(int? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            JobPosting jobPosting = db.JobPostings.Find(id);
            if (jobPosting == null)
            {
                return HttpNotFound();
            }
            return View(jobPosting);
        }

        // GET: JobPostings/Create
        public ActionResult Create()
        {
            return View();
        }

        // POST: JobPostings/Create
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for 
        // more details see http://go.microsoft.com/fwlink/?LinkId=317598.
        [HttpPost]
        [ValidateAntiForgeryToken]
        public ActionResult Create([Bind(Include = "JobPostingId,JobTitle,JobPostingDeadline,JobDepartmentName,JobPostingFileName")] JobPosting jobPosting)
        {
            if (ModelState.IsValid)
            {
                db.JobPostings.Add(jobPosting);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(jobPosting);
        }

        [HttpPost]
        [ValidateAntiForgeryToken]
        public ActionResult CreateJobPosting(JobEditViewModel jevm)
        {
            JobPosting jobPosting = jevm.Item;
            if (ModelState.IsValid)
            {
                if(jevm.JobPostFile != null && jevm.JobPostFile.ContentLength > 0)
                {
                    var jobFolder = "/Content/JobPostings/";
                    var filename = DateTime.Now.ToBinary().ToString("X") + Path.GetFileName(jevm.JobPostFile.FileName);
                    var path = Path.Combine(Server.MapPath("~" + jobFolder), filename);
                    jevm.JobPostFile.SaveAs(path);
                    jevm.Item.JobPostingFileName = jobFolder + filename; 
                }
                db.JobPostings.Add(jobPosting);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return RedirectToAction("Index");
        }

        // GET: JobPostings/Edit/5
        public ActionResult Edit(int? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            JobPosting jobPosting = db.JobPostings.Find(id);
            if (jobPosting == null)
            {
                return HttpNotFound();
            }
            return View(jobPosting);
        }

        // POST: JobPostings/Edit/5
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for 
        // more details see http://go.microsoft.com/fwlink/?LinkId=317598.
        [HttpPost]
        [ValidateAntiForgeryToken]
        public ActionResult Edit([Bind(Include = "JobPostingId,JobTitle,JobPostingDeadline,JobDepartmentName,JobPostingFileName")] JobPosting jobPosting)
        {
            if (ModelState.IsValid)
            {
                db.Entry(jobPosting).State = EntityState.Modified;
                db.SaveChanges();
                return RedirectToAction("Index");
            }
            return View(jobPosting);
        }

        // GET: JobPostings/Delete/5
        public ActionResult Delete(int? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            JobPosting jobPosting = db.JobPostings.Find(id);
            if (jobPosting == null)
            {
                return HttpNotFound();
            }
            return View(jobPosting);
        }

        // POST: JobPostings/Delete/5
        [HttpPost, ActionName("Delete")]
        [ValidateAntiForgeryToken]
        public ActionResult DeleteConfirmed(int id)
        {
            JobPosting jobPosting = db.JobPostings.Find(id);
            db.JobPostings.Remove(jobPosting);
            db.SaveChanges();
            return RedirectToAction("Index");
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                db.Dispose();
            }
            base.Dispose(disposing);
        }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;

namespace CSDHRProject.Models
{
    public class PayrollModels
    {
        public int Id { get; set; }

        [Display(Name="Name")]
        public String Name { get; set; }

        public int ManagerId { get; set; }

        [Display(Name="Manager Name")]
        public String ManagerName { get; set; }

        [Display(Name="Pay Rate")]
        public double PayRate { get; set; }

        public String Position { get; set; }

        public int Project { get; set; }

        [Display(Name="Hours Worked")]
        public int HoursWorked { get; set; }

        [Display(Name="Project Name")]
        public String ProjectName { get; set; }

        [DataType(DataType.Date)]
        [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:dd/MM/yyyy}")]
        [Display(Name="Date of Work")]
        public DateTime? TimesheetDate { get; set; }
    }
}<file_sep>﻿using System.Data.Entity;
using System.Security.Claims;
using System.Threading.Tasks;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework;
using System.ComponentModel.DataAnnotations;

namespace CSDHRProject.Models
{
    // You can add profile data for the user by adding more properties to your ApplicationUser class, please visit http://go.microsoft.com/fwlink/?LinkID=317594 to learn more.
    public class ApplicationUser : IdentityUser
    {
        public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<ApplicationUser> manager)
        {
            // Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType
            var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);
            // Add custom user claims here
            return userIdentity;
        }

        //Custom User attributes
        public bool manager { get; set; }

        public bool role { get; set; }

        public bool admin { get; set; }

        [Display(Name = "First Name")]
        public string firstname { get; set; }

        [Display(Name = "Last Name")]
        public string lastname { get; set; }

        [Display(Name = "Sin")]
        public string Sin { get; set; }

        [Display(Name = "Bank Depost Account Number")]
        public string BenefitNumber { get; set; }

        [Display(Name = "Rate of Pay")]
        public double RateOfPay { get; set; }

        [Display(Name = "Vacation Days")]
        public int VacationDays { get; set; }

        [Display(Name = "Sick Days")]
        public int SickDays { get; set; }

        [Display(Name = "Benefit Certificate File")]
        public string BenefitCertificateFileName { get; set; }

        [Display(Name = "Training Certificate File")]
        public string TrainingCertificateFileName { get; set; }
    }

    public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
    {
        public ApplicationDbContext() : base("DefaultConnection", throwIfV1Schema: false)
        {
            
        }

        public static ApplicationDbContext Create()
        {
            return new ApplicationDbContext();
        }

        public System.Data.Entity.DbSet<CSDHRProject.Models.RegisterViewModel> NewHireModels { get; set; }
        
        public System.Data.Entity.DbSet<CSDHRProject.Models.JobPosting> JobPostings { get; set; }

        public System.Data.Entity.DbSet<CSDHRProject.Models.JobApplication> JobApplications { get; set; }

        public System.Data.Entity.DbSet<CSDHRProject.Models.Project> Projects { get; set; }
        public System.Data.Entity.DbSet<CSDHRProject.Models.ProjectUser> ProjectUsers { get; set; }

        public System.Data.Entity.DbSet<CSDHRProject.Models.PayrollModels> PayrollModels { get; set; }

        public System.Data.Entity.DbSet<CSDHRProject.Models.BenefitRegistration> BenefitRegistrations { get; set; }

        public System.Data.Entity.DbSet<CSDHRProject.Models.EmployeeClaim> EmployeeClaims { get; set; }

        public System.Data.Entity.DbSet<CSDHRProject.Models.Address> Addresses { get; set; }


        //Insert DbSet variables (Table Names!) here in the following format:
        // public DbSet<%MODEL_NAME%> %TABLE_NAME% { get; set; }
        //Example:
        // public DbSet<Benefits> Benefits { get; set; }

        //Once added here, you can update the database by opening the NuGet console
        // (Tools > NuGet Package Manager > Package Manager Console)
        //then running the following command: 
        // Update-Database
        //This will create or modify all tables in the database

        //If you insert a table, decide you do not want it anymore,
        //and want to delete it, remove it from here and run:
        // Update-Database -Force
        //This will DELETE the table and ALL DATA within it.
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Mvc;
using System.IO;
using System.Drawing;
using CSDHRProject.Models;

namespace CSDHRProject.Controllers
{
    public class NewHireController : Controller
    {
        private ApplicationDbContext db = new ApplicationDbContext();

        // GET: NewHire
        public ActionResult Index()
        {
            return View(db.Users.ToList());
        }

        // GET: NewHire/Details/5
        public ActionResult Details(string id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
           
            ApplicationUser user = db.Users.Find(id);
            if (user == null)
            {
                return HttpNotFound();
            }

            return View(new NewHireEditViewModel { UserData = user });
        }

        // GET: NewHire/Create
        public ActionResult Create()
        {
            return View();
        }

        // POST: NewHire/Create
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for 
        // more details see http://go.microsoft.com/fwlink/?LinkId=317598.
        [HttpPost]
        [ValidateAntiForgeryToken]
        public ActionResult Create([Bind(Include = "Id,Name,Sin,BenefitNumber,RateOfPay,VacationDays,SickDays,BenefitCertificateFileName,TrainingCertificateFileName")] RegisterViewModel newHireModel)
        {
            if (ModelState.IsValid)
            {
                db.NewHireModels.Add(newHireModel);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(newHireModel);
        }

        // GET: NewHire/Edit/5
        public ActionResult Edit(string id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            ApplicationUser user = db.Users.Find(id);
            if (user == null)
            {
                return HttpNotFound();
            }
            return View(new NewHireEditViewModel { UserData = user });
        }

        // POST: NewHire/Edit/5
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for 
        // more details see http://go.microsoft.com/fwlink/?LinkId=317598.
        [HttpPost]
        [ValidateAntiForgeryToken]
        public ActionResult Edit([Bind(Include = "UserData, BenefitFile, TrainingFile")] NewHireEditViewModel nhvm)
        {
            Console.Out.WriteLine("Received nhvm: " + nhvm.ToString());
            if (ModelState.IsValid)
            {

                //user.
                var fileFolder = "fileDocuments";

                if (nhvm.BenefitFile != null && nhvm.BenefitFile.ContentLength > 0)
                {
                    var BenefitFileName = DateTime.Now.ToBinary().ToString("X") + Path.GetFileName(nhvm.BenefitFile.FileName);
                    var path1 = Path.Combine(Server.MapPath("~"), fileFolder, BenefitFileName);
                    nhvm.BenefitFile.SaveAs(path1);
                    nhvm.UserData.BenefitCertificateFileName = "/" + fileFolder + "/" + BenefitFileName;
                }
                if (nhvm.TrainingFile != null && nhvm.TrainingFile.ContentLength > 0)
                {
                    var TrainingFileName = DateTime.Now.ToBinary().ToString("X") + Path.GetFileName(nhvm.TrainingFile.FileName);
                    var path2 = Path.Combine(Server.MapPath("~"), fileFolder, TrainingFileName);
                    nhvm.TrainingFile.SaveAs(path2);
                    nhvm.UserData.TrainingCertificateFileName = "/" + fileFolder + "/" + TrainingFileName;
                }
                db.Entry(nhvm.UserData).State = EntityState.Modified;
                db.SaveChanges();
                return RedirectToAction("Details", new { id = nhvm.UserData.Id });
            }
            return View(nhvm);
        }

        // GET: NewHire/Delete/5
        public ActionResult Delete(string id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
           RegisterViewModel newHireModel = db.NewHireModels.Find(id);
            if (newHireModel == null)
            {
                return HttpNotFound();
            }
            return View(newHireModel);
        }

        // POST: NewHire/Delete/5
        [HttpPost, ActionName("Delete")]
        [ValidateAntiForgeryToken]
        public ActionResult DeleteConfirmed(string id)
        {
            RegisterViewModel newHireModel = db.NewHireModels.Find(id);
            db.NewHireModels.Remove(newHireModel);
            db.SaveChanges();
            return RedirectToAction("Index");
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                db.Dispose();
            }
            base.Dispose(disposing);
        }
    }
}
<file_sep>﻿using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.Owin;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace CSDHRProject.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            return View();
        }

        public ActionResult About()
        {
            ViewBag.Message = "Your application description page.";
            //var userId = HttpContext.GetOwinContext().GetUserManager<ApplicationUserManager>().FindById(User.Identity.GetUserId()).
            return View();
        }

        public ActionResult Contact()
        {
            ViewBag.Message = "Your contact page.";

            return View();
        }
    }
}<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace CSDHRProject.Models
{
    public class EmployeeClaim
    {
        public int Id { get; set; }
        public String Name { get; set; }
        public virtual Address Address { get; set; }
        public Double Amount { get; set; }
        public DateTime Date { get; set; }
        public String Service { get; set; }
        public virtual ApplicationUser User { get; set; }
    }

    public class Address
    {
        public int Id { get; set; }
        public String Street { get; set; }
        public String City { get; set; }
        public String Provence { get; set; }
        public String Postal { get; set; }
    }

    public class BenefitRegistration
    {
        public virtual ApplicationUser User { get; set; }
        public int Id { get; set; }

        public Boolean RealtionshipStatus { get; set; }
 
        public Boolean BenefitType { get; set; }

        public Boolean Dental { get; set; }

        public Boolean Optical { get; set; }

        public Boolean Paramedical { get; set; }
    }
}<file_sep>﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Mvc;
using CSDHRProject.Models;
using System.Text;

namespace CSDHRProject.Controllers
{
    public class PayrollController : Controller
    {
        private ApplicationDbContext db = new ApplicationDbContext();

        #region Index
        // GET: PayrollModels
        public ActionResult Index()
        {
            return View(db.PayrollModels.ToList());
        }

        #endregion

        #region Details
        // GET: PayrollModels/Details/5
        public ActionResult Details(int? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            PayrollModels payrollModels = db.PayrollModels.Find(id);
            if (payrollModels == null)
            {
                return HttpNotFound();
            }
            return View(payrollModels);
        }
        #endregion

        #region Create
        // GET: PayrollModels/Create
        public ActionResult Create()
        {
            return View();
        }

        // POST: PayrollModels/Create
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for 
        // more details see http://go.microsoft.com/fwlink/?LinkId=317598.
        [HttpPost]
        [ValidateAntiForgeryToken]
        public ActionResult Create([Bind(Include = "Id,Name,ManagerId,ManagerName,PayRate,Position")] PayrollModels payrollModels)
        {
            if (ModelState.IsValid)
            {
                db.PayrollModels.Add(payrollModels);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(payrollModels);
        }
        #endregion

        #region Edit
        // GET: PayrollModels/Edit/5
        public ActionResult Edit(int? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            PayrollModels payrollModels = db.PayrollModels.Find(id);
            if (payrollModels == null)
            {
                return HttpNotFound();
            }
            return View(payrollModels);
        }

        // POST: PayrollModels/Edit/5
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for 
        // more details see http://go.microsoft.com/fwlink/?LinkId=317598.
        [HttpPost]
        [ValidateAntiForgeryToken]
        public ActionResult Edit([Bind(Include = "Id,Name,ManagerId,ManagerName,PayRate,Position")] PayrollModels payrollModels)
        {
            if (ModelState.IsValid)
            {
                db.Entry(payrollModels).State = EntityState.Modified;
                db.SaveChanges();
                return RedirectToAction("Index");
            }
            return View(payrollModels);
        }
        #endregion

        #region Delete
        // GET: PayrollModels/Delete/5
        public ActionResult Delete(int? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            PayrollModels payrollModels = db.PayrollModels.Find(id);
            if (payrollModels == null)
            {
                return HttpNotFound();
            }
            return View(payrollModels);
        }

        // POST: PayrollModels/Delete/5
        [HttpPost, ActionName("Delete")]
        [ValidateAntiForgeryToken]
        public ActionResult DeleteConfirmed(int id)
        {
            PayrollModels payrollModels = db.PayrollModels.Find(id);
            db.PayrollModels.Remove(payrollModels);
            db.SaveChanges();
            return RedirectToAction("Index");
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                db.Dispose();
            }
            base.Dispose(disposing);
        }
        #endregion

        #region Instructions
        // GET: PayrollModels/Instructions
        public ActionResult Instructions(int? id)
        {
            PayrollModels payrollModels = db.PayrollModels.Find(id);

            if (ModelState.IsValid)
            {
                db.Entry(payrollModels).State = EntityState.Modified;
                db.SaveChanges();
                return RedirectToAction("Instructions");
            }
            return View(payrollModels);
        }
        #endregion

        #region TimesheetEntry
        // GET: PayrollModels/TimesheetEntry
        public ActionResult TimesheetEntry()
        {
            return View();
        }

        // POST: PayrollModels/TimesheetEntry
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for 
        // more details see http://go.microsoft.com/fwlink/?LinkId=317598.
        [HttpPost]
        [ValidateAntiForgeryToken]
        public ActionResult TimesheetEntry([Bind(Include = "Id,Name,ManagerId,ManagerName,PayRate,Position")] PayrollModels payrollModels)
        {
            if (ModelState.IsValid)
            {
                db.PayrollModels.Add(payrollModels);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(payrollModels);
        }

        public partial class DatePickerController : Controller
        {
            public ActionResult Index()
            {
                return View();
            }
        }
        #endregion

        #region Calendar
        // GET: PayrollModels/Calendar
        public ActionResult Calendar()
        {
            return View();
        }

        // POST: PayrollModels/Calendar
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for 
        // more details see http://go.microsoft.com/fwlink/?LinkId=317598.
        [HttpPost]
        [ValidateAntiForgeryToken]
        public ActionResult Calendar([Bind(Include = "Id,Name,ManagerId,ManagerName,PayRate,Position")] PayrollModels payrollModels)
        {
            if (ModelState.IsValid)
            {
                db.PayrollModels.Add(payrollModels);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(payrollModels);
        }

        [ChildActionOnly]
        public ActionResult Calendar2(
            )
        {

            System.Web.UI.WebControls.Calendar cal = new System.Web.UI.WebControls.Calendar();
            cal.ID = "MyCalendar";
            cal.CssClass = "month-view";
            cal.CssClass = "calendar";
            cal.CellSpacing = 0;
            cal.CellPadding = -1;
            cal.BorderWidth = 0;
            cal.ShowGridLines = true;
            cal.ShowTitle = false;
            cal.CellPadding = 50;
            //cal.BorderStyle = Solid 2;
            cal.TitleStyle.BackColor = System.Drawing.Color.LightSkyBlue;
            cal.TitleStyle.ForeColor = System.Drawing.Color.White;
            cal.DayStyle.BackColor = System.Drawing.Color.LightGray;
            cal.ShowNextPrevMonth = true;
            cal.DayNameFormat = System.Web.UI.WebControls.DayNameFormat.Full;
            cal.DayRender += new System.Web.UI.WebControls.DayRenderEventHandler(CalendarDayRender);
            StringBuilder sb = new StringBuilder();
            using (System.IO.StringWriter sw = new System.IO.StringWriter(sb))
            {

                System.Web.UI.HtmlTextWriter writer = new System.Web.UI.HtmlTextWriter(sw);
                cal.RenderControl(writer);
            }
            String calHTML = sb.ToString();
            return Content(calHTML);
        }

        private void CalendarDayRender(object sender, System.Web.UI.WebControls.DayRenderEventArgs e)
        {

            e.Cell.Text = "";
            if (e.Day.Date == System.DateTime.Today)
            {
                e.Cell.CssClass = "today";
                e.Cell.BackColor = System.Drawing.Color.Gray;
                System.Web.UI.HtmlControls.HtmlGenericControl h4 = new System.Web.UI.HtmlControls.HtmlGenericControl("h3");
                h4.InnerHtml = HttpContext.GetGlobalResourceObject("JTG_DateTime", "JTK_Today") + " " + e.Day.DayNumberText;
                e.Cell.Controls.Add(h4);
            }
            else
            {
                System.Web.UI.HtmlControls.HtmlGenericControl h4 = new System.Web.UI.HtmlControls.HtmlGenericControl("h4");
                h4.InnerHtml = e.Day.DayNumberText;
                e.Cell.Controls.Add(h4);
            }

        }

        #endregion

        #region EmployeeTimesheet
        // GET: PayrollModels/EmployeeTimesheet
        public ActionResult EmployeeTimesheet()
        {
            return View();
        }

        // POST: PayrollModels/EmployeeTimesheet
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for 
        // more details see http://go.microsoft.com/fwlink/?LinkId=317598.
        [HttpPost]
        [ValidateAntiForgeryToken]
        public ActionResult EmployeeTimesheet([Bind(Include = "Id,Name,ManagerId,ManagerName,PayRate,Position")] PayrollModels payrollModels)
        {
            if (ModelState.IsValid)
            {
                db.PayrollModels.Add(payrollModels);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(payrollModels);
        }
        #endregion

        #region ProjectTimesheet
        // GET: PayrollModels/ProjectTimesheet
        public ActionResult ProjectTimesheet()
        {
            return View();
        }

        // POST: PayrollModels/ProjectTimesheet
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for 
        // more details see http://go.microsoft.com/fwlink/?LinkId=317598.
        [HttpPost]
        [ValidateAntiForgeryToken]
        public ActionResult ProjectTimesheet([Bind(Include = "Id,Name,ManagerId,ManagerName,PayRate,Position")] PayrollModels payrollModels)
        {
            if (ModelState.IsValid)
            {
                db.PayrollModels.Add(payrollModels);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(payrollModels);
        }

        #endregion

        #region Reports
        // GET: PayrollModels/Reports
        public ActionResult Reports()
        {
            return View();
        }

        // POST: PayrollModels/Reports
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for 
        // more details see http://go.microsoft.com/fwlink/?LinkId=317598.
        [HttpPost]
        [ValidateAntiForgeryToken]
        public ActionResult Reports([Bind(Include = "Id,Name,ManagerId,ManagerName,PayRate,Position")] PayrollModels payrollModels)
        {
            if (ModelState.IsValid)
            {
                db.PayrollModels.Add(payrollModels);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(payrollModels);
        }
        #endregion
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace CSDHRProject.Models
{
    public class Project
    {
        public int Id { get; set; }
        public String Title { get; set; }
        public  DateTime Date { get; set; }
        public String Description { get; set; }
        public virtual ApplicationUser Author { get; set; }
        public virtual ApplicationUser Lead { get; set; }
    }

    public class ProjectUser
    {
        public int Id { get; set; }
        public virtual ApplicationUser User{ get; set; }
        public virtual Project Project { get; set; }
        

    }
}