Esempio n. 1
0
 protected void ShowAlbum(int Id)
 {
     AlbumModel = AlbumBll.GetAlbumById(Id,UserModel.UserID);
     if (AlbumModel == null)
         return;
     txtAlbumName.Text = AlbumModel.AlbumName;
     ImgCount = AlbumModel.ImgCount;
     ddlAlbumCate.SelectedValue = AlbumModel.AlbumCate;
     txtAlbumDescription.Text = AlbumModel.AlbumDescription;
     txtLogo.Text = AlbumModel.Logo;
     ddlIsOpened.SelectedValue = AlbumModel.IsOpened.ToString();
     txtAlbumPassword.Text = AlbumModel.AlbumPassword;
     btnSaveAs.Text = "保存修改";
 }
Esempio n. 2
0
 public string btnCheckPwd_UName(string Pwd, string albumId, string userName)
 {
     UserModel = UserBll.GetUser(userName);
     AlbumModel = AlbumBll.GetAlbumById(Convert.ToInt32(albumId), UserModel.UserID);
     if (AlbumModel.AlbumPassword != Pwd)
     {
         return "False";
     }
     else
     {
         HttpContext.Current.Response.Cookies["AlbumPwd" + albumId.ToString()].Value = albumId;
         return "True";
     }
 }
Esempio n. 3
0
 public void AddAlbum(M_UserAlbum model)
 {
     SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@Id", SqlDbType.Int, 4), new SqlParameter("@AlbumName", SqlDbType.NVarChar), new SqlParameter("@AlbumCate", SqlDbType.NVarChar), new SqlParameter("@AlbumDescription", SqlDbType.NVarChar), new SqlParameter("@ImgCount", SqlDbType.Int, 4), new SqlParameter("@Logo", SqlDbType.NVarChar), new SqlParameter("@IsOpened", SqlDbType.Int, 4), new SqlParameter("@AlbumPassword", SqlDbType.NVarChar), new SqlParameter("@AddTime", SqlDbType.NVarChar), new SqlParameter("@UserId", SqlDbType.Int, 4), new SqlParameter("@UserName", SqlDbType.NVarChar) };
     commandParameters[0].Value = model.Id;
     commandParameters[1].Value = model.AlbumName;
     commandParameters[2].Value = model.AlbumCate;
     commandParameters[3].Value = model.AlbumDescription;
     commandParameters[4].Value = model.ImgCount;
     commandParameters[5].Value = model.Logo;
     commandParameters[6].Value = model.IsOpened;
     commandParameters[7].Value = model.AlbumPassword;
     commandParameters[8].Value = model.AddTime;
     commandParameters[9].Value = model.UserId;
     commandParameters[10].Value = model.UserName;
     SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringKy, CommandType.StoredProcedure, "Up_UserAlbum_Set", commandParameters);
 }
Esempio n. 4
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["AlbumId"]))
     {
         try
         {
             AlbumId = int.Parse(Request.QueryString["AlbumId"]);
         }
         catch { }
     }
     AlbumModel = AlbumBll.GetAlbumById(AlbumId,UserModel.UserID);
     if (!IsPostBack)
     {
         repPhotoBind();
     }
 }
Esempio n. 5
0
 protected void btnPublish_Click(object sender, EventArgs e)
 {
     //PhotoModel.PhotoId
     bool flag = false;
     for (int i = 1; i <= int.Parse(txtPhotoNum.Text); i++)
     {
         txtPhoto = Request.Form["nmph" + i];
         if (txtPhoto != "")
             flag = true;
     }
     if (!flag)
     {
         Function.ShowMsg(0, "<li>未上传任何照片!</li><li><a href='javascript:history.back();'>返回上一级</a></li>");
     }
     PhotoModel.AlbumId = int.Parse(ddlAlbum.SelectedValue);
     PhotoModel.FileName = txtPhotoName.Text.Trim();
     PhotoModel.Description = txtDescription.Text.Trim();
     PhotoModel.PostTime = DateTime.Now.ToString();
     PhotoModel.UserId = UserModel.UserID;
     PhotoModel.UserName = UserModel.LogName;
     PhotoModel.VisitNum = 0;
     AlbumModel = AlbumBll.GetAlbumById(int.Parse(ddlAlbum.SelectedValue), UserModel.UserID);
     AlbumModel.Id = int.Parse(ddlAlbum.SelectedValue);
     for (int i = 1; i <= int.Parse(txtPhotoNum.Text); i++)
     {
         txtPhoto = Request.Form["nmph" + i];
         if (txtPhoto != "")
         {
             PhotoModel.FilePath = Request.Form["nmph" + i];
             AlbumModel.ImgCount += 1;
             string filepath = Param.SiteRootPath + "/user/upload/" + PhotoModel.FilePath;
             FileInfo fl = new FileInfo(filepath);
             PhotoModel.FileSize = Convert.ToInt32(fl.Length);
             PhotoBll.AddPhoto(PhotoModel);
             AlbumBll.UpdateAlbum(AlbumModel);
         }
     }
     Function.ShowMsg(1, "<li>照片上传成功!</li><li><a href='space/UploadPic.aspx?AlbumId=" + AlbumId + "'>继续上传</a></li><li><a href='space/ShowPhoto.aspx?AlbumId=" + AlbumId + "'>返回照片列表</a></li><li><a href='space/AlbumManage.aspx'>返回相册列表</a></li>");
 }
