//MicroService 4 public IActionResult ReadMQ2OPLDNCreateSPNPushTOMQ3() { try { //Read from MQ OPLD opldObject = CommonUtility <OPLD> .PullFromActiveMQ(2); ServicePoint servicePointObject = new ServicePoint(); //CreateServicepoint //Check if opld tracking number matches with dials matching number SakilaContext context = HttpContext.RequestServices.GetService(typeof(SakilaContext)) as SakilaContext; DIALS dialsObject = context.GetMatchingDialsID(opldObject.TrackingNumber); if (dialsObject != null) { servicePointObject = ServicePointUtility.CreateServicePoint(opldObject, dialsObject.ConsigneeName, dialsObject.ClarifiedSignature, true); } else { servicePointObject = ServicePointUtility.CreateServicePoint(opldObject, "", "", false); } //Push OPLD in to Active MQ2 CommonUtility <ServicePoint> .PushToActiveMQ(servicePointObject, 3); } catch { return(new JsonResult(new { Result = System.Net.HttpStatusCode.InternalServerError })); } return(Ok()); }
public IActionResult MicroServiceServicePointGeneration(OPLD opldObject) { try { log.Info(DateTime.Now.ToString() + " AMS-POC-MicroServiceServicePointGeneration: Read OPLD message and Start processing."); //CreateServicepoint //SakilaContext context = new SakilaContext("server=127.0.01;port=3306;database=ams;user=root;password=techM@Ups1"); SakilaContext context = new SakilaContext("server=techm.cooavdyjxzoz.us-east-1.rds.amazonaws.com;port=3306;database=ams;user=root;password=Password123"); log.Info(DateTime.Now.ToString() + " AMS-POC-MicroServiceServicePointGeneration: Getting OPLD tracking number matching DIALS record."); //Check if opld tracking number matches with dials matching number DIALS dialsObject = context.GetMatchingDialsID(opldObject.SHIP_SP_NR); ServicePoint servicePointObject = new ServicePoint(); if (!string.IsNullOrEmpty(dialsObject.TrackingNumber)) { //Match found //Compare OPLD Add1 with SP Add1 and Update timestamp and increase Stop ID ServicePoint servicePoint = context.CompareOPLDAdd1WithSPAddr1(opldObject.SHIP_ADDR_LINE_1_1); if (servicePoint != null && (servicePoint.ServicePointID != 0)) { context.UpdateServicePoint(servicePoint.ServicePointID); } else { servicePointObject = ServicePointUtility.CreateServicePoint(opldObject, dialsObject.ConsigneeName, dialsObject.ClarifiedSignature, true); log.Info(DateTime.Now.ToString() + " AMS-POC-MicroServiceServicePointGeneration: Writing ServicePoint in to DB."); //Write Servicepoint to DB context.AddNewServicePoint(servicePointObject); } } else { //Create Service Point with Stop ID = 1 servicePointObject = ServicePointUtility.CreateServicePoint(opldObject, opldObject.SHIP_ATTENTION_NAME_1, "", false); log.Info(DateTime.Now.ToString() + " AMS-POC-MicroServiceServicePointGeneration: Writing ServicePoint in to DB."); //Write Servicepoint to DB context.AddNewServicePoint(servicePointObject); } //Update OPLD Processing Status context.UpdateOPLDProcessingStatus(opldObject.SHIP_SP_NR); } catch (Exception ex) { log.Error(DateTime.Now.ToString() + " AMS-POC-MicroServiceServicePointGeneration: " + Convert.ToString(ex.ToString())); return(new JsonResult(new { Result = System.Net.HttpStatusCode.InternalServerError })); } return(Ok(new { Result = "Success" })); }
//MicroService 4 public IActionResult ReadMQ2OPLDNCreateSPNPushTOMQ3() { try { //Read from MQ //OPLD opldObject = CommonUtility<OPLD>.PullFromActiveMQ(2); log.Info(DateTime.Now.ToString() + " AMS-POC: Service point genration process started."); ServicePoint servicePointObject = new ServicePoint(); var opldProcString = Request.Headers["opldProcString"]; OPLD opldObject = Newtonsoft.Json.JsonConvert.DeserializeObject <OPLD>(opldProcString); //CreateServicepoint //Check if opld tracking number matches with dials matching number SakilaContext context = HttpContext.RequestServices.GetService(typeof(SakilaContext)) as SakilaContext; DIALS dialsObject = context.GetMatchingDialsID(opldObject.TrackingNumber); if (dialsObject != null) { servicePointObject = ServicePointUtility.CreateServicePoint(opldObject, dialsObject.ConsigneeName, dialsObject.ClarifiedSignature, true); } else { servicePointObject = ServicePointUtility.CreateServicePoint(opldObject, "", "", false); } //Push OPLD in to Active MQ2 CommonUtility <ServicePoint> .PushToActiveMQ(servicePointObject, 3); log.Info(DateTime.Now.ToString() + " AMS-POC: Service point Created and Pushed to MQ3."); } catch (Exception ex) { log.Error(DateTime.Now.ToString() + " AMS-POC: " + Convert.ToString(ex.Message)); return(new JsonResult(new { Result = System.Net.HttpStatusCode.InternalServerError })); } return(Ok()); }
public IActionResult MicroServiceServicePointGeneration(OPLD opldObject) { try { log.Info(DateTime.Now.ToString() + " AMS-POC-MicroServiceServicePointGeneration: Read OPLD message and Start processing."); //CreateServicepoint SakilaContext context = new SakilaContext("server=127.0.01;port=3306;database=ams;user=root;password=techM@Ups1");//HttpContext.RequestServices.GetService(typeof(SakilaContext)) as SakilaContext; log.Info(DateTime.Now.ToString() + " AMS-POC-MicroServiceServicePointGeneration: Getting OPLD tracking number matching DIALS record."); //Check if opld tracking number matches with dials matching number DIALS dialsObject = context.GetMatchingDialsID(opldObject.TrackingNumber); ServicePoint servicePointObject = new ServicePoint(); if (!string.IsNullOrEmpty(dialsObject.TrackingNumber)) { servicePointObject = ServicePointUtility.CreateServicePoint(opldObject, dialsObject.ConsigneeName, dialsObject.ClarifiedSignature, true); } else { servicePointObject = ServicePointUtility.CreateServicePoint(opldObject, "", "", false); } log.Info(DateTime.Now.ToString() + " AMS-POC-MicroServiceServicePointGeneration: Writing ServicePoint in to DB."); //Write Servicepoint to DB context.AddNewServicePoint(servicePointObject); //Update OPLD Processing Status context.UpdateOPLDProcessingStatus(opldObject.TrackingNumber); } catch (Exception ex) { log.Error(DateTime.Now.ToString() + " AMS-POC-MicroServiceServicePointGeneration: " + Convert.ToString(ex.Message)); return(new JsonResult(new { Result = System.Net.HttpStatusCode.InternalServerError })); } return(Ok(new { Result = "Success" })); }