/// <summary> /// Raises the <see cref = "E:System.Web.UI.Control.Init" /> event to initialize the page. /// </summary> /// <param name = "e">An <see cref = "T:System.EventArgs" /> that contains the event data.</param> protected override void OnInit(EventArgs e) { base.OnInit(e); if (!IsPostBack) { var db = new UrbanDataContext(); //Gets the first and last day for the month switch (Type) { case 1: { ViewState["Appointments"] = AppointmentUtilities.GetAppointmentObjectsByDateRangeAndRoomId(ref db, new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1), new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddMonths(1).AddDays(-1), Utilities.GetQueryStringInt("roomId")); Page.Title = "Room Details"; break; } case 2: { ViewState["Appointments"] = AppointmentUtilities.GetAllReservedObjectsByDateRangeAndUserId(ref db, new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1), new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddMonths(1).AddDays(-1), Cu.Id); Page.Title = "Up Comming Events"; break; } case 3: { ViewState["Appointments"] = AppointmentUtilities.GetAllReservedObjectsByReservationId(ref db, Utilities.GetQueryStringInt("RoomReservationID")); Page.Title = "Reservation"; break; } } } _rsReservations.DataSource = Appointments; }
/// <summary> /// Handles the OnNavigationComplete event of the _rsReservations control. /// </summary> /// <param name = "sender">The source of the event.</param> /// <param name = "e">The <see cref = "Telerik.Web.UI.SchedulerNavigationCompleteEventArgs" /> instance containing the event data.</param> protected void _rsReservations_OnNavigationComplete(object sender, SchedulerNavigationCompleteEventArgs e) { var db = new UrbanDataContext(); var selectedDate = _rsReservations.SelectedDate; switch (Type) { case 1: { Appointments = AppointmentUtilities.GetAppointmentObjectsByDateRangeAndRoomId(ref db, new DateTime(selectedDate.Year, selectedDate.Month, 1), new DateTime(selectedDate.Year, selectedDate.Month, 1).AddMonths(1).AddDays(-1), Utilities.GetQueryStringInt("roomId")); break; } case 2: { Appointments = AppointmentUtilities.GetAllReservedObjectsByDateRangeAndUserId(ref db, new DateTime(selectedDate.Year, selectedDate.Month, 1), new DateTime(selectedDate.Year, selectedDate.Month, 1).AddMonths(1).AddDays(-1), Cu.Id); break; } case 3: { Appointments = AppointmentUtilities.GetAllReservedObjectsByReservationId(ref db, Utilities.GetQueryStringInt("RoomReservationID")); break; } } _rsReservations.DataSource = Appointments; _rsReservations.Rebind(); }
/// <summary> /// Handles the OnNavigationComplete event of the _rsReservations control. /// </summary> /// <param name = "sender">The source of the event.</param> /// <param name = "e">The <see cref = "Telerik.Web.UI.SchedulerNavigationCompleteEventArgs" /> instance containing the event data.</param> protected void _rsReservations_OnNavigationComplete(object sender, SchedulerNavigationCompleteEventArgs e) { var db = new UrbanDataContext(); var selectedDate = _rsReservations.SelectedDate; ViewState["Appointments"] = AppointmentUtilities.GetAllReservedObjectsByReservationId(ref db, RoomReservationId); _rsReservations.DataSource = Appointments; _rsReservations.Rebind(); }
/// <summary> /// Raises the <see cref = "E:System.Web.UI.Control.Init" /> event to initialize the page. /// </summary> /// <param name = "e">An <see cref = "T:System.EventArgs" /> that contains the event data.</param> protected override void OnInit(EventArgs e) { base.OnInit(e); if (!IsPostBack) { var db = new UrbanDataContext(); ViewState["Appointments"] = AppointmentUtilities.GetAllReservedObjectsByReservationId(ref db, Utilities.GetQueryStringInt("RoomReservationID")); } _rsReservations.DataSource = Appointments; }