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) { if (IsPostBack) return; int album_id=int.Parse(Request.QueryString["album_id"]); int member_id = _vMember.ID; var bl = new DS_AlbumImg_Br(); Repeater1.DataSource = bl.Query("albumid=@0","px",album_id); Repeater1.DataBind(); var albbl = new DS_Album_Br(); var album = albbl.GetSingle(album_id); ViewState["albumName"] = album.AlbumName.Length>6?album.AlbumName.Substring(0,6)+"..":album.AlbumName; Repeater2.DataSource = albbl.Query("memberid=@0 and PictureNum>0 and Permissions!=@1", "updatedate desc", member_id, (byte)DS_Album_Br.Permissions.不公开); Repeater2.DataBind(); }
private void BindData(string sql, params object[] param) { ViewState["sql"] = sql; ViewState["param"] = param; var bl = new DS_Album_Br(); int rc = 0; Repeater1.DataSource = bl.Query(sql, "updatedate desc", (AspNetPager4.CurrentPageIndex - 1) * AspNetPager4.PageSize, AspNetPager4.PageSize, ref rc, param); Repeater1.DataBind(); if (!IsPostBack) { AspNetPager4.RecordCount = rc; AspNetPager4.TextBeforePageIndexBox = "共" + AspNetPager4.PageCount + "页 第"; } }
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) { if (IsPostBack) return; //设置左边菜单 var mst = this.Master as Member_Manage_MasterPage; mst.SetMenuTitle("图片管家", "上传图片"); var bl = new DS_Album_Br(); Repeater1.DataSource = bl.Query("memberid=@0","createdate desc", _userData.Member.ID); Repeater1.DataBind(); //绑定访问权限 Repeater2.DataSource = Enum.GetValues(typeof(Com.DianShi.BusinessRules.Album.DS_Album_Br.Permissions)); Repeater2.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { return; } int album_id = int.Parse(Request.QueryString["album_id"]); int member_id = _vMember.ID; var bl = new DS_AlbumImg_Br(); Repeater1.DataSource = bl.Query("albumid=@0", "px", album_id); Repeater1.DataBind(); var albbl = new DS_Album_Br(); var album = albbl.GetSingle(album_id); ViewState["albumName"] = album.AlbumName.Length > 6?album.AlbumName.Substring(0, 6) + "..":album.AlbumName; Repeater2.DataSource = albbl.Query("memberid=@0 and PictureNum>0 and Permissions!=@1", "updatedate desc", member_id, (byte)DS_Album_Br.Permissions.公开); Repeater2.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { return; } //设置左边菜单 var mst = this.Master as Member_Manage_MasterPage; mst.SetMenuTitle("图片管家", "上传图片"); var bl = new DS_Album_Br(); Repeater1.DataSource = bl.Query("memberid=@0", "createdate desc", _userData.Member.ID); Repeater1.DataBind(); //绑定访问权限 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_AlbumImg_Br(); var albbl = new DS_Album_Br(); int rc = 0; int pagesize = 16; string act=Request["action"]; if (!string.IsNullOrEmpty(act)) { switch (act) { case "chgPage": Repeater4.DataSource = bl.Query("AlbumID=@0", "", (int.Parse(Request["pgind"]) - 1) * pagesize, pagesize, ref rc, int.Parse(Request.QueryString["id"])); Repeater4.DataBind(); break; case "setcovert": var album = albbl.GetSingle(int.Parse(Request.Form["albumid"])); album.FrontCover=Request.Form["src"]; albbl.Update(album); Response.End(); break; case "del": try { bl.Delete(Request.Form["id"].TrimEnd(',')); rc = bl.Query("AlbumID=@0", "", int.Parse(Request.Form["albumid"])).Count(); Response.Write((rc % pagesize).Equals(0) ? rc / pagesize : rc / pagesize + 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("删除图片出错。" + ex.Message); Response.End(); } break; } return; } if (IsPostBack) return; //设置左边菜单 var mst = this.Master as Member_Manage_MasterPage; mst.SetMenuTitle("图片管家", "相册管理"); //绑定访问权限 Repeater2.DataSource = Enum.GetValues(typeof(Com.DianShi.BusinessRules.Album.DS_Album_Br.Permissions)); Repeater2.DataBind(); //绑定当前相册属性 var alb= albbl.Query("id=@0", "",int.Parse(Request.QueryString["id"])); Repeater3.DataSource =alb; Repeater3.DataBind(); ViewState["albname"] = alb.Single().AlbumName; //绑定图片列表 Repeater4.DataSource = bl.Query("AlbumID=@0", "", 0, pagesize, ref rc, int.Parse(Request.QueryString["id"])); Repeater4.DataBind(); ViewState["pageCount"] = (rc % pagesize).Equals(0) ? rc / pagesize : rc / pagesize + 1; ViewState["rc"] = rc; }
protected void Page_Load(object sender, EventArgs e) { var bl = new DS_AlbumImg_Br(); var albbl = new DS_Album_Br(); int rc = 0; int pagesize = 16; string act = Request["action"]; if (!string.IsNullOrEmpty(act)) { switch (act) { case "chgPage": Repeater4.DataSource = bl.Query("AlbumID=@0", "", (int.Parse(Request["pgind"]) - 1) * pagesize, pagesize, ref rc, int.Parse(Request.QueryString["id"])); Repeater4.DataBind(); break; case "setcovert": var album = albbl.GetSingle(int.Parse(Request.Form["albumid"])); album.FrontCover = Request.Form["src"]; albbl.Update(album); Response.End(); break; case "del": try { bl.Delete(Request.Form["id"].TrimEnd(',')); rc = bl.Query("AlbumID=@0", "", int.Parse(Request.Form["albumid"])).Count(); Response.Write((rc % pagesize).Equals(0) ? rc / pagesize : rc / pagesize + 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("删除图片出错。" + ex.Message); } Response.End(); } break; } return; } if (IsPostBack) { return; } //设置左边菜单 var mst = this.Master as Member_Manage_MasterPage; mst.SetMenuTitle("图片管家", "相册管理"); //绑定访问权限 Repeater2.DataSource = Enum.GetValues(typeof(Com.DianShi.BusinessRules.Album.DS_Album_Br.Permissions)); Repeater2.DataBind(); //绑定当前相册属性 var alb = albbl.Query("id=@0", "", int.Parse(Request.QueryString["id"])); Repeater3.DataSource = alb; Repeater3.DataBind(); ViewState["albname"] = alb.Single().AlbumName; //绑定图片列表 Repeater4.DataSource = bl.Query("AlbumID=@0", "", 0, pagesize, ref rc, int.Parse(Request.QueryString["id"])); Repeater4.DataBind(); ViewState["pageCount"] = (rc % pagesize).Equals(0) ? rc / pagesize : rc / pagesize + 1; ViewState["rc"] = rc; }
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(); }