public ActionResult NewTest()
        {
            if (!CheckCookie())
                return RedirectToAction("Index");

            //Check Open/Close Dates
            DateTime Open = DateTime.Parse(Database.ScalarString("SELECT VALUE FROM tlSettings WHERE Property = 'TestSubmissionOpenDate'"));
            DateTime Close = DateTime.Parse(Database.ScalarString("SELECT VALUE FROM tlSettings WHERE Property = 'TestSubmissionClosedDate'"));
            DateTime eaOpen = new DateTime();
            DateTime eaClose = new DateTime();
            bool InEarlyAccess = false;

            SqlConnection con = new SqlConnection(Models.Database.ConnectionString);
            string query = @"SELECT StartDate, EndDate
                             FROM tlEarlyAccess EA, tlProfessors P
                             WHERE EA.Professor_ID = P.Professor_ID AND CBAUserName = '******'";
            SqlCommand cmd = new SqlCommand(query, con);
            con.Open();
            SqlDataReader rdr = cmd.ExecuteReader();
            rdr.Read();
            try
            {
                eaOpen = DateTime.Parse(rdr[0].ToString());
                eaClose = DateTime.Parse(rdr[1].ToString());
                if (DateTime.Now < eaClose && DateTime.Now > eaOpen)
                    InEarlyAccess = true;
            }
            catch
            {
                InEarlyAccess = false;
            }
            con.Close();

            if ( (Open > DateTime.Now || DateTime.Now > Close) && !InEarlyAccess )
            {
                ModelState.Clear();
                ModelState.AddModelError("", "The Add Test function is currently closed. An email will be sent out during each semester break with the open dates for the test management system. If you have any questions, please contact the Testing Lab at [email protected]");

                return View("Home");
            }

            TestCourseVM TVM = new TestCourseVM();
            TVM.prof = Models.Professor.Get(Session["User"].ToString());
            TVM.test = new Test();
            TVM.getCourses();
            TVM.getTitles();

            return View( TVM );
        }
        public ActionResult LoadTestInfo(TestCourseVM tcvm)
        {
            if (!CheckCookie())
                return RedirectToAction("Index");
            if (String.IsNullOrWhiteSpace(tcvm.title))
                return RedirectToAction("NewTest");

            tcvm.prof = Models.Professor.Get(Session["User"].ToString());
            tcvm.getCourses();
            tcvm.getTitles();
            tcvm.getSections(tcvm.title);

            tcvm.GetBlackedOutDates();

            tcvm.GetMaterialList();

            return View("TestInfo", tcvm);
        }