public override void GenerateEmployeePayslip() { try { // Configuration Validation if (!ContextService.IsValidDataContextSettings()) { return; } // Get Payment Summary List LogService.LogInfo("Load Data..."); var paymentSummaries = ContextService.GetPaymentSummaries(); if (paymentSummaries == null) { return; } // Generate Payslip LogService.LogInfo("Generate Payslip..."); var paySlipSummaries = new List <PayslipSummary>(); foreach (var payment in paymentSummaries) { var payslip = CreatePayslipSummary(payment); if (payslip != null) { paySlipSummaries.Add(payslip); } } if (paySlipSummaries.Count == 0) { return; } // Insert into Data Context LogService.LogInfo("Write Result..."); if (ContextService.SavePayslips(paySlipSummaries)) { LogService.LogInfo("Payslip Created..."); } } catch (Exception ex) { LogService.LogError(ex); } }