コード例 #1
0
        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);
        }
コード例 #2
0
 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);
 }
コード例 #3
0
        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);
        }
コード例 #4
0
 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}");
 }