public ActionResult CalendarTest() { List<List<object>> result = DataAccess.DataAccess.Read(Build.StringArray("Calendars", "Events"), Build.StringArray("Events.title", "Events.description", "Events.time"), Build.StringArray("Calendars.project_id = 2", "Events.calendar_id = Calendars.id")); string rString = ""; rString += result.Count + "<br />"; Calendar calendar = new Calendar(); calendar.events = new List<Event>(); foreach (List<object> row in result) { Event e = new Event(); e.title = (string)row[0]; e.description = (string)row[1]; e.time = (DateTime)row[2]; calendar.events.Add(e); rString += row.ToString() + "<br />"; foreach (object col in row) { rString += col.ToString() + "<br />"; } } return View("Calendar", calendar); }
public ActionResult Tester() { Project project = new Project(); project.calendars = new List<Calendar>(); project.auths = new List<ProjectAuth>(); project.description = "This is a static description not being pulled from the database."; project.name = "This is a static name"; List<List<object>> calendarResult = DataAccess.DataAccess.Read(Build.StringArray("Calendars"), Build.StringArray("id"), Build.StringArray("id = 1")); foreach (List<object> calendar in calendarResult) { Calendar cal = new Calendar(); cal.id = (int)calendar[0]; cal.events = new List<Event>(); List<List<object>> eventResult = DataAccess.DataAccess.Read(Build.StringArray("Events"), Build.StringArray("id", "calendar_id", "title", "description", "time"), Build.StringArray("calendar_id = " + cal.id)); foreach (List<object> evt in eventResult) { Event e = new Event(); e.id = (int)evt[0]; e.calendarId = (int)evt[1]; e.title = (string)evt[2]; e.description = (string)evt[3]; e.time = (DateTime)evt[4]; cal.events.Add(e); } project.calendars.Add(cal); } return View("Mock", project); }
public ActionResult Project(int id) { // if (!Authorized(id)) // return Redirect("/"); Session["ProjectViewed"] = id; NotificationController _notificationController = new NotificationController(); Project project = new Project(); project.calendars = new List<Calendar>(); project.auths = new List<ProjectAuth>(); project.description = "This is a static description not being pulled from the database."; project.name = "This is a static name"; project.chat = Chat(); //project.notifications = @{Html.RenderAction("NotificationView");} List<List<object>> calendarResult = DataAccess.DataAccess.Read(Build.StringArray("Calendars"), Build.StringArray("id"), Build.StringArray("project_id = " + Session["ProjectViewed"])); foreach (List<object> calendar in calendarResult) { Calendar cal = new Calendar(); cal.id = (int)calendar[0]; Session["Calendar"] = cal.id; cal.events = new List<Event>(); List<List<object>> eventResult = DataAccess.DataAccess.Read(Build.StringArray("Events"), Build.StringArray("id", "calendar_id", "title", "description", "_time"), Build.StringArray("calendar_id = " + cal.id)); foreach (List<object> evt in eventResult) { Event e = new Event(); e.id = (int)evt[0]; e.calendarId = (int)evt[1]; e.title = (string)evt[2]; e.description = (string)evt[3]; e.time = (DateTime)evt[4]; cal.events.Add(e); } project.calendars.Add(cal); } return View("Mock", project); }