コード例 #1
0
        /// <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 = "System.EventArgs" /> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            InitPage("Room Details", MainTabs.FindARoom);

            if (CurrentUserUtilities.GetCuIdSafely() <= 0)
            {
                RadToolTip1.Enabled      = false;
                _rRating.ReadOnly        = true;
                _rsReservations.ReadOnly = true;
            }

            if (Page.IsPostBack)
            {
                return;
            }

            RoomId = Utilities.GetQueryStringInt("RoomId");
            if (RoomId <= 0)
            {
                RadAjaxManager.GetCurrent(Page).Redirect("~/Default.aspx?message=Invalid room");
            }
            var db   = new UrbanDataContext();
            var room = db.Manager.Room.GetByKey(RoomId);

            if (room == null)
            {
                RadAjaxManager.GetCurrent(Page).Redirect("~/Default.aspx?message=Invalid room");
            }

            LoadPageFields(room);
        }
コード例 #2
0
        /// <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 = "System.EventArgs" /> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Page.IsPostBack)
            {
                return;
            }

            RoomId = Utilities.GetQueryStringInt("RoomId");
            if (RoomId <= 0)
            {
                RadAjaxManager.GetCurrent(Page).Redirect("~/Default.aspx?message=Invalid room");
            }
            var db   = new UrbanDataContext();
            var room = db.Manager.Room.GetByKey(RoomId);



            if (CurrentUserUtilities.GetCuIdSafely() <= 0 || room == null || room.UserID != Cu.Id)
            {
                RadAjaxManager.GetCurrent(Page).Redirect("~/Default.aspx?message=Invalid room");
                return;
            }

            _txtRoomNumber.Text   = room.Number;
            _txtBuildingName.Text = room.Building.Name;
        }
コード例 #3
0
        /// <summary>
        ///     Handles the PreInit event of the BasePage control and security
        /// </summary>
        /// <param name = "sender">The source of the event.</param>
        /// <param name = "e">The <see cref = "System.EventArgs" /> instance containing the event data.</param>
        private void BasePage_PreInit(object sender, EventArgs e)
        {
            //Checks if the current user has expired and if so then redirect them to login.
            var redirectCheck = false;

            if (HttpContext.Current.Session == null)
            {
                redirectCheck = true;
            }
            else if (CurrentUserUtilities.GetCurrentUser() == null)
            {
                redirectCheck = true;
            }

            if (!redirectCheck)
            {
                return;
            }

            //If user is on these pages it is not required that they are authenticated.
            if (Page is Default || Page is FindARoom || Page is PostARoom || Page is RoomDetails || Page is pUserCreation || Page is SchedulePrint)
            {
                return;
            }

            Response.Redirect(string.Format("~/Default.aspx?message=Logged out due to inactivity&ReturnUrl={0}", HttpUtility.UrlEncode(Request.Url.AbsolutePath)));
        }
コード例 #4
0
        /// <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 = "System.EventArgs" /> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            InitPage("Post A Room", MainTabs.PostARoom);

            //If current user is null then only show image instead.
            if (CurrentUserUtilities.GetCuIdSafely() <= 0)
            {
                _pnlPostARoom.Visible       = false;
                _pnlPostARoom.Enabled       = false;
                _pnlCreateNoAccount.Visible = true;
                _pnlCreateNoAccount.Enabled = true;
                return;
            }

            if (Page.IsPostBack)
            {
                return;
            }

            if (_cbState.Items.Count > 0)
            {
                return;
            }

            //Load state information.
            _cbState.LoadXml(Utilities.GetXmlForPath(Utilities.StatePathWithNoneXml));
            _cbState.FindItemByValue("NULL").Selected = true;
            _cbRoomType.Items.AddRange(RoomTypeUtilties.GetAll(true));
            _cbBuilding.Items.AddRange(BuildingUtilities.GetByUserId(Cu.Id, true));
        }
コード例 #5
0
 /// <summary>
 ///     Sets the login controls.
 /// </summary>
 private void SetLoginControls()
 {
     if (CurrentUserUtilities.GetCuIdSafely() > 0)
     {
         _lblEmail.Text            = Cu.Email;
         _lblEmail.Visible         = true;
         _txtEmail.Visible         = false;
         _txtPassword.Visible      = false;
         _btnLogin.Visible         = false;
         _btnLogout.Visible        = true;
         _btnCreateAccount.Visible = false;
         _pnlLoggedIn.Visible      = true;
         _pnlUserLoggedIn.Visible  = false;
     }
     else
     {
         _lblEmail.Visible         = false;
         _txtEmail.Visible         = true;
         _txtPassword.Visible      = true;
         _btnLogin.Visible         = true;
         _btnLogout.Visible        = false;
         _btnCreateAccount.Visible = true;
         _pnlLoggedIn.Visible      = false;
         _pnlUserLoggedIn.Visible  = true;
     }
 }
