/// <summary> /// Gets the last ten time stamps. /// </summary> /// <param name="vm">The vm.</param> /// <returns></returns> private List <string> GetLastTenTimeStamps() { List <string> Last10Occurances = null; vm.DetailSqlQuery = ConfigurationManager.AppSettings["LastTenQuery"]; Mapper.MapErrorDetailViewModelToDataModel(this.vm, this.logDataModel); GetExceedData.GetErrorDetails(this.logDataModel); if (this.logDataModel.dataSet.Tables["HAL_ERR_LOG_DTL"] != null) { Last10Occurances = new List <string>(); var HalErrorLogTable = this.logDataModel.dataSet.Tables["HAL_ERR_LOG_DTL"].AsEnumerable(); List <DateTime> dateTime = (from row in HalErrorLogTable select convertToDateTime(row.Field <string>("FAIL_TS"))).ToList(); dateTime.ForEach(dt => Last10Occurances.Add(dt.ToString())); } return(Last10Occurances); }
/// <summary> /// Gets the basic error details. /// </summary> /// <returns></returns> private BasicErrorDetails GetBasicErrorDetails() { BasicErrorDetails basicErrorDetails = null; vm.DetailSqlQuery = ConfigurationManager.AppSettings["HALDTLQuery"]; Mapper.MapErrorDetailViewModelToDataModel(this.vm, this.logDataModel); GetExceedData.GetErrorDetails(this.logDataModel); if (this.logDataModel.dataSet.Tables["HAL_ERR_LOG_DTL"] != null) { var HalErrorLogTable = this.logDataModel.dataSet.Tables["HAL_ERR_LOG_DTL"].AsEnumerable(); basicErrorDetails = new BasicErrorDetails(); basicErrorDetails.NoOfInstances = (from row in HalErrorLogTable select Int32.Parse(row.Field <string>("COUNTER"))).FirstOrDefault(); basicErrorDetails.EarliestRepoted = (from row in HalErrorLogTable select row.Field <string>("MIN_FAIL_TS")).FirstOrDefault(); basicErrorDetails.LatestReported = (from row in HalErrorLogTable select row.Field <string>("MAX_FAIL_TS")).FirstOrDefault(); } return(basicErrorDetails); }
/// <summary> /// Gets the basic error details. /// </summary> /// <returns></returns> private List <ErrorCodeCount> CreateTopTenErrorCode() { List <ErrorCodeCount> errorCodeCount = null; vm.DetailSqlQuery = ConfigurationManager.AppSettings["TopTenErrorCodeQuery"]; Mapper.MapTopTenErrorCodeQueryToDataModel(this.vm, this.logDataModel); GetExceedData.GetErrorDetails(this.logDataModel); if (this.logDataModel.dataSet.Tables["HAL_ERR_LOG_DTL"] != null) { var HalErrorLogTable = this.logDataModel.dataSet.Tables["HAL_ERR_LOG_DTL"].AsEnumerable(); var errorCount = (from row in HalErrorLogTable select new { errCount = Int32.Parse(row.Field <string>("COUNTER")), errorCode = row.Field <string>("ERRORCODE") }).ToList(); errorCodeCount = new List <ErrorCodeCount>(); errorCount.ForEach(error => errorCodeCount.Add(new ErrorCodeCount { ErrorCode = error.errorCode, Count = error.errCount })); } return(errorCodeCount); }
/// <summary> /// Gets the six month count. /// </summary> /// <param name="vm">The vm.</param> /// <returns></returns> private List <MonthCount> GetSixMonthCount() { List <MonthCount> monthCount = new List <MonthCount>(); vm.DetailSqlQuery = ConfigurationManager.AppSettings["ViewStatQuery"]; Mapper.MapViewStatToDataModel(this.vm, this.logDataModel); GetExceedData.GetErrorDetails(this.logDataModel); if (this.logDataModel.dataSet.Tables["HAL_ERR_LOG_DTL"] != null) { var HalErrorLogTable = this.logDataModel.dataSet.Tables["HAL_ERR_LOG_DTL"].AsEnumerable(); var perMonthCount = (from row in HalErrorLogTable select new { errCount = Int32.Parse(row.Field <string>("COUNTER")), Month = row.Field <string>("MONTH") }).ToList(); for (int i = 0; i >= -5; i--) { string month = DateTime.Now.AddMonths(i).ToString("MMMM"); int errorCount = perMonthCount.Find(x => string.Equals(x.Month, month)).errCount; monthCount.Add(new MonthCount { Count = errorCount, Month = month }); } } return(monthCount); }