using System.Threading.Tasks;
using XYY.Core.Standard.Data.Infrastructure;
using XYY.Model.Standard;
using XYY.Model.Standard.Finance;

namespace XYY.Data.Standard.Finance
{
    public interface IFinance_OrderCostRepository : IBaseRepository<Finance_OrderCost>
    {
        Task UpdateOrderCost(string ladingBillNumber, decimal totalFee, FinanceIncidentalTypeEnum feeType, string Curreny);
    }

    public class Finance_OrderCostRepository : BaseRepository<Finance_OrderCost>, IFinance_OrderCostRepository
    {
        public Finance_OrderCostRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
        {

        }

        public async Task UpdateOrderCost(string ladingBillNumber, decimal totalFee, FinanceIncidentalTypeEnum feeType, string curreny)
        {
            int type = (int)feeType;
            await ExecuteStoredProcedureAsync("SP_UpdateOrderCost",
                new { LadingBillNumber = ladingBillNumber, TotalFee = totalFee, FeeType = type, Curreny = curreny }, 120);
        }
    }
}
