コード例 #1
0
ファイル: TaskController.cs プロジェクト: CST4G/HealthApp
        //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());
        }
コード例 #2
0
ファイル: ScheduleController.cs プロジェクト: CST4G/HealthApp
 public ActionResult TaskComplete(Schedule t)
 {
     if (ModelState.IsValid)
     {
         db.Entry(t).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(t);
 }