Пример #1
0
        public static string MemberXMLGallery(int MemberID)
        {
            Member member = new Member(MemberID);

            string ThumbPath = "user/" + member.NickName + "/" + "pthmb/";
            string LargePath = "user/" + member.NickName + "/" + "plrge/";

            List <PhotoCollection> collections = member.PhotoCollection;

            StringBuilder sb = new StringBuilder();

            sb.Append(@"<?xml version=""1.0"" encoding=""UTF-8""?>");
            sb.Append(@"<gallery>");

            for (int i = 0; i < collections.Count; i++)
            {
                Photo[] photos = Photo.GetPhotoByPhotoCollectionIDWithJoin(collections[i].PhotoCollectionID);

                if (photos.Length > 0)
                {
                    object[] AlbumParameters = new object[6];
                    AlbumParameters[0] = collections[i].WebPhotoCollectionID;
                    AlbumParameters[1] = ParallelServer.Get(photos[0].ThumbnailResourceFile.FullyQualifiedURL) + photos[0].ThumbnailResourceFile.FullyQualifiedURL;
                    AlbumParameters[2] = ParallelServer.Get(LargePath) + LargePath;
                    AlbumParameters[3] = ParallelServer.Get(ThumbPath) + ThumbPath;
                    AlbumParameters[4] = collections[i].Name;
                    AlbumParameters[5] = collections[i].Description;
                    //AlbumParameters[6] = collections[i].Description;



                    //gallery title
                    sb.AppendFormat(@"  <album id=""{0}"" title=""{4}"" tn=""{1}"" lgPath=""{2}"" tnPath=""{3}"" description=""{5}"" >", AlbumParameters);

                    for (int j = 0; j < photos.Length; j++)
                    {
                        object[] PhotoParameters = new object[2];
                        PhotoParameters[0] = photos[j].PhotoResourceFile.FileName;
                        PhotoParameters[1] = string.Empty;

                        sb.AppendFormat(@"      <img src=""{0}"" caption=""{1}"" />", PhotoParameters);
                    }

                    sb.Append(@"    </album>");
                }
            }

            sb.Append(@"</gallery>");

            return(sb.ToString());
        }