protected void Page_Load(object sender, EventArgs e) { AspNetPager4.PageChanged += new EventHandler(AspNetPager_PageChanged); selAlbum.SelectedIndexChanged += new EventHandler(selAlbum_ServerChange); if (IsPostBack) { return; } var ud = Session["UserData"] as UserData; var bl = new DS_Album_Br(); if (!string.IsNullOrEmpty(Request.QueryString["album"])) { try { var md = bl.CreateModel(); md.AlbumName = Request.QueryString["album"]; md.CreateDate = DateTime.Now; md.UpdateDate = DateTime.Now; md.PictureNum = 0; md.Permissions = (byte)DS_Album_Br.Permissions.公开; md.MemberID = ud.Member.ID; md.Px = 0; bl.Add(md); bl.Sort(md.ID, true); Response.Write("id=" + md.ID); Response.End(); } catch (System.Threading.ThreadAbortException ex) { } catch (Exception ex) { if (ex.Message.Contains("IX_DS_Album")) { Response.Write("已存在相同名称的相册。"); } else { Response.Write("创建相册出错。"); } Response.End(); } } var list = bl.Query("memberID=@0", "px", ud.Member.ID); selAlbum2.DataSource = selAlbum.DataSource = list; selAlbum2.DataBind(); selAlbum.DataBind(); BindDate("albumid=@0", int.Parse(selAlbum.SelectedValue)); }
protected void Page_Load(object sender, EventArgs e) { AspNetPager4.PageChanged += new EventHandler(AspNetPager_PageChanged); selAlbum.SelectedIndexChanged+=new EventHandler(selAlbum_ServerChange); if (IsPostBack) return; var ud = Session["UserData"] as UserData; var bl = new DS_Album_Br(); if (!string.IsNullOrEmpty(Request.QueryString["album"])) { try { var md = bl.CreateModel(); md.AlbumName = Request.QueryString["album"]; md.CreateDate = DateTime.Now; md.UpdateDate = DateTime.Now; md.PictureNum = 0; md.Permissions =(byte)DS_Album_Br.Permissions.不公开; md.MemberID = ud.Member.ID; md.Px = 0; bl.Add(md); bl.Sort(md.ID, true); Response.Write("id="+md.ID); Response.End(); } catch (System.Threading.ThreadAbortException ex) { } catch (Exception ex) { if (ex.Message.Contains("IX_DS_Album")) { Response.Write("已存在相同名称的相册。"); } else Response.Write("创建相册出错。"); Response.End(); } } var list = bl.Query("memberID=@0","px",ud.Member.ID); selAlbum2.DataSource = selAlbum.DataSource = list; selAlbum2.DataBind(); selAlbum.DataBind(); BindDate("albumid=@0",int.Parse(selAlbum.SelectedValue)); }
protected void Page_Load(object sender, EventArgs e) { var bl = new DS_Album_Br(); int rc = 0; int pagesize = 20; string act = Request["action"]; if (!string.IsNullOrEmpty(act)) { switch (act) { case "chgPage": Repeater1.DataSource = bl.Query("memberid=@0", "createdate desc", (int.Parse(Request["pgind"]) - 1) * 20, 20, ref rc, _userData.Member.ID); Repeater1.DataBind(); break; case "addAlbum": try { var md = bl.CreateModel(); md.AlbumName = Request["albumName"].Trim(); md.Permissions = byte.Parse(Request.Form["pm"]); md.Password = Request.Form["pwd"].Trim(); md.CreateDate = DateTime.Now; md.UpdateDate = DateTime.Now; md.PictureNum = 0; md.MemberID = _userData.Member.ID; md.Px = 0; bl.Add(md); bl.Sort(md.ID, true); rc = bl.Query("memberid=@0", "", _userData.Member.ID).Count(); Response.Write((rc % 20).Equals(0)?rc / 20:rc / 20 + 1); Response.End(); } catch (System.Threading.ThreadAbortException ex) { } catch (Exception ex) { if (ex.Message.Contains("IX_DS_Album")) { Response.Write("已存在相同名称的相册。"); } else { Response.Write("创建相册出错。"); } Response.End(); } break; case "del": try { bl.Delete(int.Parse(Request.Form["aid"])); rc = bl.Query("memberid=@0", "", _userData.Member.ID).Count(); Response.Write((rc % 20).Equals(0) ? rc / 20 : rc / 20 + 1); Response.End(); } catch (System.Threading.ThreadAbortException ex) { } catch (Exception ex) { if (ex.Message.Contains("FK_DS_AlbumImg_DS_Album")) { Response.Write("当前相册包含有图片,必须将图片删除或转移到其他相册后才能删除。"); } else { Response.Write("删除相册出错。"); } Response.End(); } break; case "editAlbum": try { var album = bl.GetSingle(int.Parse(Request.Form["id"])); album.AlbumName = Request["albumName"].Trim(); album.Permissions = byte.Parse(Request.Form["pm"]); album.Password = Request.Form["pwd"].Trim(); bl.Update(album); Response.Write(1); Response.End(); } catch (System.Threading.ThreadAbortException ex) {} catch (Exception ex) { if (ex.Message.Contains("IX_DS_Album")) { Response.Write("已存在相同名称的相册。"); } else { Response.Write("修改相册出错。"); } Response.End(); } break; } return; } if (IsPostBack) { return; } //设置左边菜单 var mst = this.Master as Member_Manage_MasterPage; mst.SetMenuTitle("图片管家", "相册管理"); Repeater1.DataSource = bl.Query("memberid=@0", "createdate desc", 0, 20, ref rc, _userData.Member.ID); Repeater1.DataBind(); ViewState["pageCount"] = (rc % 20).Equals(0)?rc / 20:rc / 20 + 1; ViewState["rc"] = rc; //绑定访问权限 Repeater2.DataSource = Enum.GetValues(typeof(Com.DianShi.BusinessRules.Album.DS_Album_Br.Permissions)); Repeater2.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { var bl = new DS_Album_Br(); int rc = 0; int pagesize = 20; string act=Request["action"]; if (!string.IsNullOrEmpty(act)) { switch (act) { case "chgPage": Repeater1.DataSource = bl.Query("memberid=@0", "createdate desc", (int.Parse(Request["pgind"])-1)*20, 20, ref rc, _userData.Member.ID); Repeater1.DataBind(); break; case "addAlbum": try { var md = bl.CreateModel(); md.AlbumName = Request["albumName"].Trim(); md.Permissions = byte.Parse(Request.Form["pm"]); md.Password=Request.Form["pwd"].Trim(); md.CreateDate = DateTime.Now; md.UpdateDate = DateTime.Now; md.PictureNum = 0; md.MemberID = _userData.Member.ID; md.Px = 0; bl.Add(md); bl.Sort(md.ID, true); rc = bl.Query("memberid=@0", "", _userData.Member.ID).Count(); Response.Write((rc%20).Equals(0)?rc/20:rc/20+1); Response.End(); } catch (System.Threading.ThreadAbortException ex) { } catch (Exception ex) { if (ex.Message.Contains("IX_DS_Album")) { Response.Write("已存在相同名称的相册。"); } else Response.Write("创建相册出错。"); Response.End(); } break; case "del": try { bl.Delete(int.Parse(Request.Form["aid"])); rc = bl.Query("memberid=@0", "", _userData.Member.ID).Count(); Response.Write((rc % 20).Equals(0) ? rc / 20 : rc / 20 + 1); Response.End(); } catch (System.Threading.ThreadAbortException ex) { } catch (Exception ex) { if (ex.Message.Contains("FK_DS_AlbumImg_DS_Album")) { Response.Write("当前相册包含有图片,必须将图片删除或转移到其他相册后才能删除。"); } else Response.Write("删除相册出错。"); Response.End(); } break; case "editAlbum": try { var album=bl.GetSingle(int.Parse(Request.Form["id"])); album.AlbumName = Request["albumName"].Trim(); album.Permissions = byte.Parse(Request.Form["pm"]); album.Password = Request.Form["pwd"].Trim(); bl.Update(album); Response.Write(1); Response.End(); } catch (System.Threading.ThreadAbortException ex){} catch (Exception ex) { if (ex.Message.Contains("IX_DS_Album")) { Response.Write("已存在相同名称的相册。"); } else Response.Write("修改相册出错。" ); Response.End(); } break; } return; } if (IsPostBack) return; //设置左边菜单 var mst = this.Master as Member_Manage_MasterPage; mst.SetMenuTitle("图片管家", "相册管理"); Repeater1.DataSource = bl.Query("memberid=@0","createdate desc",0,20,ref rc, _userData.Member.ID); Repeater1.DataBind(); ViewState["pageCount"] = (rc%20).Equals(0)?rc/20:rc/20+1; ViewState["rc"] = rc; //绑定访问权限 Repeater2.DataSource = Enum.GetValues(typeof(Com.DianShi.BusinessRules.Album.DS_Album_Br.Permissions)); Repeater2.DataBind(); }