Esempio n. 1
0
        public ActionResult Create([Bind(Include = "ID,StartTime,EndTime,TypeOfMeeting,ClassID,Length,Status,Note,StudentID,TutorID")] TutoringAppt tutoringAppt, DateTime?Date)
        {
            ViewBag.SetCompleted = "Completed";
            if (Date == null)
            {
                Date = (DateTime.Now).AddDays(1);
            }

            var date      = Date?.ToString("yyyy-MM-dd");
            var startTime = tutoringAppt.StartTime.ToString("HH:mm:ss tt");
            var endTime   = tutoringAppt.EndTime.ToString("HH:mm:ss tt");

            tutoringAppt.StartTime = Convert.ToDateTime(date + " " + startTime);
            tutoringAppt.EndTime   = Convert.ToDateTime(date + " " + endTime);

            if (ModelState.IsValid)
            {
                db.TutoringAppts.Add(tutoringAppt);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.ClassID = new SelectList(db.Classes, "ID", "Name", tutoringAppt.ClassID);

            return(View(tutoringAppt));
        }
Esempio n. 2
0
        public ActionResult Edit([Bind(Include = "ID,StartTime,EndTime,TypeOfMeeting,ClassID,Length,Status,Note,StudentID,TutorID")] TutoringAppt tutoringAppt, DateTime?Date)
        {
            if (Date == null)
            {
                Date = (DateTime.Now).AddDays(2);
            }

            var date      = Date?.ToString("yyyy-MM-dd");
            var startTime = tutoringAppt.StartTime.ToString("HH:mm:ss tt");
            var endTime   = tutoringAppt.EndTime.ToString("HH:mm:ss tt");

            tutoringAppt.StartTime = Convert.ToDateTime(date + " " + startTime);
            tutoringAppt.EndTime   = Convert.ToDateTime(date + " " + endTime);

            if (ModelState.IsValid)
            {
                db.Entry(tutoringAppt).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            var stuID    = db.TutoringAppts.Where(a => a.ID == tutoringAppt.ClassID).Select(a => a.StudentID).FirstOrDefault();
            var stuFName = db.BTTUsers.Where(a => a.ID == stuID).Select(a => a.FirstName).FirstOrDefault();
            var stuLName = db.BTTUsers.Where(a => a.ID == stuID).Select(a => a.LastName).FirstOrDefault();
            var stuName  = stuFName + " " + stuLName;

            ViewBag.StudentName = stuName;
            return(View(tutoringAppt));
        }
Esempio n. 3
0
        public ActionResult DeleteConfirmed(int id)
        {
            TutoringAppt tutoringAppt = db.TutoringAppts.Find(id);

            db.TutoringAppts.Remove(tutoringAppt);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 4
0
 public ActionResult Edit([Bind(Include = "ID,StartTime,EndTime,TypeOfMeeting,ClassID,Length,Status,Note,StudentID,TutorID")] TutoringAppt tutoringAppt)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tutoringAppt).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tutoringAppt));
 }
 public TutoringApptInfoViewModel(TutoringAppt tutoringAppt)
 {
     ID            = tutoringAppt.ID;
     StartTime     = tutoringAppt.StartTime;
     EndTime       = tutoringAppt.EndTime;
     TypeOfMeeting = tutoringAppt.TypeOfMeeting;
     ClassID       = tutoringAppt.ClassID;
     Class         = tutoringAppt.Class.Name;
     Length        = tutoringAppt.Length;
     Note          = tutoringAppt.Note;
     StudentID     = tutoringAppt.StudentID;
     StudentName   = tutoringAppt.Student.BTTUser.FirstName + " " + tutoringAppt.Student.BTTUser.LastName;
 }
Esempio n. 6
0
 public ActionResult Edit([Bind(Include = "ID,StartTime,EndTime,TypeOfMeeting,ClassID,Length,Status,Note,StudentID,TutorID")] TutoringAppt tutoringAppt)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tutoringAppt).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ClassID   = new SelectList(db.Classes, "ID", "Name", tutoringAppt.ClassID);
     ViewBag.StudentID = new SelectList(db.Students, "ID", "ClassStanding", tutoringAppt.StudentID);
     ViewBag.TutorID   = new SelectList(db.Tutors, "ID", "VNumber", tutoringAppt.TutorID);
     return(View(tutoringAppt));
 }
Esempio n. 7
0
        // GET: Professor/TutoringAppts/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TutoringAppt tutoringAppt = db.TutoringAppts.Find(id);

            if (tutoringAppt == null)
            {
                return(HttpNotFound());
            }
            return(View(tutoringAppt));
        }
