public async Task<TakeRateDocumentHeader> SaveTakeRateDocumentHeader(TakeRateDocumentHeader headerToSave) { return await Task.FromResult(_takeRateDataStore.FdpVolumeHeaderSave(headerToSave)); }
//public TakeRateSummary TakeRateDocumentHeaderGet(TakeRateFilter filter) //{ // var volumeHeaders = FdpTakeRateHeaderGetManyByUsername(filter); // if (volumeHeaders == null || !volumeHeaders.CurrentPage.Any()) // return null; // return volumeHeaders.CurrentPage.FirstOrDefault(); //} public TakeRateDocumentHeader FdpVolumeHeaderSave(TakeRateDocumentHeader header) { using (var conn = DbHelper.GetDBConnection()) { try { var para = new DynamicParameters(); para.Add("@FdpVolumHeaderId", header.FdpVolumeHeaderId, DbType.Int32, ParameterDirection.InputOutput); para.Add("@CDSID", CurrentCDSID, DbType.String, size: 16); if (header.ProgrammeId.HasValue) para.Add("@ProgrammeId", header.ProgrammeId.Value, DbType.Int32); para.Add("@Gateway", header.Gateway, DbType.String); para.Add("@FdpImportId", header.FdpImportId, DbType.Int32); para.Add("@IsManuallyEntered", header.IsManuallyEntered, DbType.Boolean); var results = conn.Query<TakeRateDocumentHeader>(fdpVolumeHeaderSaveStoredProcedureName, para, commandType: CommandType.StoredProcedure); var takeRateDocumentHeaders = results as IList<TakeRateDocumentHeader> ?? results.ToList(); if (takeRateDocumentHeaders.Any()) { header = takeRateDocumentHeaders.First(); } } catch (Exception ex) { Log.Error(ex); throw; } } return header; }