/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> /// <exception cref="System.ApplicationException">Permission denied for this Booking.</exception> protected void Page_Load(object sender, EventArgs e) { //IsLargeContentArea = true; if (!IsPostBack) { Data.Booking booking = GetBL <InventoryBL>().GetBooking(BookingId); if (booking != null) { bool hasAdimnRights = Support.IsCompanyAdministrator(this.CompanyId) || Support.IsCompanyInventoryStaffMember(this.CompanyId); if (hasAdimnRights) { hyperLinkInventorySharing.NavigateUrl = ResolveUrl(string.Format("~/Inventory/InventorySharing.aspx?CompanyId={0}", this.CompanyId)); editBookingDetails.IsToDateChange = IsToDateChange; editBookingDetails.CompanyId = CompanyId; editBookingDetails.IsInventoryManager = true; editBookingDetails.ViewingCompanyId = CompanyId; editBookingDetails.ItemTypeId = ItemTypeId; editBookingDetails.BookingId = BookingId; editBookingDetails.CallBackURL = string.Format("~/Inventory/BookingDetails.aspx?BookingId={0}&CompanyId={1}", BookingId, CompanyId); StageBitz.Data.Company company = DataContext.Companies.Where(c => c.CompanyId == this.CompanyId).FirstOrDefault(); DisplayTitle = string.Concat(Support.TruncateString(company.CompanyName, 30), "'s Inventory"); lnkCompanyInventory.HRef = ResolveUrl(string.Format("~/Inventory/CompanyInventory.aspx?CompanyId={0}", this.CompanyId)); hyperLinkMyBooking.NavigateUrl = string.Format("~/Inventory/MyBookings.aspx?CompanyId={0}", this.CompanyId); LoadBreadCrumbs(company); } else { throw new ApplicationException("Permission denied for this Booking."); } } } }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> /// <exception cref="System.ApplicationException">Permission denied for this Booking.</exception> protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Data.Booking booking = GetBL <InventoryBL>().GetBooking(BookingId); if (booking != null) { if (booking.RelatedTable == "NonProject" && GetBL <InventoryBL>().GetNonProjectBooking(BookingId).CreatedBy == UserID) { hyperLinkInventorySharing.NavigateUrl = ResolveUrl(string.Format("~/Inventory/InventorySharing.aspx?CompanyId={0}", this.CompanyId)); editBookingDetails.IsToDateChange = IsToDateChange; editBookingDetails.CompanyId = CompanyId; editBookingDetails.ViewingCompanyId = ViewingCompanyId; editBookingDetails.ItemTypeId = ItemTypeId; editBookingDetails.BookingId = BookingId; editBookingDetails.IsInventoryManager = false; editBookingDetails.CallBackURL = string.Format("~/Inventory/MyBookingDetails.aspx?BookingId={0}&CompanyId={1}", BookingId, CompanyId); StageBitz.Data.Company company = DataContext.Companies.Where(c => c.CompanyId == this.CompanyId).FirstOrDefault(); DisplayTitle = "Change Booking Dates"; lnkCompanyInventory.HRef = ResolveUrl(string.Format("~/Inventory/CompanyInventory.aspx?CompanyId={0}", this.CompanyId)); hyperLinkMyBooking.NavigateUrl = string.Format("~/Inventory/MyBookings.aspx?CompanyId={0}", this.CompanyId); LoadBreadCrumbs(company); } else { throw new ApplicationException("Permission denied for this Booking."); } } } }
/// <summary> /// Loads the bread crumbs. /// </summary> /// <param name="company">The company.</param> private void LoadBreadCrumbs(StageBitz.Data.Company company) { BreadCrumbs bc = GetBreadCrumbsControl(); string companyUrl = Support.IsCompanyAdministrator(company.CompanyId) ? string.Format("~/Company/CompanyDashboard.aspx?CompanyId={0}", company.CompanyId) : null; bc.AddLink(company.CompanyName, companyUrl); bc.AddLink(DisplayTitle, null); bc.LoadControl(); }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> /// <exception cref="System.ApplicationException"> /// Permission denied for this Booking. /// or /// Booking does not exist. /// </exception> protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Data.Booking booking = GetBL <InventoryBL>().GetBooking(BookingId); if (booking != null && (GetBL <InventoryBL>().GetNonProjectBooking(BookingId).CreatedBy != UserID || booking.RelatedTable == "Project")) { throw new ApplicationException("Permission denied for this Booking."); } if (booking == null) { throw new ApplicationException("Booking does not exist."); } bookingDetails.BookingId = BookingId; bookingDetails.CompanyId = CompanyId; bookingDetails.DisplayMode = UserWeb.Controls.Inventory.BookingDetails.ViewMode.NonProject; StageBitz.Data.Company company = this.GetBL <CompanyBL>().GetCompany(CompanyId); //Get NonProject BookingName if (booking.RelatedTable == "NonProject") { DisplayTitle = "Bookings"; } lnkCompanyInventory.HRef = ResolveUrl(string.Format("~/Inventory/CompanyInventory.aspx?CompanyId={0}", this.CompanyId)); hyperLinkMyBooking.NavigateUrl = string.Format("~/Inventory/MyBookings.aspx?CompanyId={0}", this.CompanyId); if (Support.IsCompanyAdministrator(this.CompanyId) || Support.IsCompanyInventoryStaffMember(this.CompanyId)) { spnInventorySharing.Visible = true; hyperLinkInventorySharing.NavigateUrl = ResolveUrl(string.Format("~/Inventory/InventorySharing.aspx?CompanyId={0}", this.CompanyId)); } else { spnInventorySharing.Visible = false; } LoadBreadCrumbs(company); } }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> /// <exception cref="System.ApplicationException">Permission denied for this Company.</exception> protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { bookingDetails.BookingId = BookingId; bookingDetails.CompanyId = CompanyId; if (!(Support.IsCompanyAdministrator(this.CompanyId) || Support.IsCompanyInventoryStaffMember(this.CompanyId))) { throw new ApplicationException("Permission denied for this Company."); } hyperLinkInventorySharing.NavigateUrl = ResolveUrl(string.Format("~/Inventory/InventorySharing.aspx?CompanyId={0}", this.CompanyId)); StageBitz.Data.Company company = DataContext.Companies.Where(c => c.CompanyId == this.CompanyId).FirstOrDefault(); DisplayTitle = string.Concat(Support.TruncateString(company.CompanyName, 30), "'s Inventory"); lnkCompanyInventory.HRef = ResolveUrl(string.Format("~/Inventory/CompanyInventory.aspx?CompanyId={0}", this.CompanyId)); hyperLinkMyBooking.NavigateUrl = string.Format("~/Inventory/MyBookings.aspx?CompanyId={0}", this.CompanyId); LoadBreadCrumbs(company); } }