Exemplo n.º 1
0
 public static string GetChangeHourRangeUrl(string range, PathInfo path, DateTime selectedDate, ViewType view)
 {
     return($"{GetReservationControllerUrl()}?Command=ChangeHourRange&Range={range}&Path={path.UrlEncode()}&Date={selectedDate:yyyy-MM-dd}&View={view}");
 }
Exemplo n.º 2
0
 public ResourceTableItem(HttpContextBase context, IBuilding bld, ILab lab, IProcessTech pt, IResource res)
 {
     _context        = context;
     BuildingID      = bld.BuildingID;
     LabID           = lab.LabID;
     ProcessTechID   = pt.ProcessTechID;
     ResourceID      = res.ResourceID;
     BuildingName    = bld.BuildingName;
     LabName         = lab.LabDisplayName;
     ProcessTechName = pt.ProcessTechName;
     ResourceName    = res.ResourceName;
     LabUrl          = VirtualPathUtility.ToAbsolute(string.Format("~/Lab.aspx?Path={0}&Date={1:yyyy-MM-dd}", PathInfo.Create(lab), _context.Request.SelectedDate()));
     ProcessTechUrl  = VirtualPathUtility.ToAbsolute(string.Format("~/ProcessTech.aspx?Path={0}&Date={1:yyyy-MM-dd}", PathInfo.Create(pt), _context.Request.SelectedDate()));
     ResourceUrl     = VirtualPathUtility.ToAbsolute(string.Format("~/ResourceDayWeek.aspx?Path={0}&Date={1:yyyy-MM-dd}", PathInfo.Create(res), _context.Request.SelectedDate()));
 }
Exemplo n.º 3
0
        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);
        }