Esempio n. 8
0
        // GET: Tutor/TutoringAppts/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TutoringAppt tutoringAppt = db.TutoringAppts.Find(id);

            if (tutoringAppt == null)
            {
                return(HttpNotFound());
            }

            var stuID    = db.TutoringAppts.Where(a => a.ID == id).Select(a => a.StudentID).FirstOrDefault();
            var stuFName = db.BTTUsers.Where(a => a.ID == stuID).Select(a => a.FirstName).FirstOrDefault();
            var stuLName = db.BTTUsers.Where(a => a.ID == stuID).Select(a => a.LastName).FirstOrDefault();
            var stuName  = stuFName + " " + stuLName;

            ViewBag.StudentName = stuName;

            var studentInfo = db.TutoringAppts.Where(a => a.ID == id).ToList();

            var startTime = studentInfo.Select(a => a.StartTime).FirstOrDefault();

            ViewBag.modelDate      = startTime.ToShortDateString();
            ViewBag.modelStartTime = startTime.ToShortTimeString();

            var endTime = studentInfo.Select(a => a.EndTime).FirstOrDefault();

            ViewBag.modelEndTime = endTime.ToShortTimeString();

            ViewBag.TypeOfMeeting = studentInfo.Select(a => a.TypeOfMeeting).FirstOrDefault();
            ViewBag.ClassID       = studentInfo.Select(a => a.ClassID).FirstOrDefault();
            ViewBag.Length        = studentInfo.Select(a => a.Length).FirstOrDefault();
            ViewBag.StudentID     = studentInfo.Select(a => a.StudentID).FirstOrDefault();

            var Tutors = db.BTTUsers.Where(a => a.ID == a.Tutor.ID)
                         .Select(a => new
            {
                ID   = a.ID,
                Name = a.FirstName + " " + a.LastName
            });

            ViewBag.Tutors = Tutors;

            ViewBag.ID = studentInfo.Select(a => a.ID).FirstOrDefault();
            return(View(tutoringAppt));
        }
Esempio n. 9
0
        // GET: Student/Home
        public ActionResult Index()
        {
            ViewBag.Current = "StuHomeIndex";

            var userID        = User.Identity.GetUserId();
            var currentUserID = db.BTTUsers.Where(m => m.ASPNetIdentityID.Equals(userID)).FirstOrDefault().ID;

            // --------------BEGIN section for custom portal display--------------
            // get student name to display in portal
            var    currentUser = db.BTTUsers.Where(m => m.ASPNetIdentityID.Equals(userID)).FirstOrDefault();
            string firstName   = currentUser.FirstName;
            string lastName    = currentUser.LastName;

            ViewBag.User     = currentUser.FirstName;
            ViewBag.Class    = currentUser.Student.ClassStanding;
            ViewBag.GradYear = currentUser.Student.GraduatingYear;
            ViewBag.fullName = firstName + " " + lastName;

            // --------------END section for custom portal display--------------

            var allTutoringAppts = db.TutoringAppts.Where(a => a.StudentID == currentUserID);

            foreach (var appt in allTutoringAppts)
            {
                if (DateTime.Now > appt.EndTime.AddMinutes(30) && (appt.Status == "Approved"))
                {
                    var          currentItem  = appt.ID;
                    TutoringAppt tutoringAppt = db.TutoringAppts.Find(currentItem);

                    tutoringAppt.Status = "Completed";

                    db.Entry(tutoringAppt).State = EntityState.Modified;
                }
                else if (DateTime.Now > appt.EndTime && (appt.Status == "Requested"))
                {
                    var          currentItem  = appt.ID;
                    TutoringAppt tutoringAppt = db.TutoringAppts.Find(currentItem);

                    tutoringAppt.Status = "Declined";

                    db.Entry(tutoringAppt).State = EntityState.Modified;
                }
            }

            db.SaveChanges();

            return(View());
        }
Esempio n. 10
0
        // GET: Professor/TutoringAppts/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TutoringAppt tutoringAppt = db.TutoringAppts.Find(id);

            if (tutoringAppt == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ClassID   = new SelectList(db.Classes, "ID", "Name", tutoringAppt.ClassID);
            ViewBag.StudentID = new SelectList(db.Students, "ID", "ClassStanding", tutoringAppt.StudentID);
            ViewBag.TutorID   = new SelectList(db.Tutors, "ID", "VNumber", tutoringAppt.TutorID);
            return(View(tutoringAppt));
        }
