活动页面添加参赛作品瀑布流
[PumpkinHouse.git] / PumpkinHouseWeb / Picture.aspx.cs
blob47c0b4d3fdf180ddd789e9100faa190d84994100
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Web;
5 using System.Web.UI;
6 using System.Web.UI.WebControls;
7 using PumpkinHouseDatabase;
8 using PumpkinHouseDatabase.Contract;
9 using PumpkinHouse.Utils;
11 namespace PumpkinHouse
13 public partial class Picture : System.Web.UI.Page
15 protected long CollectionId;
16 protected CollectionToDisplay picture;
17 protected DB_Album Album;
18 protected string JsonPicture;
19 protected string JsonUser;
21 protected void Page_Load(object sender, EventArgs e)
23 bool success = long.TryParse(Request.Params["pictureId"], out CollectionId);
24 if(!success)
26 Response.Redirect("~/404.aspx");
28 using (DataUtils utils = new DataUtils(false))
30 picture = Converter.ConvertCollectionWithOriginal(utils, utils.FindViewCollectionWithOriginalById(CollectionId), -1);
31 if (picture == null)
33 Response.Redirect("~/404.aspx");
35 string desc = picture.Description;
36 if (desc != null && desc.Length > 15)
38 desc = desc.Substring(0, 15) + "...";
40 Page.Title = desc + " À´×Ô" + picture.NickName + "ÔÚľͷºÐ×ӵķÖÏí";
42 JsonPicture = JsonHelper<CollectionToDisplay>.ConvertToJson(picture);
44 var user = Converter.ConvertUser(utils, utils.FindUserByUsername(picture.Username), 0);
45 JsonUser = JsonHelper<UserToDisplay>.ConvertToJson(user);