private void LoadSessions() { //LoadResources(); List <SessionCalendarSlot> aSessions = new List <SessionCalendarSlot>(); List <SessionsListView> sessions = sms.GetTutorSessions(CurrentUser.Email, CommonEnums.SessionStatus.All).resultObject; SessionCalendarSlot[] activeSessions; if (sessions != null) { aSessions.AddRange( sessions.Select(s => new SessionCalendarSlot() { ID = s.SessionID, CourseName = s.CourseName, StartTime = s.StartDateTime, EndTime = s.EndDateTime, TutorName = s.TutorName, Rating = s.TutorRating, Status = s.Status, MaxStudents = s.MaxStudents, RemainingSeats = s.RegisteredStudents })); activeSessions = aSessions.ToArray(); //DayPilotCalendar1.StartDate = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1); DayPilotCalendar1.Days = 7; //DateTime.DaysInMonth(DateTime.Today.Year, DateTime.Today.Month); // Display week, .Day=28 for month /* The data this calnder will display will come from activeSessions*/ DayPilotCalendar1.DataSource = activeSessions; /* Combine the data I gave you with the screen */ DayPilotCalendar1.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //LoadResources(); SessionManagementService sms = new SessionManagementService(); List <SessionCalendarSlot> aSessions = new List <SessionCalendarSlot>(); List <SessionsListView> sessions = sms.GetTutorSessions().resultObject; aSessions.AddRange( sessions.Select(s => new SessionCalendarSlot() { ID = s.SessionID, CourseName = s.CourseName, StartTime = s.StartDateTime, EndTime = s.EndDateTime, TutorName = s.TutorName, Rating = s.TutorRating })); SessionCalendarSlot[] activeSessions = aSessions.ToArray(); DayPilotCalendar1.StartDate = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1); DayPilotCalendar1.Days = 7; DayPilotCalendar1.DataSource = activeSessions; DayPilotCalendar1.DataBind(); } }