public void GetCustomerTest() { CustomerDataLayer customerDataLayer = new CustomerDataLayer(); var cust = customerDataLayer.GetForName("aaron"); Assert.IsNotNull(cust); }
/// <summary> /// Monitors for CDR's that utilised real-time call control and that have now completed and require credit reconciliation. /// </summary> private void ReconcileCDRs() { try { Thread.CurrentThread.Name = RTCC_THREAD_NAME; logger.Debug("RTCC Core Starting Reconcile CDRs thread."); while (!m_exit) { try { using (var db = new SIPSorceryEntities()) { var rtccReconciliationDue = (from rtcc in db.RTCCs1.Include("cdr") where rtcc.AccountCode != null && ((rtcc.cdr.AnsweredStatus > 0 && rtcc.cdr.AnsweredStatus < 200) || rtcc.cdr.AnsweredStatus >= 300 || rtcc.cdr.HungupTime != null || rtcc.cdr.HungupReason != null) && rtcc.ReconciliationResult == null && rtcc.PostReconciliationBalance == null && rtcc.Cost > 0 orderby rtcc.cdr.HungupTime select rtcc).Take(NUMBER_CDRS_PER_ROUNDTRIP); while (rtccReconciliationDue.Count() > 0) { foreach (RTCC rtcc in rtccReconciliationDue) { Log_External(new SIPMonitorConsoleEvent(SIPMonitorServerTypesEnum.RTCC, SIPMonitorEventTypesEnum.DialPlan, "Reconciling credit for call " + rtcc.cdr.Dst + ".", rtcc.cdr.Owner)); logger.Debug("Answered Status=" + rtcc.cdr.AnsweredStatus + ", hungup time=" + rtcc.cdr.HungupTime + ", hungup reason=" + rtcc.cdr.HungupReason + "."); logger.Debug("Reconciliation starting for CDR " + rtcc.cdr.ID + ", owner " + rtcc.cdr.Owner + ", destination " + rtcc.cdr.Dst + ", duration " + rtcc.cdr.Duration + ", rate " + rtcc.Rate + ", setup cost " + rtcc.SetupCost + ", increment seconds " + rtcc.IncrementSeconds + " and reserved credit of " + rtcc.Cost + "."); decimal callCost = m_customerAccountDataLayer.ReturnUnusedCredit(rtcc.ID); if (callCost > Decimal.Zero) { // Check whether a reconciliation callback needs to be made for this customer account. var customer = _customerDataLayer.GetForName(rtcc.cdr.Owner); if (customer.RTCCReconciliationURL.NotNullOrBlank()) { // Send an async HTTP GET request to the specified URL. } } } } } } catch (Exception monitorExcp) { logger.Error("Exception ReconcileCDRs Monitoring. " + monitorExcp); } Thread.Sleep(1000); } logger.Warn("RTCCCore ReconcileCDRs thread stopping."); } catch (Exception excp) { logger.Error("Exception RTCCCore ReconcileCDRs. " + excp.Message); logger.Error("InnerException RTCCCore ReconcileCDRs. " + excp.InnerException); } }