45 lines
1.8 KiB
C#
45 lines
1.8 KiB
C#
using System;
|
|
using WX.CRM.BLL.Wx;
|
|
using WX.CRM.Common;
|
|
using WX.CRM.DataSynFactory.Templates;
|
|
using WX.CRM.Model.Entity;
|
|
|
|
namespace WX.CRM.DataSynFactory.Cmd
|
|
{
|
|
public class Client_RefundContract_IMP : Interfaces.IDataImportSvr<Client_RefundContract>
|
|
{
|
|
private WX_SZZYORDER_BL _order = new WX_SZZYORDER_BL();
|
|
//private WX_SZZYORDERREFUND_BL _refundOrder = new WX_SZZYORDERREFUND_BL();
|
|
private WX_SZZYORDERREFUNDCONTRACT_BL _refundOrderContract = new WX_SZZYORDERREFUNDCONTRACT_BL();
|
|
public bool GenerateBusinessOne(Client_RefundContract t)
|
|
{
|
|
try
|
|
{
|
|
var orderId = decimal.Parse(t.OrderId);
|
|
var order = _order.Get(p => p.ORDERID == orderId);
|
|
if (order != null)
|
|
{
|
|
var orderRefundContract = _refundOrderContract.Get(p => p.ORDERID == order.ORDERID);
|
|
if (orderRefundContract != null)
|
|
{
|
|
_refundOrderContract.Delete(p => p.ORDERID == order.ORDERID);
|
|
var contract = new WX_SZZYORDERREFUNDCONTRACT(order.ORDERID, t.HtId, t.RefundPrice, 0, t.ContractTime, t.ContractKey, 0);
|
|
return _refundOrderContract.Add(contract) > 0;
|
|
}
|
|
else
|
|
{
|
|
var contract = new WX_SZZYORDERREFUNDCONTRACT(order.ORDERID, t.HtId, t.RefundPrice, 0, t.ContractTime, t.ContractKey, 0);
|
|
return _refundOrderContract.Add(contract) > 0;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogHelper.Error(ex.ToString());
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|