示例#1
0
        private CBISResponse PublishToEbis(List <Person> StdModel)
        {
            if (StdModel != null || StdModel.Count > 0)
            {
                // Send the data
                var jsonSerialiser = new JavaScriptSerializer();
                Dictionary <string, string> dicVer = new Dictionary <string, string>();
                dicVer.Add("Person", "1.0.0");
                CB.IntegrationService.ApiClient.Model.CBISMessage publEvent = new CB.IntegrationService.ApiClient.Model.CBISMessage()
                {
                    CbInstitutionId = "7a804094-283f-11e8-9cea-025339e5fa76",
                    MessageId       = Guid.NewGuid().ToString(),
                    Model           = "Person",
                    Data            = Newtonsoft.Json.Linq.JToken.FromObject(StdModel),
                    Version         = dicVer,
                    EventName       = "ApplicantAdmitted",
                    InstitutionId   = "1001",
                    MessageType     = MessageType.Notification.ToString(),
                    Origin          = "RAVENNA"
                };

                Configuration conf = new Configuration()
                {
                    AuthenticationSecretKey = "ZTI1MjA1NWItMjgzZS0xMWU4LTljZWEtMDI1MzM5ZTVmYTc2OnJhdmVubmFQYXNzd29yZA=="
                };

                DataExchangeApi dataExchangeApi = new DataExchangeApi(conf);
                CBISResponse    publishResponse = dataExchangeApi.NotificationPublish(publEvent);
                return(publishResponse);
            }
            return(null);
        }
        public void AcknowledgeNotification([FromBody] CB.IntegrationService.ApiClient.Model.CBISMessage ackModel)
        {
            JToken            token      = ackModel.Data;
            List <CBISResult> lstREsults = new List <CBISResult>();

            if (token is JArray)
            {
                lstREsults = token.ToObject <List <CBISResult> >();
            }

            var serializer = new JavaScriptSerializer();
            Dictionary <string, string> lstEventToken = HttpContext.Current.Application["AckReq"] == null ? new Dictionary <string, string>() : (Dictionary <string, string>)HttpContext.Current.Application["AckReq"];

            lstEventToken.Add(ackModel.MessageId, ackModel.ToString());
            HttpContext.Current.Application["AckReq"] = lstEventToken;
        }