Esempio n. 6
0
 public M_UserAlbum GetAlbumById(int Id, int userId)
 {
     SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@Id", Id), new SqlParameter("@UserId", userId) };
     DataTable table = SqlHelper.ExecuteTable(SqlHelper.ConnectionStringKy, CommandType.StoredProcedure, "Up_UserAlbum_GetById", commandParameters);
     M_UserAlbum album = new M_UserAlbum();
     if (table.Rows.Count > 0)
     {
         album.Id = int.Parse(table.Rows[0]["Id"].ToString());
         album.Logo = table.Rows[0]["Logo"].ToString();
         album.AlbumName = table.Rows[0]["AlbumName"].ToString();
         album.AlbumCate = table.Rows[0]["AlbumCate"].ToString();
         album.AlbumDescription = table.Rows[0]["AlbumDescription"].ToString();
         album.ImgCount = int.Parse(table.Rows[0]["ImgCount"].ToString());
         album.IsOpened = int.Parse(table.Rows[0]["IsOpened"].ToString());
         album.AlbumPassword = table.Rows[0]["AlbumPassword"].ToString();
         album.AddTime = table.Rows[0]["AddTime"].ToString();
         album.UserId = int.Parse(table.Rows[0]["UserId"].ToString());
         album.UserName = table.Rows[0]["UserName"].ToString();
         return album;
     }
     return null;
 }
Esempio n. 7
0
 public void UpdateAlbum(M_UserAlbum model)
 {
     this.IUA.UpdateAlbum(model);
 }
Esempio n. 8
0
 public void AddAlbum(M_UserAlbum model)
 {
     this.IUA.AddAlbum(model);
 }
Esempio n. 9
0
 protected void repPhoto_ItemDataBound(object sender,RepeaterItemEventArgs e)
 {
     int recordCount = 0;
     DataTable dt = PhotoBll.GetUserPhotoById(AlbumId, UserModel.UserID,1,50, ref recordCount);
     if (dt.Rows.Count <= 0 && e.Item.ItemType==ListItemType.Footer)
     {
         Literal litMsg = (Literal)e.Item.FindControl("litMsg");
         litMsg.Text = "该相册下没有照片,请<a href='UploadPic.aspx?AlbumId="+AlbumId+"'>上传</a>!";
     }
     if(e.Item.ItemType==ListItemType.Header && AlbumId>0)
     {
         AlbumModel = AlbumBll.GetAlbumById(AlbumId, UserModel.UserID);
         Label lbRep = (Label)e.Item.FindControl("lbRepTitle");
         lbRep.Text = AlbumModel.AlbumName;
     }
 }
