예제 #1
0
 public Swift CheckSwift(string code)
 {
     Swift swift = new Swift();
     swift.Code = "BKCHCNBJ42A";
     swift.Bank_Name = "BANK OF CHINA GUANGZHOU BRANCH";
     swift.Bank_Address = "19 CHANGDI ROAD - GUANGZHOU - CHINA";
     return swift;
 }
예제 #2
0
 public string Swift(Swift swift)
 {
     Trans tran = new Trans();
     tran.Amount = swift.Payer_Amount;
     tran.From = swift.Payer_Account_Num;
     MysqlHelper mysqlhelper = new MysqlHelper();
     var status1 = mysqlhelper.ChecktheAccount(ref tran);
     if (status1 != "success")
         return status1;
     var status =  mysqlhelper.OverSeaTrans(swift);
     return status;
 }
예제 #3
0
 internal string OverSeaTrans(Swift swift)
 {
     string sql_1 = string.Format("insert into consumption_log set account='{0}',to_account='{1}',amount='{2}',type='{4}',user_id='{3}',currency='{5}';", swift.Payer_Account_Num,swift.Payee_Account_Num,swift.Payer_Amount,swift.User_Id,5,swift.Payer_Currency);
     string sql_2 = string.Format("update saving_account set balance= balance-'{0}' where card_num='{1}'", swift.Payer_Amount, swift.Payer_Account_Num);
     string error = null;
     MySqlConnection conn = null;
     try
     {
         conn = new MySqlConnection(connStr_local);
         conn.Open();
         MySqlDataAdapter adapter = new MySqlDataAdapter(sql_1 + sql_2, conn);
         // 创建DataSet,用于存储数据.
         DataSet testDataSet = new DataSet();
         // 执行查询,并将数据导入DataSet.
         adapter.Fill(testDataSet, "result_data");
         return "Success";
     }
     catch (Exception t)
     {
         return "error";
     }
     finally
     {
         conn.Close();
     }
 }