using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class AccountType_Member : PageBase
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if(!this.Page.IsPostBack)
        {
            BindRptMember();
        }
    }
    /// <summary>
    /// 绑定成员rptMember
    /// </summary>
    public void BindRptMember()
    {
        ControlHelper.BindRepeater(this.rptMember, "constring", "SELECT MemberTypeId,MemberTypeName FROM dbo.tabA_Type_Member WHERE State=1");
    }
    protected void rptMember_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        int memberId = ConvertHelper.GetInteger((e.Item.FindControl("hdMemberTypeId") as HiddenField).Value);
        if(e.CommandName=="delete")
        {
            int flag = SqlHelper.Operation("UPDATE dbo.tabA_Type_Member SET State=0 WHERE MemberTypeId="+memberId+"", "constring");
            if (flag > 0)
            {
                BindRptMember();
            }
            else
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(),"","<script language='javascript' defer>alert('删除失败，请联系管理员！')</script>");
            }
        }
    }
}
