You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
127 lines
4.6 KiB
127 lines
4.6 KiB
using Common;
|
|
using Common.Helper;
|
|
using Common.Model;
|
|
using Common.Model.AutoRefund;
|
|
using log4net;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
|
|
namespace Repository.AutoRefund
|
|
{
|
|
public class AutoRefundRepository : IAutoRefundRepository
|
|
{
|
|
private readonly Dao _dao;
|
|
private static readonly ILog Log = LogManager.GetLogger(typeof(AutoRefundRepository));
|
|
|
|
public AutoRefundRepository()
|
|
{
|
|
_dao = new Dao();
|
|
}
|
|
|
|
public JsonRxResponse SendAutoRefund(KwangjuAutoRefundModel model)
|
|
{
|
|
var dic = new Dictionary<string, string>
|
|
{
|
|
{ "@pCustomerId", _dao.FilterString(model.CustomerId) },
|
|
{ "@pCustomerSummary", _dao.FilterString(model.CustomerSummary) },
|
|
{ "@pAmount", _dao.FilterString(model.Amount) },
|
|
{ "@pAction", _dao.FilterString(model.Action) },
|
|
{ "@pActionDate", _dao.FilterString(model.ActionDate) },
|
|
{ "@pActionBy", _dao.FilterString(model.ActionBy) },
|
|
{ "@pRowId", _dao.FilterString(model.RowId) },
|
|
{ "@pBankCode", _dao.FilterString(model.BankCode) },
|
|
{ "@pBankAccountNo", _dao.FilterString(model.BankAccountNo) },
|
|
{ "@pSource", _dao.FilterString("M") }
|
|
};
|
|
var sql = new Query("PROC_KJAUTOREFUND", model.Flag, dic).ToString();
|
|
Log.Debug(sql);
|
|
var dbRes = _dao.ParseDbResult(sql);
|
|
return new JsonRxResponse { ErrorCode = dbRes.ResponseCode, Msg = dbRes.Msg, Id = dbRes.Id, Extra = dbRes.Extra, Extra2 = dbRes.Extra };
|
|
}
|
|
|
|
public CustomerInfo GetCustomerInfoForKwangju(string customerId)
|
|
{
|
|
var dic = new Dictionary<string, string>
|
|
{
|
|
{ "@pCustomerId", _dao.FilterString(customerId) }
|
|
};
|
|
var sql = new Query("PROC_KJAUTOREFUND", "CUSTOMER-INFO", dic).ToString();
|
|
|
|
Log.Debug(sql);
|
|
var dt = _dao.ExecuteDataTable(sql);
|
|
|
|
return Mapper.DataTableToClass<CustomerInfo>(dt)[0];
|
|
}
|
|
|
|
public RefundRequireResponseModel GetRefundRequirement(string username)
|
|
{
|
|
var dic = new Dictionary<string, string>
|
|
{
|
|
{ "@Username", _dao.FilterString(username) }
|
|
};
|
|
var sql = new Query("PROC_MOBILE_REFUND", "requirement", dic).ToString();
|
|
|
|
Log.Debug(sql);
|
|
var dt = _dao.ExecuteDataTable(sql);
|
|
return Mapper.DataTableToClass<RefundRequireResponseModel>(dt)[0];
|
|
}
|
|
|
|
public void LogFailTransactionForAutoDebit(string rowId, string errorCode, string errorMsg)
|
|
{
|
|
var dic = new Dictionary<string, string>
|
|
{
|
|
{ "@rowId", _dao.FilterString(rowId) },
|
|
{ "@errorCode", _dao.FilterString(errorCode) },
|
|
{ "@errorMsg", _dao.FilterString(errorMsg) }
|
|
};
|
|
var sql = new Query("KFTC_LOG_CUSTOMER_INFO", "U-TRAN", dic).ToString();
|
|
|
|
Log.Debug(sql);
|
|
_dao.GetSingleResult(sql);
|
|
}
|
|
|
|
public DataTable GetAccountList(string customerId)
|
|
{
|
|
var dic = new Dictionary<string, string>
|
|
{
|
|
{ "@customerId", _dao.FilterString(customerId) }
|
|
};
|
|
var sql = new Query("KFTC_LOG_CUSTOMER_INFO", "s", dic).ToString();
|
|
|
|
Log.Debug(sql);
|
|
|
|
return _dao.ExecuteDataTable(sql);
|
|
}
|
|
|
|
/* 2019.09 @Dana */
|
|
|
|
public DbResult LogRequestKFTC(string user, string methodName, string requestXml, string processId = "")
|
|
{
|
|
if (requestXml == null)
|
|
requestXml = "";
|
|
var sql = string.Format("EXEC PROC_KFTC_LOGS @flag='i', @CUSTOMERID='{0}', @methodName='{1}',@requestXml=N'{2}',@processId='{3}'", user, methodName, requestXml.Replace("'", ""), processId);
|
|
|
|
return _dao.ParseDbResult(sql);
|
|
}
|
|
|
|
public DbResult LogResponseKFTC(string rowId, string responseXml, string tpErrorCode, string tpErrorMsg)
|
|
{
|
|
try
|
|
{
|
|
if (string.IsNullOrEmpty(responseXml))
|
|
responseXml = "";
|
|
var sql =
|
|
string.Format(
|
|
"EXEC PROC_KFTC_LOGS @flag='u', @rowId='{0}',@responseXml=N'{1}', @errorCode='{2}', @errorMessage=N'{3}'",
|
|
rowId, responseXml.Replace("'", ""), tpErrorCode, tpErrorMsg);
|
|
|
|
return _dao.ParseDbResult(sql);
|
|
}
|
|
catch (Exception)
|
|
{
|
|
return new DbResult();
|
|
}
|
|
}
|
|
}
|
|
}
|