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 ActionResult SendData(long[] isSelected) { List <MemberModel> lstMembers = (List <MemberModel>)Session["LstMembers"]; try { List <Person> StdModel = new List <Person>(); MapToStandardDataSet(isSelected, lstMembers, StdModel); CBISResponse publishResponse = PublishToEbis(StdModel); ViewBag.SuccessMessage = "Selected members Successfully sent to TADS."; if (publishResponse.ResponseCode == HttpStatusCode.Accepted.ToString()) { ViewBag.SuccessMessage += "Published successfully"; } } catch (Exception ex) { ViewBag.ErrorMessage = "Error: " + ex.Message; } return(View("Index", lstMembers)); }