/// <summary> /// Maps the view stat to data model. /// </summary> /// <param name="vm">The vm.</param> /// <param name="dataModel">The data model.</param> internal static void MapViewStatToDataModel(HalErrorDetailViewModel vm, LogDataModel dataModel) { MapErrorDetailViewModelToDataModel(vm, dataModel); dataModel.SqlQuery = HelperClass.CreateUnionQuery(dataModel.SqlQuery); //dataModel.SqlQuery = HelperClass.ReplaceKey(dataModel.SqlQuery, "FailTs", HelperClass.convertToUKFormat(DateTime.Now.AddMonths(-5).Year, DateTime.Now.AddMonths(-5).Month)); }
internal static void MapTopTenErrorCodeQueryToDataModel(HalErrorDetailViewModel vm, LogDataModel dataModel) { dataModel.SqlQuery = vm.DetailSqlQuery; dataModel.Region = vm.ExceedRegion.CurrentRegion; dataModel.SqlQuery = HelperClass.ReplaceKey(dataModel.SqlQuery, "Region", dataModel.Region); dataModel.SqlQuery = HelperClass.ReplaceKey(dataModel.SqlQuery, "MinFailTs", HelperClass.convertToUKFormat(DateTime.Now.AddMonths(-5).Year, DateTime.Now.AddMonths(-5).Month)); }
/// <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 more details. /// </summary> /// <returns></returns> public ActionResult GetMoreDetails(string ErrorCode, string Region) { this.vm = new HalErrorDetailViewModel(); this.vm.ErrorCode = ErrorCode; this.vm.ExceedRegion.CurrentRegion = Region; ErrorDetails errorDetails = this.GetDetailErrorDetails(); if (errorDetails != null) { var formattedData = new { FailedProgrammeName = errorDetails.FailedProgrammeName, FailedParagraphName = errorDetails.FailedParagraphName, ErrorAdditionalText = errorDetails.ErrorAdditionalText, SQLCode = errorDetails.SQLCode, ErrorCmtText = errorDetails.ErrorCmtText, FailedUOWName = errorDetails.FailedUOWName, FailedLocationName = errorDetails.FailedLocationName, SQLErroeMCText = errorDetails.SQLErroeMCText, UserId = errorDetails.UserId, FailedKeyText = errorDetails.FailedKeyText, ACYText = errorDetails.ACYText, PriorityCd = errorDetails.PriorityCd, ErrorText = errorDetails.ErrorText }; return(Json(formattedData)); } else { return(this.DataNotFound("Sorry, No data found for you request.")); } }
/// <summary> /// Maps the error detail view model to data model. /// </summary> /// <param name="halErrorDetailViewModel">The hal error detail view model.</param> /// <param name="logDataModel">The log data model.</param> internal static void MapErrorDetailViewModelToDataModel(HalErrorDetailViewModel vm, LogDataModel dataModel) { if (!string.IsNullOrEmpty(vm.ErrorCode)) { dataModel.ErrorCode = vm.ErrorCode; } dataModel.Region = vm.ExceedRegion.CurrentRegion; dataModel.SqlQuery = vm.DetailSqlQuery; dataModel.SqlQuery = HelperClass.ReplaceKey(dataModel.SqlQuery, "Region", dataModel.Region); dataModel.SqlQuery = HelperClass.ReplaceKey(dataModel.SqlQuery, "ErrorRef", dataModel.ErrorCode); }
/// <summary> /// Gets the details. /// </summary> /// <param name="vm">The vm.</param> /// <returns>Error details</returns> public ActionResult GetTopTenErrorCode(string Region) { this.vm = new HalErrorDetailViewModel(); this.vm.ExceedRegion.CurrentRegion = Region; List <ErrorCodeCount> errorCodeCount = this.CreateTopTenErrorCode(); if (errorCodeCount != null && errorCodeCount.Count > 0) { var formattedData = new { ErrorCodeCount = errorCodeCount }; return(Json(formattedData)); } else { return(this.DataNotFound("Sorry, No data found for you request.")); } }
public ActionResult Index() { vm = new HalErrorDetailViewModel(); return(View(vm)); }