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 xabaraCOM;

public partial class webXabara_money_bank : System.Web.UI.Page
{
    admin a = new admin();
    sqlServer sql = new sqlServer();
    javasrcipt js = new javasrcipt();

    protected void Page_Load(object sender, EventArgs e)
    {
        a.check("|bank|");
    }

    protected void sysSet_Click(object sender, EventArgs e)
    {
        DataTable dt = sql.getDataTable("select * from payBank where bankAccount='" + bankAccount.Text.Trim() + "' or bankName='" + bankName.Text.Trim() + "'");
        if (dt.Rows.Count > 0)
        {
            js.div(false, "", "text", "您已添加过此银行帐号！", 350, 150, "bankList.aspx", "goto");
        }
        else
        {
            string strDim = "@bankName,@bankAdd,@bankUserName,@bankAccount,@adminID,@postDate,@postIP";
            string[] strValue = new string[7];
            strValue[0] = bankName.Text.Trim();
            strValue[1] = bankAdd.Text.Trim();
            strValue[2] = bankOpen.Text.Trim();
            strValue[3] = bankAccount.Text.Trim();
            strValue[4] = a.uid;
            strValue[5] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            strValue[6] = new ipAddress().address();

            sql.log(a.uid, "admin", "银行帐号");

            string returnStr = sql.add("payBank", strDim, strValue);
            js.div(false, "", "text", returnStr, 350, 150, "bankList.aspx", "goto");
        }
        dt.Dispose();
    }
}