internal IEnumerable<ScheduledApptsSummary> getNextBusinessDaysSchedule() { XDateTime sDate = new XDateTime(DateTime.Today.ToString(), XDateTimeType.Calendar); //remove the AddDays DateTime nextBusDate = sDate.NextBusinessDay(); //" from appts a, midn m , appt_status s, midn_status " + string sql = "select m.class year, count(m.class) count " + " from appts a, midn m , appt_status s " + " where " + " m.status=(select id from midn_status where status='Active') " + " and m.id= a.midnid " + " and s.id = a.status " + // " and s.status != 'Complete' " + " and s.status = 'Scheduled' " + " and trunc(a.dateappt)=trunc(to_date('" + nextBusDate + "' ,'MM/DD/YYYY HH:MI:SS AM') )" + " group by m.class order by m.class desc"; using (MedMidsContext db = new MedMidsContext()) { var data = db.Database.SqlQuery<ScheduledApptsSummary>(sql); return data.ToList(); } }
internal IEnumerable<Appointment> getMidnApptListByClass(string classNum, string offset) { string sql = ""; if (offset.Equals("1")) { XDateTime sDate = new XDateTime(DateTime.Today.ToString(), XDateTimeType.Calendar); //remove the AddDays DateTime nextBusDate = sDate.NextBusinessDay(); sql = "select m.alpha midnAlpha,m.id midnId,m.email midnEmail, a.id, a.appttime, c.clinic, a.comments, a.dateAppt, " + " a.dateinserted, d.lastname dr, a.visible, l.location, s.status, m.lastname|| ','||m.firstname midnName " + " from appts a, midn m ,clinic c, dr d ,location l ,appt_status s " + " where m.id=a.midnid " + " and m.status=(select id from midn_status where status='Active') " + " and c.id = a.clinic " + " and d.id = a.dr " + " and l.id = a.location " + " and s.id = a.status " + // " and s.status != 'Complete' " + " and s.status = 'Scheduled' " + " and m.class=:Y " + " and trunc(a.dateappt)=trunc(to_date('" + nextBusDate + "' ,'MM/DD/YYYY HH:MI:SS AM') )" ; } else { sql = "select m.alpha midnAlpha, m.id midnId,m.email midnEmail, a.id, a.appttime, c.clinic, a.comments, a.dateAppt, " + " a.dateinserted, d.lastname dr, a.visible, l.location, s.status, m.lastname|| ','||m.firstname midnName " + " from appts a, midn m ,clinic c, dr d ,location l ,appt_status s " + " where m.id=a.midnid " + " and m.status=(select id from midn_status where status='Active') " + " and c.id = a.clinic " + " and d.id = a.dr " + " and l.id = a.location " + " and s.id = a.status " + // " and s.status != 'Complete' " + " and s.status = 'Scheduled' " + " and m.class=:Y and trunc(a.dateappt)=trunc(current_date + " + offset + ") "; } using (MedMidsContext db = new MedMidsContext()) { var data = db.Database.SqlQuery<Appointment>(sql, new OracleParameter(":Y", classNum)); return data.ToList(); } }