温馨提示:代码在线浏览功能只能做为源码浏览参考,不能展示项目的全部,如果想更进一步了解该代码请下载:基于Ajax的邮件系统源码
当前文件路径:AjaxMail/Filter/FilterManage.aspx.cs

1using System; 2
using System.Data; 3
using System.Configuration; 4
using System.Collections; 5
using System.Web; 6
using System.Web.Security; 7
using System.Web.UI; 8
using System.Web.UI.WebControls; 9
using System.Web.UI.WebControls.WebParts; 10
using System.Web.UI.HtmlControls; 11
using Web2ASPNET2.ASPNET2AjaxMail; 12
using Web2ASPNET2.CommonOperation; 13
using Web2ASPNET2.UserCommonOperation; 14
15
public partial class Filter_FilterManage : System.Web.UI.Page 16
{ 17
protected void Page_Load(object sender,EventArgs e) 18
{ ///判断用户是否登录 19
UserInfo info = (UserInfo)UserCommonOperation.GetUserInfo(Session); 20
if(info == null) 21
{ ///返回到上一个页面 22
Response.Write("<script>history.back()</script>"); 23
Response.Redirect("~/Portal/UserLogin.aspx"); ///跳转到登录页面 24
return; 25
} 26
///绑定控件的数据 27
if(!Page.IsPostBack) 28
{ 29
BindPageData(); 30
} 31
} 32
private void BindPageData() 33
{ ///绑定控件的数据 34
Filter filter = new Filter(); 35
Web2ASPNET2.CommonOperation.DataBinder.BindGridViewData( 36
gvFilter,filter.GetFilters()); 37
} 38
39
protected string FormatFlag(string flag) 40
{ 41
switch(flag) 42
{ 43
case "0": return "关键字过滤器"; 44
case "1": return "时间过滤器"; 45
case "2": return "用户过滤器"; 46
default: return "未知类型过滤器"; 47
} 48
} 49
50
protected void gvFilter_RowDataBound(object sender,GridViewRowEventArgs e) 51
{ ///为删除按钮添加确认对话框 52
ImageButton ibtDelete = (ImageButton)e.Row.FindControl("ibtDelete"); 53
if(ibtDelete != null) 54
{ 55
ibtDelete.Attributes.Add("onclick","return confirm('你确定要删除所选择的数据行吗?');"); 56
} 57
} 58
protected void gvFilter_RowCommand(object sender,GridViewCommandEventArgs e) 59
{ ///重定向到编辑页面 60
if(e.CommandName == "update") 61
{ 62
Response.Redirect("~/Filter/UpdateFilter.aspx?FilterID=" + e.CommandArgument.ToString()); 63
} 64
if(e.CommandName == "del") 65
{ ///执行删除操作 66
Filter filter = new Filter(); 67
filter.DeleteFilter(DataTypeConvert.ConvertToInt(e.CommandArgument.ToString())); 68
///重新绑定控件数据 69
BindPageData(); 70
} 71
} 72
protected void btnAdd_Click(object sender,EventArgs e) 73
{ ///页面重定向 74
Response.Redirect("~/Filter/KeyFilter.aspx"); 75
} 76
} 77





}
}