public bool RunBatchAgain(int executionId, out string error) { try { UserPayoutStatmentsRepository.Delete(x => x.ExecutionId == executionId && (x.StatusId == (byte)BillingEnums.ePayoutStatuses.SKIP || x.StatusId == (byte)BillingEnums.ePayoutStatuses.FAILED)); if (!UserPayoutStatmentsRepository.UnitOfWork.CommitAndRefreshChanges(out error)) { return(false); } var entity = PayoutExecutionsRepository.GetById(executionId); if (entity == null) { error = "Payout Execution entity not found. Contact development team"; return(false); } int execId; return(ExecuteMonthlyPayout(entity.PayoutYear, entity.PayoutMonth, new List <BasePayoutSelectionToken>(), out execId, out error)); } catch (Exception ex) { error = FormatError(ex); Logger.Error("RunBatchAgain", ex, executionId, CommonEnums.LoggerObjectTypes.Payout); return(false); } }
//reporting public List <PayoutExecutionDTO> GetPayoutExecutions(int?executionId) { try { return(PayoutExecutionsRepository.GetPayoutExecutions(executionId).Select(x => x.Entity2ExecutionDto()).OrderByDescending(x => x.PayoutDate).ToList()); } catch (Exception ex) { Logger.Error("GetPayoutExecutions", ex, executionId, CommonEnums.LoggerObjectTypes.Reports); return(new List <PayoutExecutionDTO>()); } }
public PayoutExecutionDTO GetPayoutExecutionDto(int year, int month) { try { var entity = PayoutExecutionsRepository.Get(x => x.PayoutYear == year && x.PayoutMonth == month); return(entity == null ? new PayoutExecutionDTO(year, month) : entity.Entity2ExecutionDto(GetUser(entity.CreatedBy))); } catch (Exception ex) { Logger.Error("getPayoutExecutionDto", ex, CommonEnums.LoggerObjectTypes.Payout); return(null); } }
private void UpdatePayoutExecutionRecord(int executionId, BillingEnums.ePayoutStatuses status) { try { var entity = PayoutExecutionsRepository.GetById(executionId); if (entity == null) { return; } entity.StatusId = (byte)status; entity.UpdateOn = DateTime.Now; entity.UpdatedBy = CurrentUserId; PayoutExecutionsRepository.UnitOfWork.CommitAndRefreshChanges(); } catch (Exception ex) { Logger.Error("UpdatePayoutExecutionRecord", ex, CommonEnums.LoggerObjectTypes.Payout); } }