コード例 #6
0
        /// <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 = "System.EventArgs" /> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            BuildingId = Utilities.GetQueryStringInt("BuildingId");

            InitPage(BuildingId > 0 ? "Edit Building Details" : "Create Building", MainTabs.MyAccount);

            if (Page.IsPostBack)
            {
                return;
            }

            if (BuildingId < 0)
            {
                RadAjaxManager.GetCurrent(Page).Redirect(String.Format("~/Default.aspx?message={0}&messageType={1}", "Invalid Building", FeedbackType.Error));
            }
            var db       = new UrbanDataContext();
            var building = db.Manager.Building.GetByKey(BuildingId);

            if (CurrentUserUtilities.GetCuIdSafely() <= 0 || (building != null && building.UserID != Cu.Id))
            {
                RadAjaxManager.GetCurrent(Page).Redirect(String.Format("~/Default.aspx?message={0}&messageType={1}", "Invalid Building", FeedbackType.Error));
            }
            _cbState.LoadXml(Utilities.GetXmlForPath(Utilities.StatePathWithNoneXml));
            LoadPageFields(building);
        }
コード例 #7
0
        /// <summary>
        /// Handles the Click event of the _btnBack control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void _btnBack_Click(object sender, EventArgs e)
        {
            var db   = new UrbanDataContext();
            var room = db.Manager.Room.GetByKey(RoomId);


            if (CurrentUserUtilities.GetCuIdSafely() > 0 && room.UserID == Cu.Id)
            {
                RadAjaxManager.GetCurrent(Page).Redirect(String.Format("MyAccount.aspx"));
            }
            else
            {
                RadAjaxManager.GetCurrent(Page).Redirect("FindARoom.aspx");
            }
        }
コード例 #8
0
        /// <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 = "System.EventArgs" /> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Page.IsPostBack)
            {
                return;
            }

            var myAccountTab = _rtsMenu.FindTabByValue("MyAccount");

            myAccountTab.Visible = CurrentUserUtilities.GetCuIdSafely() > 0;

            if (Utilities.GetQueryStringSafe("message") != string.Empty)
            {
                WriteFeedBackMaster(Utilities.GetQueryStringSafe("messageType") != string.Empty ? Utilities.GetQueryStringSafe("messageType") : FeedbackType.Success, Utilities.GetQueryStringSafe("message"));
            }
        }
コード例 #9
0
        /// <summary>
        ///     Loads the page fields.
        /// </summary>
        /// <param name = "room">The room.</param>
        private void LoadPageFields(Room room)
        {
            //Room Information
            _txtRoomTitle.Text       = room.Title;
            _txtRoomNumber.Text      = room.Number;
            _txtMaxOccupancy.DbValue = room.MaxOccupancy;
            _txtRoomType.Text        = room.RoomType.Name;

            //Address Information
            _txtBuildingName.Text     = room.Building.Name;
            _txtPrimaryAddress.Text   = room.Building.PrimaryAddress;
            _txtSecondaryAddress.Text = room.Building.SecondaryAddress;
            _txtState.Text            = room.Building.State;
            _txtCity.Text             = room.Building.City;
            _txtZip.Text = room.Building.Zip;

            //Description
            _litDescription.Text = room.Description;

            if (CurrentUserUtilities.GetCuIdSafely() > 0 && room.UserID != Cu.Id)
            {
                _btnReserve.Visible = true;
                _btnReserve.Enabled = true;
            }
            else
            {
                _btnReserve.Visible = false;
                _btnReserve.Enabled = false;
            }
            _rRating.Value    = RoomCommentsUtilities.GetRatingForRoomAndComments(RoomId);
            _litComments.Text = RoomCommentsUtilities.BuildCommentsForRoom(RoomId);

            var imageLinks = room.RoomImageLinkList;

            var sb2 = new StringBuilder();

            foreach (var image in imageLinks)
            {
                sb2.Append(String.Format("<a href='{0}' rel='prettyPhoto[pp_gal]' title='{1}'>", "../../files/" + image.FileFiles.ServerFileName, image.ImageDescription == null || image.ImageDescription.Trim() == String.Empty ? "" : image.ImageDescription));
                sb2.Append(String.Format("<img src='{0}' height='100' alt='{1}' />", "../../files/" + image.FileFiles.ServerFileName, image.Title == null || image.Title.Trim() == String.Empty ? "" : image.Title));
                sb2.Append("</a>");
            }

            _litPrettyPhoto.Text = sb2.ToString();
        }
コード例 #10
0
        /// <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 = "System.EventArgs" /> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            InitPage("Edit Room Details", MainTabs.MyAccount);
            if (Page.IsPostBack)
            {
                return;
            }

            RoomId = Utilities.GetQueryStringInt("RoomId");
            if (RoomId <= 0)
            {
                RadAjaxManager.GetCurrent(Page).Redirect(String.Format("~/Default.aspx?message={0}&messageType={1}", "Invalid room", FeedbackType.Warning));
            }
            var db   = new UrbanDataContext();
            var room = db.Manager.Room.GetByKey(RoomId);

            if (CurrentUserUtilities.GetCuIdSafely() <= 0 || room == null || room.UserID != Cu.Id)
            {
                RadAjaxManager.GetCurrent(Page).Redirect(String.Format("~/Default.aspx?message={0}&messageType={1}", "Invalid room", FeedbackType.Warning));
            }
            _cbRoomType.Items.AddRange(RoomTypeUtilties.GetAll(false));
            _cbBuilding.Items.AddRange(BuildingUtilities.GetByUserId(Cu.Id, false));
            LoadPageFields(room);
        }