public static string GetReturnUrl(string page, PathInfo path, LocationPathInfo locationPath, int reservationId, DateTime date) { string result = $"~/{page}"; string separator = "?"; if (reservationId > 0) { result += $"{separator}ReservationID={reservationId}"; separator = "&"; } if (!path.IsEmpty()) { result += $"{separator}Path={path.UrlEncode()}"; separator = "&"; } if (!locationPath.IsEmpty()) { result += $"{separator}LocationPath={locationPath.UrlEncode()}"; separator = "&"; } result += $"{separator}Date={date:yyyy-MM-dd}"; separator = "&"; return(result); }
public static LocationPathInfo Parse(string value) { LocationPathInfo result = new LocationPathInfo(); if (string.IsNullOrEmpty(value)) { return(result); } string[] splitter = value.Split(PathInfo.AllowedDelimiters); if (splitter.Length == 0) { return(result); } if (splitter.Length > 1) { result.LabID = int.Parse(splitter[0]); result.LabLocationID = int.Parse(splitter[1]); } else { result.LabID = int.Parse(splitter[0]); } return(result); }
public static string GetReservationReturnUrl(PathInfo path, LocationPathInfo locationPath, int reservationId, DateTime date, TimeSpan time, ViewType view) { var result = GetReturnUrl("Reservation.aspx", path, locationPath, reservationId, date); result += $"&Time={time.TotalMinutes}&View={view}"; // at least date will be in the query string, so definitely use '&' here return(result); }
public LocationPathInfo GetLocationPath(HttpContextBase context) { LocationPathInfo result; if (string.IsNullOrEmpty(context.Request.QueryString["LocationPath"])) { // This can happen when ending a reservation from LabLocation.aspx. The QueryString passed to this controller does not contain // the LocationPath variable but this is needed for the redirect url when View == ViewType.LocationView. var labId = context.Request.SelectedPath().LabID; var resourceId = context.Request.SelectedPath().ResourceID; var loc = Provider.Scheduler.LabLocation.GetResourceLabLocationByResource(resourceId); if (loc == null) { result = LocationPathInfo.Create(Provider.Scheduler.Resource.GetLab(labId)); } else { result = LocationPathInfo.Create(labId, loc.LabLocationID); } } else { result = context.Request.SelectedLocationPath(); } return(result); }
public static LocationPathInfo Create(ILab lab) { LocationPathInfo result = new LocationPathInfo(); if (lab != null) { result.LabID = lab.LabID; } return(result); }
public static LocationPathInfo Create(ILabLocation loc) { LocationPathInfo result = new LocationPathInfo(); if (loc != null) { result.LabID = loc.LabID; result.LabLocationID = loc.LabLocationID; } return(result); }
public static string NavigateUrl(string url, PathInfo path, LocationPathInfo locationPath) { if (!path.IsEmpty()) { url += $"&Path={path.UrlEncode()}"; } if (!locationPath.IsEmpty()) { url += $"&LocationPath={locationPath.UrlEncode()}"; } return(url); }
public string GetReservationViewReturnUrl(ViewType view, bool confirm = false, int reservationId = 0) { string result; string separator; HttpContextBase ctx = new HttpContextWrapper(HttpContext.Current); var path = ctx.Request.SelectedPath(); var date = ctx.Request.SelectedDate(); switch (view) { case ViewType.DayView: case ViewType.WeekView: result = $"~/ResourceDayWeek.aspx?Path={path.UrlEncode()}&Date={date:yyyy-MM-dd}"; separator = "&"; break; case ViewType.ProcessTechView: result = $"~/ProcessTech.aspx?Path={path.UrlEncode()}&Date={date:yyyy-MM-dd}"; separator = "&"; break; case ViewType.UserView: result = $"~/UserReservations.aspx?Date={date:yyyy-MM-dd}"; separator = "&"; break; case ViewType.LocationView: LocationPathInfo locationPath = GetLocationPath(ctx); result = $"~/LabLocation.aspx?LocationPath={locationPath.UrlEncode()}&Date={date:yyyy-MM-dd}"; separator = "&"; break; default: throw new ArgumentException($"Invalid view: {view}"); } if (confirm && reservationId > 0) { result += $"{separator}Confirm=1&ReservationID={reservationId}"; } return(result); }
public static LocationPathInfo SelectedLocationPath(this HttpRequestBase request) => LocationPathInfo.Parse(request.QueryString["LocationPath"]);
public static string GetChangeHourRangeUrl(string range, LocationPathInfo locationPath, DateTime selectedDate, ViewType view) { return($"{GetReservationControllerUrl()}?Command=ChangeHourRange&Range={range}&LocationPath={locationPath.UrlEncode()}&Date={selectedDate:yyyy-MM-dd}&View={view}"); }
public ReservationState GetReservationCell(CustomTableCell rsvCell, IReservationItem rsv, ReservationClient client, IEnumerable <IReservationProcessInfo> reservationProcessInfos, IEnumerable <IReservationInviteeItem> invitees, LocationPathInfo locationPath, ViewType view, DateTime now) { int reservationId = rsv.ReservationID; int resourceId = rsv.ResourceID; // Reservation State var args = ReservationStateArgs.Create(rsv, client, now); var state = ReservationStateUtility.Create(now).GetReservationState(args); // Tooltip Caption and Text string caption = Reservations.GetReservationCaption(state); string toolTip = Reservations.Create(Provider, now).GetReservationToolTip(rsv, state, reservationProcessInfos, invitees); rsvCell.Attributes["data-tooltip"] = toolTip; rsvCell.Attributes["data-caption"] = caption; // Remove the create reservation link if it was added. if (rsvCell.Controls.Count > 0) { rsvCell.Controls.Clear(); } // BackGround color and cursor - set by CSS rsvCell.CssClass = state.ToString(); var div = new HtmlGenericControl("div"); div.Attributes.Add("class", "reservation-container"); var cellText = rsv.DisplayName; if (rsv.RecurrenceID.GetValueOrDefault(-1) > 0) { cellText += " [R]"; } // Reservation Text Literal litReserver = new Literal { Text = $"<div class=\"cell-text\">{cellText}</div>" }; div.Controls.Add(litReserver); // Delete Button // 2/11/05 - GPR: allow tool engineers to cancel any non-started, non-repair reservation in the future ClientAuthLevel userAuth = args.UserAuth; PathInfo path = PathInfo.Create(rsv.BuildingID, rsv.LabID, rsv.ProcessTechID, rsv.ResourceID); string navurl; //if (state == ReservationState.Editable || state == ReservationState.StartOrDelete || state == ReservationState.StartOnly || (userAuth == ClientAuthLevel.ToolEngineer && DateTime.Now < rsv.BeginDateTime && rsv.ActualBeginDateTime == null && state != ReservationState.Repair)) // [2020-09-18 jg] StartOnly should not allow delete and NotInLab should allow delete if (CanDeleteReservation(state, args, now)) { navurl = UrlUtility.GetDeleteReservationUrl(rsv.ReservationID, rsvCell.CellDate, state, view); var hypDelete = new HyperLink { NavigateUrl = NavigateUrl(navurl, path, locationPath), ImageUrl = "~/images/deleteGrid.gif", CssClass = "ReservDelete" }; hypDelete.Attributes["data-tooltip"] = "Click to cancel reservation"; hypDelete.Attributes["data-caption"] = "Cancel this reservation"; div.Controls.Add(hypDelete); rsvCell.HorizontalAlign = HorizontalAlign.Left; rsvCell.VerticalAlign = VerticalAlign.Top; } // 2011/04/03 Modify button // [2020-09-18 jg] StartOnly should not allow modification (also NotInLab should not allow modification) //if (state == ReservationState.Editable || state == ReservationState.StartOrDelete || state == ReservationState.StartOnly) if (CanModifyReservation(state, args, now)) { navurl = UrlUtility.GetModifyReservationUrl(rsv.ReservationID, rsvCell.CellDate, state, view); var hypModify = new HyperLink { NavigateUrl = NavigateUrl(navurl, path, locationPath), ImageUrl = "~/images/edit.png", CssClass = "ReservModify" }; hypModify.Attributes["data-tooltip"] = "Click to modify reservation"; hypModify.Attributes["data-caption"] = "Modify this reservation"; div.Controls.Add(hypModify); rsvCell.HorizontalAlign = HorizontalAlign.Left; rsvCell.VerticalAlign = VerticalAlign.Top; } rsvCell.Controls.Add(div); return(state); }