Esempio n. 11
0
        // GET: Student/TutoringAppts/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TutoringAppt tutoringAppt = db.TutoringAppts.Find(id);
            var          studentInfo  = db.TutoringAppts.Where(a => a.ID == id).ToList();

            ViewBag.StartTime     = studentInfo.Select(a => a.StartTime).FirstOrDefault();
            ViewBag.EndTime       = studentInfo.Select(a => a.EndTime).FirstOrDefault();
            ViewBag.TypeOfMeeting = studentInfo.Select(a => a.TypeOfMeeting).FirstOrDefault();
            ViewBag.ClassID       = studentInfo.Select(a => a.ClassID).FirstOrDefault();
            ViewBag.Length        = studentInfo.Select(a => a.Length).FirstOrDefault();
            ViewBag.Note          = studentInfo.Select(a => a.Note).FirstOrDefault();
            ViewBag.StudentID     = studentInfo.Select(a => a.StudentID).FirstOrDefault();
            ViewBag.TutorID       = studentInfo.Select(a => a.TutorID).FirstOrDefault();
            ViewBag.ID            = studentInfo.Select(a => a.ID).FirstOrDefault();
            if (tutoringAppt == null)
            {
                return(HttpNotFound());
            }
            return(View(tutoringAppt));
        }
Esempio n. 12
0
        // GET: Tutor/Home
        public ActionResult Index()
        {
            ViewBag.Current = "TutorHomeIndex";

            // --------------BEGIN section for custom portal display--------------
            // get tutor name to display in portal
            var userID      = User.Identity.GetUserId();
            var currentUser = db.BTTUsers.Where(m => m.ASPNetIdentityID.Equals(userID)).FirstOrDefault();

            ViewBag.User = currentUser.FirstName;
            var currentUserID = db.BTTUsers.Where(m => m.ASPNetIdentityID.Equals(userID)).FirstOrDefault().ID;

            // get num resources belonging to tutor for stats display
            ViewBag.resources = currentUser.StudentResources.Count();

            // get information for tutoring sessions menu display
            ViewBag.completeSessions      = currentUser.Tutor.TutoringAppts.Where(m => m.Status == "Completed").Count();
            ViewBag.futureSessions        = currentUser.Tutor.TutoringAppts.Where(m => m.Status == "Approved").Count();
            ViewBag.allTutorSessions      = currentUser.Tutor.TutoringAppts.Count();
            ViewBag.requestedSessions     = db.TutoringAppts.Where(m => m.Status == "Requested").Count();
            ViewBag.allDepartmentSessions = db.TutoringAppts.Count();

            // get saved calculator results num for stats display
            var weightedGrades = currentUser.WeightedGrades.Count();
            var finalGrades    = currentUser.FinalGrades.Count();
            var cumulativeGPAs = currentUser.CumulativeGPAs.Count();

            ViewBag.totalGrades = weightedGrades + finalGrades + cumulativeGPAs;

            // schedule for current tutor
            DateTime getCurrentDateTime = DateTime.Now.Date;

            var currentTutorSchedules = currentUser.Tutor.TutorSchedules
                                        .Where(m => m.StartTime.Date > getCurrentDateTime).OrderBy(m => m.StartTime).Take(5);
            List <TutorSchedule> scheduleList = new List <TutorSchedule>();


            foreach (var appts in currentTutorSchedules)
            {
                scheduleList.Add(appts);
            }

            // --------------END section for custom portal display--------------

            // --------------BEGIN section for handling automated banners--------------
            var allTutoringAppts = db.TutoringAppts;

            foreach (var appt in allTutoringAppts)
            {
                if (DateTime.Now > appt.EndTime && (appt.Status == "Approved"))
                {
                    var          currentItem  = appt.ID;
                    TutoringAppt tutoringAppt = db.TutoringAppts.Find(currentItem);

                    tutoringAppt.Status = "Completed";

                    db.Entry(tutoringAppt).State = EntityState.Modified;
                }
                else if (DateTime.Now > appt.EndTime && (appt.Status == "Requested"))
                {
                    var          currentItem  = appt.ID;
                    TutoringAppt tutoringAppt = db.TutoringAppts.Find(currentItem);

                    tutoringAppt.Status = "Declined";

                    db.Entry(tutoringAppt).State = EntityState.Modified;
                }
            }

            db.SaveChanges();
            // --------------END section for handling automated banners--------------

            return(View(scheduleList));
        }