/// <summary> /// Saves the run. /// </summary> /// <param name="item">The item.</param> /// <returns></returns> /// <remarks></remarks> public DiagnosticsRunItem SaveRun(DiagnosticsRunItem item) { var map = new DiagnosticsRunItemMapper(); var it = map.MapFromBusinessToService(item); try { using (var scp = new TransactionScope()) { if (FindRun(item.Id) == null) { DiagnosticsRepositoryAgentFactory .CreateDiagnosticsRunRepositoryAgent() .Insert(it); } else { DiagnosticsRepositoryAgentFactory .CreateDiagnosticsRunRepositoryAgent() .Update(it); } scp.Complete(); } } catch (Exception ex) { if (ex.InnerException != null) { item.AddError(ex.InnerException.Message); } item.AddError(ex.Message); } return(item); }
/// <summary> /// Finds the run detail. /// </summary> /// <param name="id">The id.</param> /// <returns></returns> /// <remarks></remarks> public DiagnosticsRunDetailItem FindRunDetail(string id) { var map = new DiagnosticsRunDetailItemMapper(); var res = DiagnosticsRepositoryAgentFactory .CreateDiagnosticsRunDetailRepositoryAgent() .SelectById(id); return(res == null ? null : map.MapFromServiceToBusiness(res)); }
/// <summary> /// Finds the run item. /// </summary> /// <param name="id">The id.</param> /// <returns></returns> /// <remarks></remarks> public DiagnosticsRunItem FindRun(string id) { var map = new DiagnosticsRunItemMapper(); var res = DiagnosticsRepositoryAgentFactory .CreateDiagnosticsRunRepositoryAgent() .SelectById(id); return((res != null) ? map.MapFromServiceToBusiness(res) : null); }
/// <summary> /// Gets the diagnostics details for run. /// </summary> /// <param name="id">The id.</param> /// <returns></returns> /// <remarks></remarks> public DiagnosticsRunDetailItem[] GetDiagnosticsDetailsForRun(string id) { using (var scp = new TransactionScope()) { var res = DiagnosticsRepositoryAgentFactory .CreateDiagnosticsRunDetailRepositoryAgent() .SelectByRunId(id); scp.Complete(); var map = new DiagnosticsRunDetailItemMapper(); return(map.MapFromServiceToBusiness(res)); } }
/// <summary> /// Gets the diagnostics run items for date. /// </summary> /// <param name="date">The date.</param> /// <returns></returns> /// <remarks></remarks> public DiagnosticsRunItem[] GetDiagnosticsRunItemsForDate(DateTime date) { using (var scp = new TransactionScope()) { var res = DiagnosticsRepositoryAgentFactory .CreateDiagnosticsRunRepositoryAgent() .SelectByDate(date); scp.Complete(); var map = new DiagnosticsRunItemMapper(); return(map.MapFromServiceToBusiness(res)); } }