public ClientDetail(int id, ClientDBContext cdb, ServicesDBContext sdb)
 {
     client = cdb.Client.Find(id);
     services = sdb.Services.Find(id);
 }
 public ActionResult PrintDetails(int id)
 {
     ServicesDBContext serviceDB = new ServicesDBContext();
     ClientDetail cd = new ClientDetail(id, db, serviceDB);
     if (cd.client == null || cd.services == null)
     {
         return RedirectToAction("Index");
     }
     return View(cd);
 }
Beispiel #3
0
 public static IQueryable<Services> getTasks(ServicesDBContext db, DateTime date, String dow, int dom)
 {
     var tasks = from s in db.Services
                 where
                     // CONDITIONS: these will depend on the Calendar format that we choose
                     //every day, end date defined
                     (s.dtStart <= date && s.dtEnd >= date && s.freq.Equals("daily") && DbFunctions.DiffDays(date, s.dtStart) % s.interval == 0)
                     //s.interval == 1 &&
                     ||
                     //every day, count defined
                     (s.dtStart <= date && DbFunctions.AddDays(s.dtStart, s.count) >= date && s.freq.Equals("daily") && DbFunctions.DiffDays(date, s.dtStart) % s.interval == 0)
                     ||
                     //every week, end date defined
                     (s.dtStart <= date && s.dtEnd >= date && s.freq.Equals("weekly") && s.byDay.Contains(dow)
                             && (DbFunctions.DiffDays(date, DbFunctions.AddDays(s.dtStart, -s.dtStartWD)) / 7) % s.interval == 0)
                     ||
                     //every week, count defined
                     (s.dtStart <= date && DbFunctions.AddDays(s.dtStart, s.count * 7) >= date && s.freq.Equals("weekly") && s.byDay.Contains(dow)
                             && (DbFunctions.DiffDays(date, DbFunctions.AddDays(s.dtStart, -s.dtStartWD)) / 7) % s.interval == 0)
                     ||
                     //every month, end date defined
                     (s.dtStart <= date && s.freq.Equals("monthly") && DbFunctions.AddMonths(s.dtStart, s.count) >= date
                              && s.byMonthDay == dom && DbFunctions.DiffMonths(date, s.dtStart) % s.interval == 0)
                     ||
                     //every month, count defined
                     (s.dtStart <= date && s.freq.Equals("monthly") && s.dtEnd >= date
                              && s.byMonthDay == dom && DbFunctions.DiffMonths(date, s.dtStart) % s.interval == 0)
                 select s;
     return tasks;
 }
 public ActionResult GetServices(int? id)
 {
     if (hasUserAccess())
     {
         if (id.HasValue)
         {
             ServicesDBContext serviceDB = new ServicesDBContext();
             var tasks = Services.listServices(serviceDB, id);
             return View(tasks);
         }
         else
         {
             return RedirectToAction("Index", "Client");
         }
     }
     return RedirectToAction("Index", "Home");
 }
Beispiel #5
0
        public static List<Services> listServices(ServicesDBContext db, int? id)
        {
            String query = "select * from Services where PatientID = " + id.ToString();

            var sqlResults = db.Services.SqlQuery(query);
            return sqlResults.ToList();
        }