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;
using System.Text;

public partial class Ajax_Ajax_BankCard : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if(!this.Page.IsPostBack)
        {
            Response.Write(InitBankCard());
        }
    }
    /// <summary>
    /// 绑定信用卡
    /// </summary>
    /// <returns>信用卡id及卡名字符串</returns>
    public string InitBankCard()
    {
        string creditCard="";
        if (!string.IsNullOrEmpty(Request["BankID"]))
        {
            DataSet ds = SqlHelper.GetDataSet("SELECT CreditCardId,CreditCardName FROM dbo.tabA_Account_CreditCard WHERE CCIssueBankId=" + Request["BankID"] + "", "constring");
            if (ds.Tables[0].Rows.Count > 0)
            {
                StringBuilder stb = new StringBuilder();
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    stb.Append(ds.Tables[0].Rows[i]["CreditCardName"]);//信用卡名
                    stb.Append(",");
                    stb.Append(ds.Tables[0].Rows[i]["CreditCardId"]);//信用卡id
                    stb.Append(",");
                }
                creditCard = ConvertHelper.GetString(stb).TrimEnd(',');
            }
        }
        return creditCard;
    }
}
