Пример #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("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));
        }
        /// <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);
        }