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_SavingsCard : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Write(GetSavingsCard());
    }
    /// <summary>
    /// 由储蓄卡银行id获取储蓄卡id及名称
    /// </summary>
    /// <returns></returns>
    public string GetSavingsCard()
    {
        string savingsCard = "";//储蓄卡id及名称字符串
        if (!string.IsNullOrEmpty(Request["BankID"]))
        {
            DataSet ds = SqlHelper.GetDataSet("SELECT SavingsCardId,SavingsCardName FROM dbo.tabA_Account_SavingsCard WHERE State=1 AND SCIssueBankId=" + ConvertHelper.GetInteger(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]["SavingsCardName"]);//储蓄卡名称
                    stb.Append(",");
                    stb.Append(ds.Tables[0].Rows[i]["SavingsCardId"]);//储蓄卡id
                    stb.Append(",");
                }
                savingsCard = ConvertHelper.GetString(stb).TrimEnd(',');
            }
        }
        return savingsCard;
    }
}