示例#1
0
        /// <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);
        }
示例#2
0
        /// <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));
        }
示例#3
0
        /// <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);
        }
示例#4
0
 /// <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));
     }
 }
示例#5
0
 /// <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));
     }
 }