/// <summary> /// Gets the details. /// </summary> /// <param name="vm">The vm.</param> /// <returns>Error details</returns> public ActionResult GetDetails(string ErrorCode, string Region) { this.vm = new HalErrorDetailViewModel(); if (string.IsNullOrEmpty(ErrorCode) || string.IsNullOrEmpty(Region)) { return(View(vm)); } this.vm.ErrorCode = ErrorCode; this.vm.ExceedRegion.CurrentRegion = Region; BasicErrorDetails basicErrorDetails = this.GetBasicErrorDetails(); if (basicErrorDetails != null && !string.IsNullOrEmpty(basicErrorDetails.LatestReported) && !string.IsNullOrEmpty(basicErrorDetails.EarliestRepoted)) { var formattedData = new { ErrorCode = vm.ErrorCode, NoOfInstances = basicErrorDetails.NoOfInstances, EarliestRepoted = basicErrorDetails.EarliestRepoted, LatestReported = basicErrorDetails.LatestReported }; return(Json(formattedData)); } else { return(this.DataNotFound("Sorry, No data found for you request.")); } }
/// <summary> /// Gets the details. /// </summary> /// <param name="vm">The vm.</param> /// <returns></returns> public ActionResult GetStats(string ErrorCode, string Region) { this.vm = new HalErrorDetailViewModel(); vm.ExceedRegion.CurrentRegion = Region; vm.ErrorCode = ErrorCode; List <string> Last10Occurances = this.GetLastTenTimeStamps(); List <MonthCount> monthCount = this.GetSixMonthCount(); BasicErrorDetails basicErrorDetails = this.GetBasicErrorDetails(); if (Last10Occurances != null && Last10Occurances.Count > 0 && basicErrorDetails != null) { var formattedData = new { ErrorCode = vm.ErrorCode, NoOfInstances = basicErrorDetails.NoOfInstances, EarliestRepoted = basicErrorDetails.EarliestRepoted, LatestReported = basicErrorDetails.LatestReported, Last10Occurances = Last10Occurances, LastSix = monthCount }; return(Json(formattedData)); } else { return(this.DataNotFound("Sorry, No data found for you request.")); } }
/// <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); }