Beispiel #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        UserBll.CheckIsLogin();
        UserModel = UserBll.GetUser(UserBll.GetCookie().LogName);
        B_UserSpace.IsActive(UserModel.UserID, 1);
        if (!string.IsNullOrEmpty(Request.QueryString["PhotoId"]))
        {
            try
            {
                PhotoId = Convert.ToInt32(Request.QueryString["PhotoId"]);
            }
            catch { }
        }
        if (!string.IsNullOrEmpty(Request.QueryString["AlbumId"]))
        {
            try
            {
                AlbumId = Convert.ToInt32(Request.QueryString["AlbumId"]);
            }
            catch { }
        }
        if (PhotoId <= 0)
        {
            Function.ShowMsg(0,"<li>此照片不存在,或已经被删除</li><li><a href='javascript:history.back();'>返回上一级</a></li>");
        }
        PhotoModel = PhotoBll.GetPhotoByPhotoId(PhotoId);
         //if (txtPhoto.Text.Trim() != "")
            imgView.ImageUrl = Param.ApplicationRootPath + "/user/upload/" + "" + txtPhoto.Text.Trim();

           if (!IsPostBack)
        {
            ddlAlbumBind();
            ShowInfo(PhotoId);
        }
    }
Beispiel #2
0
 public void AddPhoto(M_UserPhoto model)
 {
     SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@AlbumId", SqlDbType.Int, 4), new SqlParameter("@FileName", SqlDbType.NVarChar), new SqlParameter("@FilePath", SqlDbType.NVarChar), new SqlParameter("@Description", SqlDbType.NVarChar), new SqlParameter("@PostTime", SqlDbType.NVarChar), new SqlParameter("@UserId", SqlDbType.Int, 4), new SqlParameter("@UserName", SqlDbType.NVarChar), new SqlParameter("@PhotoId", SqlDbType.Int, 4), new SqlParameter("@VisitNum", SqlDbType.Int, 4), new SqlParameter("@FileSize", SqlDbType.Int, 4) };
     commandParameters[0].Value = model.AlbumId;
     commandParameters[1].Value = model.FileName;
     commandParameters[2].Value = model.FilePath;
     commandParameters[3].Value = model.Description;
     commandParameters[4].Value = model.PostTime;
     commandParameters[5].Value = model.UserId;
     commandParameters[6].Value = model.UserName;
     commandParameters[7].Value = model.PhotoId;
     commandParameters[8].Value = model.VisitNum;
     commandParameters[9].Value = model.FileSize;
     SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringKy, CommandType.StoredProcedure, "Up_UserPhoto_Set", commandParameters);
 }
Beispiel #3
0
 public M_UserPhoto GetPhotoByPhotoId(int Id)
 {
     SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@PhotoId", Id) };
     DataTable table = SqlHelper.ExecuteTable(SqlHelper.ConnectionStringKy, CommandType.StoredProcedure, "Up_UserPhoto_GetByPhotoId", commandParameters);
     M_UserPhoto photo = new M_UserPhoto();
     if (table.Rows.Count > 0)
     {
         photo.FileName = table.Rows[0]["FileName"].ToString();
         photo.FilePath = table.Rows[0]["FilePath"].ToString();
         photo.PhotoId = int.Parse(table.Rows[0]["PhotoId"].ToString());
         photo.PostTime = table.Rows[0]["PostTime"].ToString();
         photo.UserId = int.Parse(table.Rows[0]["UserId"].ToString());
         photo.UserName = table.Rows[0]["UserName"].ToString();
         photo.AlbumId = int.Parse(table.Rows[0]["AlbumId"].ToString());
         photo.Description = table.Rows[0]["Description"].ToString();
         photo.VisitNum = int.Parse(table.Rows[0]["VisitNum"].ToString());
         return photo;
     }
     return null;
 }
Beispiel #4
0
 public void UpdatePhoto(M_UserPhoto model)
 {
     this.AddPhoto(model);
 }
Beispiel #5
0
 protected void ShowInfo(int PhotoId)
 {
     PhotoModel=PhotoBll.GetPhotoByPhotoId(PhotoId);
      txtPhotoName.Text = PhotoModel.FileName;
      txtDescription.Text = PhotoModel.Description;
      txtPhoto.Text = PhotoModel.FilePath;
      txtPhoto.Text = PhotoModel.FilePath;
      imgView.ImageUrl = Param.ApplicationRootPath + "/user/upload/" + "" + txtPhoto.Text.Trim();
 }
Beispiel #6
0
 public void AddPhoto(M_UserPhoto model)
 {
     this.IUP.AddPhoto(model);
 }