public ActionResult Create(Company company)
        {
            db = new EMSEntities12();
            if (ModelState.IsValid)
            {
                List<Company> companyList = db.Companies.ToList();
                bool companyExists = false;

                for (int x = 0; x < companyList.Count; ++x)
                {
                    if (companyList[x].CompanyName == company.CompanyName)
                    {
                        companyExists = true;
                    }
                }
                if (!companyExists && company.CompanyName != null)
                {
                        company.EnrolledSince = DateTime.Now;
                        db.Companies.Add(company);
                        db.SaveChanges();
                }
                return RedirectToAction("Index");
            }

            return View(company);
        }
 public ActionResult Edit(Company company)
 {
     db = new EMSEntities12();
     if (ModelState.IsValid)
     {
         db.Entry(company).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(company);
 }
        public ActionResult ReportsHome()
        {
            Company company = new Company();

            ViewBag.CompName = EMSPSSUtilities.GetCompList();
            return View();
        }
        // GET: /Reports/
        public ActionResult SeniorityReport(string CompList)
        {
            db = new EMSEntities12();
            Company MyComp = new Company();
            foreach (Company mycmp in db.Companies)
            {
                if (mycmp.CompanyName == CompList)
                {
                    MyComp.CompanyId = mycmp.CompanyId;
                }
            }
            //Dictionary<EmployeeType, String> emplist = new Dictionary<EmployeeType,String>();
            Dictionary<EmployeeType, String> emplist2 = new Dictionary<EmployeeType, String>();
            List<EmployeeType> emplist = new List<EmployeeType>();
            List<String> strlst = new List<String>();
            foreach (EmployeeType emptype in db.EmployeeTypes)
            {
                if (emptype.CompanyId == MyComp.CompanyId && emptype.Employee.Completed && emptype.Employee.Active)
                {
                    emplist.Add(emptype);
                    ViewBag.CompanyName = emptype.Company.CompanyName;
                    // strlst.Add(ParseDays(emptype.DateofHire));

                }

            }

            foreach (EmployeeType emptypes in emplist.OrderBy(x => x.DateofHire))
            {
                emplist2.Add(emptypes, ParseDays(emptypes.DateofHire));
            }

            //ViewBag.EmplList = strlst;
            return View(emplist2);
        }
        public ActionResult HoursIndex(Nullable<DateTime> DateTimeQuery, string CompList)
        {
            db = new EMSEntities12();
            //if (DateTimeQuery != null)
            //{

            //    return View("HoursWorkedReport" );
            //}
            DateTime timeofweek = DateTime.Now ;
            Company MyComp = new Company();
            EmployeeType MyEmp = new EmployeeType();
            TimeCard TimeCardEnt = new TimeCard();
            Dictionary<EmployeeType, decimal?> emplist2 = new Dictionary<EmployeeType, decimal?>();
            List<TimeCard> tmcard = new List<TimeCard>();
            if (DateTimeQuery != null)
            {
                ViewBag.ThisCompany = CompList;
                timeofweek = (DateTime)DateTimeQuery;

                foreach (Company mycmp in db.Companies)
                {
                    if (mycmp.CompanyName == CompList)
                    {
                        MyComp.CompanyId = mycmp.CompanyId;

                    }

                }

            while (timeofweek.DayOfWeek != DayOfWeek.Sunday)
                {
                    timeofweek = timeofweek.AddDays(+1);
                }
                ViewBag.DateWeek = timeofweek;

            }
            List<EmployeeType> emplist = new List<EmployeeType>();

            foreach (EmployeeType EmpTime in db.EmployeeTypes)
            {
                if (EmpTime.CompanyId == MyComp.CompanyId)
                {
                    if (EmpTime.Employee.Completed && EmpTime.Employee.Active)
                    {
                        if (EmpTime.EmployeeType1 != "Contract  ")
                        {

                            emplist.Add(EmpTime);

                        }
                    }
                }
            }

            foreach (TimeCard TimecrdEnt in db.TimeCards)
            {

                if (TimecrdEnt.EmployedWith5Id == MyComp.CompanyId)
                {
                    tmcard.Add(TimecrdEnt);

                }

            }

            foreach (EmployeeType EMP in emplist)
            {

                foreach (TimeCard tmcrd in tmcard)
                {

                    if (EMP.EmployeeId == tmcrd.EmployeeRef5Id)
                    {
                        if (DateTimeQuery == tmcrd.WeekOf)
                        {

                            emplist2.Add(EMP, TotalHours(tmcrd));
                        }

                    }
                }
            }

            return View("HoursWorkedReport", emplist2);
        }