/// <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; 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")).ToList(); _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.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")); } _rsReservations.DataSource = Appointments; }
protected void _btnRun_Click(object sender, EventArgs e) { var db = new Urban.Data.UrbanDataContext(); var startDate = _rdpStart.SelectedDate; var endDate = _rdpEnd.SelectedDate; if (startDate != null) { startDate = ((DateTime)startDate).AddHours(0); } if (endDate != null) { endDate = ((DateTime)endDate).AddHours(23); } apptList = AppointmentUtilities.GetAppointmentObjectsByDateRangeAndRoomId(ref db, (DateTime)startDate, (DateTime)endDate, 1).ToList(); RadGrid1.Rebind(); }