Example #1
0
        /// <summary>
        /// 设置某张照片为相册封面
        /// </summary>
        private void SetToCover()
        {
            if (!UserLoginInfo.IsLogin)
            {
                Response.Write("请先登录。");
                return;
            }
            TUsers user = DbSession.Default.Get <TUsers>(TUsers._.UserID == UserLoginInfo.UserID);

            if (user == null)
            {
                Response.Write("请先登录。");
                return;
            }

            string aid = CommonManager.Web.Request("id", "");

            if (string.IsNullOrEmpty(aid) || !CommonManager.String.IsInteger(aid))
            {
                Response.Write("请不要尝试非法操作。");
                return;
            }
            Web_UserAlbum pic = DbSession.Default.Get <Web_UserAlbum>(Web_UserAlbum._.ID == aid && Web_UserAlbum._.UserID == user.UserID);

            if (pic == null)
            {
                Response.Write("请不要尝试非法操作。");
                return;
            }

            Web_UserAlbumColumn column = DbSession.Default.Get <Web_UserAlbumColumn>(Web_UserAlbumColumn._.ID == pic.ColumnID);

            column.Cover = pic.PicPath;
            column.Attach();
            DbSession.Default.Save <Web_UserAlbumColumn>(column);
            Response.Write("success");
        }
Example #2
0
        /// <summary>
        /// 设置某个相册排序数字最大
        /// </summary>
        private void SetAlbumTop()
        {
            if (!UserLoginInfo.IsLogin)
            {
                Response.Write("请先登录。");
                return;
            }
            TUsers user = DbSession.Default.Get <TUsers>(TUsers._.UserID == UserLoginInfo.UserID);

            if (user == null)
            {
                Response.Write("请先登录。");
                return;
            }

            string aid = CommonManager.Web.Request("id", "");

            if (string.IsNullOrEmpty(aid) || !CommonManager.String.IsInteger(aid))
            {
                Response.Write("请不要尝试非法操作。");
                return;
            }
            Web_UserAlbumColumn column = DbSession.Default.Get <Web_UserAlbumColumn>(Web_UserAlbumColumn._.ID == aid && Web_UserAlbumColumn._.UserID == user.UserID);

            if (column == null)
            {
                Response.Write("请不要尝试非法操作。");
                return;
            }

            int max = (int)DbSession.Default.Max <Web_UserAlbumColumn>(Web_UserAlbumColumn._.OrderID, Web_UserAlbumColumn._.UserID == UserLoginInfo.UserID);

            column.OrderID = max + 1;
            column.Attach();
            DbSession.Default.Save <Web_UserAlbumColumn>(column);
            Response.Write("success");
        }