Esempio n. 10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!string.IsNullOrEmpty(Request.QueryString["UId"]) && !string.IsNullOrEmpty(Request.QueryString["UserName"]))
        {
            UId = Convert.ToInt32(Request.QueryString["UId"]);
            UserName = Convert.ToString(Request.QueryString["UserName"]);
            if (UserBll.GetUser(UserName) != null && UserBll.GetUser(UId) != null)
            {
                if (UId != UserBll.GetUser(UserName).UserID)
                {
                    Function.ShowMsg(0, "<li>空间参数错误</li><li><a href='javascript:history.back();'>返回上一级</a></li>");
                }
                else
                    UIdflag = true;
            }
            else
            {
                if (UserBll.GetUser(UId) == null)
                    UNameflag = true;
                else if(UserBll.GetUser(UserName) == null)
                    UIdflag=true;
                else
                    Function.ShowMsg(0, "<li>空间参数错误</li><li><a href='javascript:history.back();'>返回上一级</a></li>");
            }
        }
        if (!string.IsNullOrEmpty(Request.QueryString["UId"]) && string.IsNullOrEmpty(Request.QueryString["UserName"]))
        {
            UId = Convert.ToInt32(Request.QueryString["UId"]);
            UIdflag = true;
        }
        else if (string.IsNullOrEmpty(Request.QueryString["UId"]) && !string.IsNullOrEmpty(Request.QueryString["UserName"]))
        {
            UserName = Convert.ToString(Request.QueryString["UserName"]);
            UNameflag = true;
        }

        if (UIdflag)
        {
            UserModel = UserBll.GetUser(UId);
            picPath = "../";
        }
        else if (UNameflag)
            UserModel = UserBll.GetUser(UserName);

        if (UserModel == null)
            Function.ShowMsg(0, "<li>空间参数错误</li><li><a href='javascript:history.back();'>返回上一级</a></li>");

        if (!string.IsNullOrEmpty(Request.QueryString["AlbumId"]))
        {
            AlbumId = Convert.ToInt32(Request.QueryString["AlbumId"]);
        }
        B_UserSpace.IsActive(UserModel.UserID, 2);
        B_UserSpace spaceBll = new B_UserSpace();
        M_UserSpace spaceModel = spaceBll.GetUserSpaceById(UserModel.UserID);
        Page.Title = spaceModel.SpaceName + "--相册/照片列表";
        if (!IsPostBack)
        {
            repAblumBind();
            if (AlbumId > 0)
            {
                AlbumModel = AlbumBll.GetAlbumById(AlbumId, UserModel.UserID);
                PwdStr = AlbumModel.AlbumPassword;
                if (AlbumModel == null)
                    Function.ShowMsg(0, "<li>用户相册参数错误</li><li><a href='javascript:history.back();'>返回上一级</a></li>");
                string whereStr = "KyUserFriend.UserId=" + UserModel.UserID.ToString() + " and FriendGroupId!=2";
                int total = 0;
                DataTable dt = UserBll.ListGroupMember(whereStr, 1000, 1, ref total);
                if (!UserBll.IsLogin())
                {
                    if (AlbumModel.IsOpened == 2)
                    {
                        IsFriend.Visible = true; divPage.Visible = false;
                    }
                    else if (AlbumModel.IsOpened == 0)
                    {
                        if (HttpContext.Current.Request.Cookies["AlbumPwd" + AlbumId.ToString()] != null)
                        {
                            if (HttpContext.Current.Request.Cookies["AlbumPwd" + AlbumId.ToString()].Value != AlbumId.ToString())
                            {
                                ShowPwd.Visible = true;
                                divPage.Visible = false;
                            }
                            else { repPhotoBind(); }
                        }
                        else
                        { ShowPwd.Visible = true; divPage.Visible = false; }
                    }
                    else
                    {
                        repPhotoBind();
                    }
                }
                else
                {
                    if (AlbumModel.IsOpened == 0 && UserBll.GetCookie().UserID != UserModel.UserID)
                    {
                        if (HttpContext.Current.Request.Cookies["AlbumPwd" + AlbumId.ToString()] != null)
                        {
                            if (HttpContext.Current.Request.Cookies["AlbumPwd" + AlbumId.ToString()].Value != AlbumId.ToString())
                            {
                                ShowPwd.Visible = true; divPage.Visible = false;
                            }
                            else { repPhotoBind(); }
                        }
                        else
                        { ShowPwd.Visible = true; divPage.Visible = false; }
                    }
                    else if (AlbumModel.IsOpened == 2 && UserBll.GetCookie().UserID != UserModel.UserID)
                    {
                        bool flag = false;
                        if (dt.Rows.Count <= 0)
                            flag = false;
                        else
                        {
                            for (int i = 0; i < dt.Rows.Count; i++)
                            {
                                if (UserBll.GetCookie().UserID == int.Parse(dt.Rows[i]["FriendId"].ToString()))
                                    flag = true;
                            }
                        }
                        if (!flag)
                        { IsFriend.Visible = true; divPage.Visible = false; }
                        else
                        { repPhotoBind(); ShowPwd.Visible = false; IsFriend.Visible = false; }
                    }
                    else { repPhotoBind(); }
                }

            }
        }

        AjaxPro.Utility.RegisterTypeForAjax(typeof(userspace_Album));
    }
Esempio n. 11
0
 protected void repPhoto_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     int recordCount = 0;
     DataTable dt = PhotoBll.GetUserPhotoById(AlbumId, UserModel.UserID, AspNetPager2.CurrentPageIndex, AspNetPager2.PageSize, ref recordCount);
     repPhoto.DataSource = dt;
     Div1.Visible = true;
     lbRepTitle.Text = AlbumModel.AlbumName;
     if (e.Item.ItemType == ListItemType.Footer)
     {
         AlbumModel = AlbumBll.GetAlbumById(AlbumId, UserModel.UserID);
         if (dt.Rows.Count <= 0)
         {
             divIsHave.Attributes.Add("style","display:block");
             divPage.Visible = false;
         }
     }
 }