コード例 #1
0
        public async Task <IEnumerable <dynamic> > GetFailureCauseDetail(FailureCauseReportDetail fcrd)
        {
            string sql            = "dbo.[EAppHighchartsDemo]";
            var    CountryJson    = JsonHeader + JsonConvert.SerializeObject(fcrd.CountryId) + JsonFooter;
            var    CostCentreJson = JsonHeader + JsonConvert.SerializeObject(fcrd.CostCentreId) + JsonFooter;
            var    SectorJson     = JsonHeader + JsonConvert.SerializeObject(fcrd.SectorId) + JsonFooter;
            var    SegmentJson    = JsonHeader + JsonConvert.SerializeObject(fcrd.SegmentId) + JsonFooter;
            var    IndustryJson   = JsonHeader + JsonConvert.SerializeObject(fcrd.IndustryId) + JsonFooter;
            var    ClientSiteJson = JsonHeader + JsonConvert.SerializeObject(fcrd.ClientSiteId) + JsonFooter;
            var    PlantAreaJson  = JsonHeader + JsonConvert.SerializeObject(fcrd.PlantAreaId) + JsonFooter;

            using (var conn = util.MasterCon())
            {
                try
                {
                    return(await(conn.QueryAsync <dynamic>(sql, new {
                        fcrd.UserId,
                        fcrd.LanguageId,
                        CountryJson,
                        CostCentreJson,
                        SectorJson,
                        SegmentJson,
                        IndustryJson,
                        ClientSiteJson,
                        PlantAreaJson,
                        fcrd.ReportType
                    }, commandType: CommandType.StoredProcedure)));
                }
                catch (Exception ex)
                {
                    throw new CustomException("Unable to Load Data, Please Contact Support!!!", "Error", true, ex);
                }
            }
        }
コード例 #2
0
 public async Task <IActionResult> GetFailureCauseDetail([FromBody] FailureCauseReportDetail fcrd)
 {
     try
     {
         CurrentUser cUser = new CurrentUser(HttpContext, _configuration);
         return(Ok(await dRepo.GetFailureCauseDetail(fcrd)));
     }
     catch (CustomException cex)
     {
         var responseObj = new EmaintenanceMessage(cex.Message, cex.Type, cex.IsException, cex.Exception?.ToString());
         return(StatusCode(StatusCodes.Status500InternalServerError, responseObj));
     }
     catch (Exception ex)
     {
         return(Ok(new EmaintenanceMessage(ex.Message)));
     }
 }