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;

namespace JuSNS.Web.inc.Ajax.bill
{
    public partial class familylist : JuSNS.UI.Page.UserPage
    {
        JuSNS.Home.Bill bll = new JuSNS.Home.Bill();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["a"] == "del")
            {
                if (bll.DelFamilyInfo(UserID, Convert.ToInt32(Request.QueryString["id"])) > 0)
                {
                    Response.Redirect("familylist.aspx");
                }
                else
                {
                    Response.Write("删除失败");
                    Response.End();
                }
            }
            else
            {
                string list = string.Empty;
                IDataReader dr = bll.GetFamilyList(UserID);
                while (dr.Read())
                {
                    list += "<div class=\"nl w280\" style=\"padding-left:15px;\"><div class=\"nl w200\">" + dr["fName"].ToString() + "</div><div class=\"nr\"><span class=\"delete1\"><a href=\"familylist.aspx?a=del&id=" + dr["id"].ToString() + "\"  onclick=\"{if(confirm('确定要删除吗？')){return true;}return false;}\">删除</a></span></div></div>";
                    list += "<div class=\"line-none\"></div>";
                }
                dr.Close();
                this.classList.InnerHtml = list;
            }
        }
    }
}
