Ejemplo n.º 1
0
        //populate today's Shedule based on Tasks
        public ActionResult GenerateSched()
        {
            DateTime date = DateTime.Today; //date will be set to today
            String[] days = { "Sun", "Mon", "Tue", "Wed", "Thr", "Fri", "Sat" };
            String dow = days[(int)date.DayOfWeek]; //day of week
            int dom = date.Day;
            //call static method from tasks model to get all the tasks needed to generate schedule.
            var tasks = Tasks.getTasks(db, date, dow, dom);

            Schedule sc = new Schedule();
            //populate schedule with new records
            foreach (var item in tasks)
            {
                sc.taskID = item.ID;
                sc.PatientID = item.PatientID;
                sc.Task = item.Task;
                sc.RoomNo = item.RoomNo;
                sc.duration = item.duration;
                sc.tDate = DateTime.Today + item.dtStart.TimeOfDay;
                db.Sched.Add(sc);
            }

            db.SaveChanges();
            return View(db.Tasks.ToList());
        }
Ejemplo n.º 2
0
 public ActionResult TaskComplete(Schedule t)
 {
     if (ModelState.IsValid)
     {
         db.Entry(t).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(t);
 }