using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Text;

public partial class Ajax_Ajax_CreditCard : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.Page.IsPostBack)
        {
            Response.Write(InitCreditCard());
        }
    }
    /// <summary>
    /// 绑定信用卡
    /// </summary>
    /// <returns>信用卡id及卡名字符串</returns>
    public string InitCreditCard()
    {
        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;
    }
}