Ejemplo n.º 1
0
        public bool AddSpaceAlbum(AlbumInfo spaceAlbum)
        {
            DbParameter[] parms =
                {
                    DbHelper.MakeInParam("@userid", (DbType)SqlDbType.Int, 4,spaceAlbum.Userid),
                    DbHelper.MakeInParam("@albumcateid", (DbType)SqlDbType.Int, 4,spaceAlbum.Albumcateid),
                    DbHelper.MakeInParam("@title", (DbType)SqlDbType.NChar, 50,spaceAlbum.Title),
                    DbHelper.MakeInParam("@description", (DbType)SqlDbType.NChar, 200,spaceAlbum.Description),
                    DbHelper.MakeInParam("@password", (DbType)SqlDbType.NChar, 50,spaceAlbum.Password),
                    DbHelper.MakeInParam("@type", (DbType)SqlDbType.Int, 8,spaceAlbum.Type),
                    DbHelper.MakeInParam("@username", (DbType)SqlDbType.NChar, 20, spaceAlbum.Username)
                };
            string commandText = String.Format("INSERT INTO [{0}albums] ([userid], [username], [albumcateid], [title], [description], [password], [altype]) VALUES ( @userid, @username, @albumcateid, @title, @description, @password, @type)", BaseConfigs.GetTablePrefix);
            //向关联表中插入相关数据
            DbHelper.ExecuteNonQuery(CommandType.Text, commandText, parms);

            return true;
        }
Ejemplo n.º 2
0
        public static AlbumInfo GetAlbumEntity(IDataReader reader)
        {
            AlbumInfo album = new AlbumInfo();

            album.Albumid = TypeConverter.ObjectToInt(reader["albumid"]);
            album.Userid = TypeConverter.ObjectToInt(reader["userid"]);
            album.Username = reader["username"].ToString();
            album.Title = reader["title"].ToString();
            album.Description = reader["description"].ToString();
            album.Logo = reader["logo"].ToString();
            album.Password = reader["password"].ToString();
            album.Imgcount = TypeConverter.ObjectToInt(reader["imgcount"]);
            album.Views = TypeConverter.ObjectToInt(reader["views"]);
            album.Type = TypeConverter.ObjectToInt(reader["altype"]);
            album.Createdatetime = reader["createdatetime"].ToString();
            album.Albumcateid = TypeConverter.ObjectToInt(reader["albumcateid"]);
            album.pl_status = TypeConverter.ObjectToInt(reader["pl_status"]);

            return album;
        }
Ejemplo n.º 3
0
 private void ModifyAlbumInfo()
 {
     string errorinfo = "";
     string id = SASRequest.GetFormString("albumid");
     if (id == "0")
     {
         AlbumInfo albumInfo = new AlbumInfo();
         albumInfo.Userid = userid;
         albumInfo.Username = username;
         albumInfo.Albumcateid = SASRequest.GetFormInt("albumcate", 0);
         albumInfo.Title = SASRequest.GetFormString("albumtitle");
         albumInfo.Description = SASRequest.GetFormString("albumdescription");
         albumInfo.Password = SASRequest.GetFormString("password");
         albumInfo.Type = SASRequest.GetFormInt("type", 0);
         Data.DbProvider.GetInstance().AddSpaceAlbum(albumInfo);
     }
     else
     {
         AlbumInfo albumInfo = DTOProvider.GetAlbumInfo(Convert.ToInt32(id));
         if (albumInfo.Userid != userid)
         {
             AddErrLine("您所编辑的相册不存在");
             return;
         }
         albumInfo.Title = SASRequest.GetFormString("albumtitle");
         albumInfo.Albumcateid = SASRequest.GetFormInt("albumcate", 0);
         albumInfo.Description = SASRequest.GetFormString("albumdescription");
         albumInfo.Password = SASRequest.GetFormString("password");
         albumInfo.Type = SASRequest.GetFormInt("type", 0);
         Data.DbProvider.GetInstance().SaveSpaceAlbum(albumInfo);
     }
     if (errorinfo == "")
     {
         SetUrl(string.Format("usercpspacemanagealbum.aspx?page={0}", SASRequest.GetInt("page", 1)));
         SetMetaRefresh();
         SetShowBackLink(true);
         if (id == "0")
             AddMsgLine("相册增加成功");
         else
             AddMsgLine("相册修改成功");
         return;
     }
     else
     {
         AddErrLine(errorinfo);
         return;
     }
 }
Ejemplo n.º 4
0
        protected override void ShowPage()
        {
            if (config.Enablealbum != 1)
            {
                AddErrLine("相册功能已被关闭");
                return;
            }

            string go = SASRequest.GetString("go");
            switch (go)
            {
                case "prev":
                    mode = 1;
                    break;
                case "next":
                    mode = 2;
                    break;
                default:
                    mode = 0;
                    break;
            }

            if (photoid < 1)
            {
                AddErrLine("指定的图片不存在");
                return;
            }

            photo = DTOProvider.GetPhotoInfo(photoid, 0, 0);
            if (photo == null)
            {
                AddErrLine("指定的图片不存在");
                return;
            }

            album = DTOProvider.GetAlbumInfo(photo.Albumid);
            if (album == null)
            {
                AddErrLine("指定的相册不存在");
                return;
            }

            if (mode != 0)
            {
                photo = DTOProvider.GetPhotoInfo(photoid, photo.Albumid, mode);
                if (photo == null)
                {
                    AddErrLine("指定的图片不存在");
                    return;
                }
            }

            if (config.Rssstatus == 1)
            {
                if (GeneralConfigs.GetConfig().Aspxrewrite == 1)
                    photorssurl = string.Format("photorss-{0}{1}", photo.Userid, GeneralConfigs.GetConfig().Extname);
                else
                    photorssurl = string.Format("rss.aspx?uid={0}&type=photo", photo.Userid);

                AddLinkRss(string.Format("tools/{0}", photorssurl), "最新图片");
            }

            pagetitle = photo.Title;
        }
Ejemplo n.º 5
0
        public bool SaveSpaceAlbum(AlbumInfo spaceAlbum)
        {
            DbParameter[] parms =
                {
                    DbHelper.MakeInParam("@albumid", (DbType)SqlDbType.Int, 4, spaceAlbum.Albumid),
                    DbHelper.MakeInParam("@albumcateid", (DbType)SqlDbType.Int, 4, spaceAlbum.Albumcateid),
                    DbHelper.MakeInParam("@title", (DbType)SqlDbType.NChar, 50,spaceAlbum.Title),
                    DbHelper.MakeInParam("@description", (DbType)SqlDbType.NChar, 200,spaceAlbum.Description),
                    DbHelper.MakeInParam("@password", (DbType)SqlDbType.NChar, 50,spaceAlbum.Password),
                    DbHelper.MakeInParam("@imgcount", (DbType)SqlDbType.Int, 4,spaceAlbum.Imgcount),
                    DbHelper.MakeInParam("@logo", (DbType)SqlDbType.NChar, 255, spaceAlbum.Logo),
                    DbHelper.MakeInParam("@type", (DbType)SqlDbType.Int, 8,spaceAlbum.Type)
                };
            string commandText = String.Format("UPDATE [{0}albums] SET [albumcateid] = @albumcateid, [title] = @title, [description] = @description, [password] = @password, [imgcount] = @imgcount, [logo] = @logo, [altype] = @type WHERE [albumid] = @albumid", BaseConfigs.GetTablePrefix);

            DbHelper.ExecuteNonQuery(CommandType.Text, commandText, parms);

            return true;
        }