129 lines
3.8 KiB
C#
129 lines
3.8 KiB
C#
using BLL;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace FineUIPro.Web.SendEmail
|
|
{
|
|
public partial class SendEmailTemplateList : PageBase
|
|
{
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
BindGrid();
|
|
}
|
|
}
|
|
|
|
#region BindGrid
|
|
|
|
private void BindGrid()
|
|
{
|
|
List<Model.SendEmailTemplate> senList = new List<Model.SendEmailTemplate>();
|
|
senList = BLL.SendEmail.SendEmailTemplateService.GetSendEmailTemplateList();
|
|
Grid1.RecordCount = senList.Count;
|
|
Grid1.DataSource = senList;
|
|
Grid1.DataBind();
|
|
}
|
|
|
|
#region 表头过滤
|
|
protected void Grid1_FilterChange(object sender, EventArgs e)
|
|
{
|
|
BindGrid();
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// 分页下拉选择
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
|
|
BindGrid();
|
|
}
|
|
|
|
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
|
|
{
|
|
Grid1.PageIndex = e.NewPageIndex;
|
|
BindGrid();
|
|
}
|
|
|
|
protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e)
|
|
{
|
|
Grid1.SortDirection = e.SortDirection;
|
|
Grid1.SortField = e.SortField;
|
|
|
|
BindGrid();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnAdd_Click(object sender, EventArgs e)
|
|
{
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("SendEmailTemplate.aspx", null, "添加 - ")));
|
|
}
|
|
|
|
protected void Window1_Close(object sender, WindowCloseEventArgs e)
|
|
{
|
|
BindGrid();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 右键编辑事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnMenuEdit_Click(object sender, EventArgs e)
|
|
{
|
|
if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
{
|
|
Alert.ShowInParent("Please select at least one record!");
|
|
return;
|
|
}
|
|
string Id = Grid1.SelectedRowID;
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("SendEmailTemplate.aspx?id={0}", Id, "编辑 - ")));
|
|
}
|
|
|
|
/// <summary>
|
|
/// 删除
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Grid1_RowCommand(object sender, GridCommandEventArgs e)
|
|
{
|
|
if (e.CommandName == "Delete")
|
|
{
|
|
HiddenField hidMailId = Grid1.Rows[e.RowIndex].FindControl("hidEmailId") as HiddenField;
|
|
if (!string.IsNullOrEmpty(hidMailId.Text))
|
|
{
|
|
var tempModel = Funs.DB.SendEmailTemplate.FirstOrDefault(p => p.EmailId == hidMailId.Text);
|
|
Funs.DB.SendEmailTemplate.DeleteOnSubmit(tempModel);
|
|
Funs.DB.SubmitChanges();
|
|
BindGrid();
|
|
ShowNotify("删除成功!", MessageBoxIcon.Success);
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Grid双击事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
|
|
{
|
|
btnMenuEdit_Click(null, null);
|
|
}
|
|
}
|
|
} |