using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Fm.Bussiness;

public partial class Admin_sys_affiche_list : BasePage
{
   
    protected void Page_Load(object sender, EventArgs e)
    {
        GetPage("");
    }
    void GetPage(string where)
    {
        FormPaging1.TableName = "Fm_affiche";
        FormPaging1.ColName = "aff_id";
        FormPaging1.Where = "";
        FormPaging1.Gv = GridView1;
    }
    //修改
    protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
    {
        Response.Redirect("sys_affiche_edit.aspx?aff_id="+int.Parse(GridView1.DataKeys[e.NewEditIndex].Value.ToString()),false);
    }
    //单一的删除
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        sys_affiche sys = new sys_affiche();
        Fm.EntityClass.Affiche affiche = new Fm.EntityClass.Affiche();
        affiche.aff_id = int.Parse(GridView1.DataKeys[e.RowIndex].Value.ToString());
        if (sys.Affiche_Delete(affiche))
        {
            Response.Redirect("Erro.aspx?eid=网站公告信息删除成功!&url=sys_affiche_list.aspx", false);
        }
        else
        {
            Response.Redirect("Erro.aspx?eid=网站公告信息删除失败!&url="+Request.Url.AbsoluteUri, false);
        }
    }
    //删除所选的公告
    protected void Button1_Click(object sender, EventArgs e)
    {
        sys_affiche sys = new sys_affiche();
        Fm.EntityClass.Affiche affiche = new Fm.EntityClass.Affiche();
        for (int i = 0; i < GridView1.Rows.Count; i++)
        {
            if ((GridView1.Rows[i].Cells[0].FindControl("CheckBox2") as CheckBox).Checked == true)
            {
                affiche.aff_id = int.Parse(GridView1.DataKeys[i].Value.ToString());
                sys.Affiche_Delete(affiche);
            }
        }
        Response.Redirect("Erro.aspx?eid=所选网站公告信息删除成功&url=sys_affiche_list.aspx", false);
    }
}
