protected void Page_Load(object sender, EventArgs e) { var bl = new DS_AlbumImg_Br(); var albbl = new DS_Album_Br(); if (IsPostBack) { return; } //处理ajax动作 string act = Request.Form["action"]; if (!string.IsNullOrEmpty(act)) { var json = new JavaScriptSerializer(); switch (act) { case "loadimgdata": Response.Write(json.Serialize(bl.GetSingle(int.Parse(Request.Form["img_id"])))); break; case "save": var img = bl.GetSingle(int.Parse(Request.Form["img_id"])); img.ImgTitle = Request.Form["title"].Trim(); img.ImgDescript = Request.Form["des"].Trim(); bl.Update(img); break; } Response.End(); return; } //设置左边菜单 var mst = this.Master as Member_Manage_MasterPage; mst.SetMenuTitle("图片管家", "相册管理"); var md = bl.GetSingle(int.Parse(Request.QueryString["img_id"])); var album = albbl.GetSingle(md.AlbumID); ViewState["albname"] = album.AlbumName; ViewState["albid"] = album.ID; ViewState["imgtitle"] = md.ImgTitle; ViewState["imgurl"] = "/Resource/" + md.ImgUrl + "/" + md.ImgName; ViewState["FrontCover"] = string.IsNullOrEmpty(album.FrontCover)?"":album.FrontCover.Substring(album.FrontCover.LastIndexOf("/") + 1); //绑定图片 Repeater1.DataSource = bl.Query("albumid=@0", "px", md.AlbumID); Repeater1.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; } 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) { var bl = new DS_AlbumImg_Br(); var albbl = new DS_Album_Br(); if (IsPostBack) return; //处理ajax动作 string act=Request.Form["action"]; if (!string.IsNullOrEmpty(act)) { var json = new JavaScriptSerializer(); switch (act) { case "loadimgdata": Response.Write(json.Serialize(bl.GetSingle(int.Parse(Request.Form["img_id"])))); break; case "save": var img= bl.GetSingle(int.Parse(Request.Form["img_id"])); img.ImgTitle=Request.Form["title"].Trim(); img.ImgDescript=Request.Form["des"].Trim(); bl.Update(img); break; } Response.End(); return; } //设置左边菜单 var mst = this.Master as Member_Manage_MasterPage; mst.SetMenuTitle("图片管家", "相册管理"); var md=bl.GetSingle(int.Parse(Request.QueryString["img_id"])); var album = albbl.GetSingle(md.AlbumID); ViewState["albname"] = album.AlbumName; ViewState["albid"] = album.ID; ViewState["imgtitle"] = md.ImgTitle; ViewState["imgurl"] ="/Resource/"+ md.ImgUrl + "/" + md.ImgName; ViewState["FrontCover"] = string.IsNullOrEmpty(album.FrontCover)?"":album.FrontCover.Substring(album.FrontCover.LastIndexOf("/")+1); //绑定图片 Repeater1.DataSource = bl.Query("albumid=@0","px",md.AlbumID); Repeater1.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(); }