public static bool CancelMandate(string mandateCode, string billerId) { bool isSuccessful = false; MandateLog resp = new DAO.MandateLog(); try { using (var context = new CentralPayBridgeEntities()) { resp = context.MandateLogs.FirstOrDefault(g => g.MandateCode.Trim().ToLower().Equals(mandateCode.Trim().ToLower()) && g.BillerId.Equals(billerId)); if (resp != null) { resp.DateCancelled = DateTime.Now; resp.IsCancelled = true; resp.DateUpdated = DateTime.Now; context.SaveChanges(); isSuccessful = true; } } } catch (Exception ext) { ExceptionLogRepo.SaveExceptionLog(ext); Utils.LogError(ext, "Failed to create MandateLog "); } return(isSuccessful); }
public static MandateLog QueryMandate(string mandateCode, string billerId) { MandateLog resp = new DAO.MandateLog(); try { using (var context = new CentralPayBridgeEntities()) { resp = context.MandateLogs.FirstOrDefault(g => g.MandateCode.Trim().ToLower().Equals(mandateCode.Trim().ToLower()) && g.BillerId.Equals(billerId)); } } catch (Exception ext) { ExceptionLogRepo.SaveExceptionLog(ext); Utils.LogError(ext, "Failed to create MandateLog "); } return(resp); }