Example #1
0
        protected EventPodEntity(SerializationInfo info, StreamingContext context) : base(info, context)
        {
            if (SerializationHelper.Optimization != SerializationOptimization.Fast)
            {
                _eventPodRoom = (EntityCollection <EventPodRoomEntity>)info.GetValue("_eventPodRoom", typeof(EntityCollection <EventPodRoomEntity>));

                _events = (EventsEntity)info.GetValue("_events", typeof(EventsEntity));
                if (_events != null)
                {
                    _events.AfterSave += new EventHandler(OnEntityAfterSave);
                }
                _podDetails = (PodDetailsEntity)info.GetValue("_podDetails", typeof(PodDetailsEntity));
                if (_podDetails != null)
                {
                    _podDetails.AfterSave += new EventHandler(OnEntityAfterSave);
                }
                _territory = (TerritoryEntity)info.GetValue("_territory", typeof(TerritoryEntity));
                if (_territory != null)
                {
                    _territory.AfterSave += new EventHandler(OnEntityAfterSave);
                }

                base.FixupDeserialization(FieldInfoProviderSingleton.GetInstance());
            }

            // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
            // __LLBLGENPRO_USER_CODE_REGION_END
        }
Example #2
0
        public void TestSetup()
        {
            // Create mock implementation of Call
            var callUri       = new Uri("https://example.com/resources/call/1");
            var restfulClient = new MockRestfulClient();

            var resource = new MessagingResource(callUri.ToString());
            var baseUri  = new Uri("https://example.com/");
            var parent   = new object();

            Logger.RegisterLogger(new ConsoleLogger());

            var mockCall = new Mock <Call <MessagingResource, Invitation <InvitationResource, TestCapabilities>, TestCapabilities> >
                               (restfulClient, resource, baseUri, callUri, parent);

            mockCall.CallBase = true;

            m_call = mockCall.Object;

            // Resource deserealization understands only those resources which are registered. This means we cannot use mock
            // implementation of MessagingResource to raise any event. Raise event for MessagingCall instead.
            EventsEntity eventsEntity = TestHelper.GetEventsEntityForEventsInFile("Event_MessagingConnected.json");

            m_eventContext = new EventContext()
            {
                BaseUri       = baseUri,
                EventFullHref = callUri,
                EventEntity   = eventsEntity.Senders[0].Events[0]
            };
        }
Example #3
0
        protected CustomerEventTestFindingEntity(SerializationInfo info, StreamingContext context) : base(info, context)
        {
            if (SerializationHelper.Optimization != SerializationOptimization.Fast)
            {
                _customerProfile = (CustomerProfileEntity)info.GetValue("_customerProfile", typeof(CustomerProfileEntity));
                if (_customerProfile != null)
                {
                    _customerProfile.AfterSave += new EventHandler(OnEntityAfterSave);
                }
                _events = (EventsEntity)info.GetValue("_events", typeof(EventsEntity));
                if (_events != null)
                {
                    _events.AfterSave += new EventHandler(OnEntityAfterSave);
                }
                _test = (TestEntity)info.GetValue("_test", typeof(TestEntity));
                if (_test != null)
                {
                    _test.AfterSave += new EventHandler(OnEntityAfterSave);
                }

                base.FixupDeserialization(FieldInfoProviderSingleton.GetInstance());
            }

            // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
            // __LLBLGENPRO_USER_CODE_REGION_END
        }
Example #4
0
        protected PhysicianEventAssignmentEntity(SerializationInfo info, StreamingContext context) : base(info, context)
        {
            if (SerializationHelper.Optimization != SerializationOptimization.Fast)
            {
                _events = (EventsEntity)info.GetValue("_events", typeof(EventsEntity));
                if (_events != null)
                {
                    _events.AfterSave += new EventHandler(OnEntityAfterSave);
                }
                _physicianProfile_ = (PhysicianProfileEntity)info.GetValue("_physicianProfile_", typeof(PhysicianProfileEntity));
                if (_physicianProfile_ != null)
                {
                    _physicianProfile_.AfterSave += new EventHandler(OnEntityAfterSave);
                }
                _physicianProfile = (PhysicianProfileEntity)info.GetValue("_physicianProfile", typeof(PhysicianProfileEntity));
                if (_physicianProfile != null)
                {
                    _physicianProfile.AfterSave += new EventHandler(OnEntityAfterSave);
                }

                base.FixupDeserialization(FieldInfoProviderSingleton.GetInstance());
            }

            // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
            // __LLBLGENPRO_USER_CODE_REGION_END
        }
Example #5
0
        public void AddEvent(string EventName, string EventType, string Id)
        {
            string AddressUrl = "";

            switch (EventType)
            {
                case EnumsEvents.Order:
                    AddressUrl = UrlBuilder.Order(Id);
                    break;
                case EnumsEvents.RegisterProduct:
                    AddressUrl = UrlBuilder.RegisterProduct(Id);
                    break;
                case EnumsEvents.RegisterSupplier:
                    AddressUrl = UrlBuilder.RegisterSupplier();
                    break;
                case EnumsEvents.FeedBack:
                    AddressUrl = UrlBuilder.FeedBack();
                    break;
            }

            EventsEntity _event = new EventsEntity();
            _event.Id = Guid.NewGuid();
            _event.EventName = Library.Tools.Filter.GetMaxString(EventName, EventsFields.EventName.MaxLength);
            _event.EventType = EventType;
            _event.AddressUrl = AddressUrl;
            _event.CreatedBy = Library.Tools.Util.CurrentUserName;

            EventsManager.CreateInstant().Insert(_event);
        }
 /// <summary> setups the sync logic for member _events</summary>
 /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
 private void SetupSyncEvents(IEntity2 relatedEntity)
 {
     if (_events != relatedEntity)
     {
         DesetupSyncEvents(true, true);
         _events = (EventsEntity)relatedEntity;
         base.PerformSetupSyncRelatedEntity(_events, new PropertyChangedEventHandler(OnEventsPropertyChanged), "Events", EventMeetingDetailsEntity.Relations.EventsEntityUsingEventId, true, new string[] {  });
     }
 }
Example #7
0
        /// <summary> Initializes the class members</summary>
        protected virtual void InitClassMembers()
        {
            _account = null;
            _events  = null;
            PerformDependencyInjection();

            // __LLBLGENPRO_USER_CODE_REGION_START InitClassMembers
            // __LLBLGENPRO_USER_CODE_REGION_END
            OnInitClassMembersComplete();
        }
        /// <summary> Initializes the class members</summary>
        protected virtual void InitClassMembers()
        {
            _events = null;
            _healthPlanCallQueueCriteria = null;

            PerformDependencyInjection();

            // __LLBLGENPRO_USER_CODE_REGION_START InitClassMembers
            // __LLBLGENPRO_USER_CODE_REGION_END
            OnInitClassMembersComplete();
        }
Example #9
0
        /// <summary> Initializes the class members</summary>
        protected virtual void InitClassMembers()
        {
            _eventPodRoom = null;

            _events     = null;
            _podDetails = null;
            _territory  = null;

            PerformDependencyInjection();

            // __LLBLGENPRO_USER_CODE_REGION_START InitClassMembers
            // __LLBLGENPRO_USER_CODE_REGION_END
            OnInitClassMembersComplete();
        }
Example #10
0
 public bool Delete(Guid Id)
 {
     bool toReturn = false;
     using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
     {
         EventsEntity _EventsEntity = new EventsEntity(Id);
         if (adapter.FetchEntity(_EventsEntity))
         {
             adapter.DeleteEntity(_EventsEntity);
             toReturn = true;
         }
     }
     return toReturn;
 }
        /// <summary>
        /// The action when receive callback.
        /// </summary>
        /// <returns>The task.</returns>
        private void OnReceivedCallback(object sender, EventsChannelArgs events)
        {
            SerializableHttpRequestMessage httpMessage = events.CallbackHttpRequest;

            if (httpMessage == null)
            {
                return;
            }

            if (Logger.Instance.HttpRequestResponseNeedsToBeLogged)
            {
                //Technically we should not wait a task here. However, this is in event channel call back thread, and we should not use async in event channel handler
                LogHelper.LogProtocolHttpRequestAsync(httpMessage, httpMessage.LoggingContext != null ? httpMessage.LoggingContext.TrackingId.ToString() : string.Empty, true).Wait(1000);
            }

            EventsEntity eventsEntity = null;

            using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(httpMessage.Content)))
            {
                MediaTypeHeaderValue typeHeader = null;
                MediaTypeHeaderValue.TryParse(httpMessage.ContentType, out typeHeader);
                if (typeHeader != null)
                {
                    try
                    {
                        eventsEntity = MediaTypeFormattersHelper.ReadContentWithType(typeof(EventsEntity), typeHeader, stream) as EventsEntity;
                    }
                    catch (Exception ex)
                    {
                        Logger.Instance.Error(ex, "exception happened in deserialzie http message to EventsEntity");
                        return;
                    }
                }
                else
                {
                    Logger.Instance.Error("Invalid type header in callback message, skip this message! type header value: " + httpMessage.ContentType);
                    return;
                }
            }

            if (eventsEntity != null && eventsEntity.Senders != null && eventsEntity.Senders.Count > 0) //Ignore heartbeat events or call back reachability check events
            {
                this.ProcessEvents(new EventsChannelContext(eventsEntity, httpMessage.LoggingContext));
            }
        }
        public void TestSetup()
        {
            var baseUri       = new Uri("https://example.com/");
            var resourceUri   = new Uri("https://example.com/invitation/1");
            var restfulClient = new MockRestfulClient();
            var parent        = new object();

            Logger.RegisterLogger(new ConsoleLogger());

            var applicationsResource = new ApplicationsResource(resourceUri.ToString());

            m_applicationResource = new ApplicationResource(resourceUri.ToString());
            var communicationResource = new CommunicationResource(resourceUri.ToString());
            var conversationResource  = new ConversationResource(resourceUri.ToString());
            var invitationResource    = new InvitationResource(resourceUri.ToString())
            {
                Application = m_applicationResource
            };

            var applications  = new Applications(restfulClient, applicationsResource, baseUri, resourceUri, parent);
            var application   = new Application(restfulClient, m_applicationResource, baseUri, resourceUri, applications);
            var communication = new Communication(restfulClient, communicationResource, baseUri, resourceUri, application);

            m_conversation = new Conversation(restfulClient, conversationResource, baseUri, resourceUri, communication);

            var mockInvitation = new Mock <Invitation <InvitationResource, TestCapabilities> >(restfulClient, invitationResource, baseUri, resourceUri, communication);

            mockInvitation.CallBase = true;

            m_invitation = mockInvitation.Object;

            // Resource deserealization understands only those resources which are registered. This means we cannot use mock
            // implementation of InvitationResource to raise any event. Raise an event for MessagingCall instead.
            EventsEntity eventsEntity = TestHelper.GetEventsEntityForEventsInFile("Event_MessagingInvitationCompleted.json");

            m_eventContext = new EventContext()
            {
                BaseUri       = baseUri,
                EventFullHref = resourceUri,
                EventEntity   = eventsEntity.Senders[0].Events[0]
            };
        }
Example #13
0
        protected EventAccountEntity(SerializationInfo info, StreamingContext context) : base(info, context)
        {
            if (SerializationHelper.Optimization != SerializationOptimization.Fast)
            {
                _account = (AccountEntity)info.GetValue("_account", typeof(AccountEntity));
                if (_account != null)
                {
                    _account.AfterSave += new EventHandler(OnEntityAfterSave);
                }
                _events = (EventsEntity)info.GetValue("_events", typeof(EventsEntity));
                if (_events != null)
                {
                    _events.AfterSave += new EventHandler(OnEntityAfterSave);
                }
                base.FixupDeserialization(FieldInfoProviderSingleton.GetInstance());
            }

            // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
            // __LLBLGENPRO_USER_CODE_REGION_END
        }
        public static EventsEntity GetEventsEntityForEventsInFile(string filename)
        {
            InitializeTokenMapper();

            EventsEntity eventsEntity = null;

            string jsonContent = File.ReadAllText("Data\\" + filename);

            if (!TestHelper.IsInternalApp)
            {
                jsonContent = jsonContent.Replace(Constants.DefaultResourceNamespace, Constants.PublicServiceResourceNamespace);
            }

            MemoryStream         stream     = new MemoryStream(Encoding.UTF8.GetBytes(jsonContent));
            MediaTypeHeaderValue typeHeader = null;

            MediaTypeHeaderValue.TryParse("application/json", out typeHeader);
            eventsEntity = MediaTypeFormattersHelper.ReadContentWithType(typeof(EventsEntity), typeHeader, stream) as EventsEntity;

            return(eventsEntity);
        }
        protected HealthPlanFillEventCallQueueEntity(SerializationInfo info, StreamingContext context) : base(info, context)
        {
            if (SerializationHelper.Optimization != SerializationOptimization.Fast)
            {
                _events = (EventsEntity)info.GetValue("_events", typeof(EventsEntity));
                if (_events != null)
                {
                    _events.AfterSave += new EventHandler(OnEntityAfterSave);
                }
                _healthPlanCallQueueCriteria = (HealthPlanCallQueueCriteriaEntity)info.GetValue("_healthPlanCallQueueCriteria", typeof(HealthPlanCallQueueCriteriaEntity));
                if (_healthPlanCallQueueCriteria != null)
                {
                    _healthPlanCallQueueCriteria.AfterSave += new EventHandler(OnEntityAfterSave);
                }

                base.FixupDeserialization(FieldInfoProviderSingleton.GetInstance());
            }

            // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
            // __LLBLGENPRO_USER_CODE_REGION_END
        }
Example #16
0
        protected MarketingPrintOrderEventMappingEntity(SerializationInfo info, StreamingContext context) : base(info, context)
        {
            if (SerializationHelper.Optimization != SerializationOptimization.Fast)
            {
                _events = (EventsEntity)info.GetValue("_events", typeof(EventsEntity));
                if (_events != null)
                {
                    _events.AfterSave += new EventHandler(OnEntityAfterSave);
                }
                _marketingPrintOrder = (MarketingPrintOrderEntity)info.GetValue("_marketingPrintOrder", typeof(MarketingPrintOrderEntity));
                if (_marketingPrintOrder != null)
                {
                    _marketingPrintOrder.AfterSave += new EventHandler(OnEntityAfterSave);
                }

                base.FixupDeserialization(FieldInfoProviderSingleton.GetInstance());
            }

            // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
            // __LLBLGENPRO_USER_CODE_REGION_END
        }
Example #17
0
        public bool Update(Guid Id, string EventName, string EventType, string AddressUrl, string CreatedBy, DateTime CreatedDate, bool Approved, string ApprovedBy, DateTime ApprovedDate)
        {
            bool toReturn = false;
            using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
            {
                EventsEntity _EventsEntity = new EventsEntity(Id);
                if (adapter.FetchEntity(_EventsEntity))
                {

                    _EventsEntity.EventName = EventName;
                    _EventsEntity.EventType = EventType;
                    _EventsEntity.AddressUrl = AddressUrl;
                    _EventsEntity.CreatedBy = CreatedBy;
                    _EventsEntity.CreatedDate = CreatedDate;
                    _EventsEntity.Approved = Approved;
                    _EventsEntity.ApprovedBy = ApprovedBy;
                    _EventsEntity.ApprovedDate = ApprovedDate;
                    adapter.SaveEntity(_EventsEntity, true);
                    toReturn = true;
                }
            }
            return toReturn;
        }
 /// <summary> Removes the sync logic for member _events</summary>
 /// <param name="signalRelatedEntity">If set to true, it will call the related entity's UnsetRelatedEntity method</param>
 /// <param name="resetFKFields">if set to true it will also reset the FK fields pointing to the related entity</param>
 private void DesetupSyncEvents(bool signalRelatedEntity, bool resetFKFields)
 {
     base.PerformDesetupSyncRelatedEntity(_events, new PropertyChangedEventHandler(OnEventsPropertyChanged), "Events", EventMeetingDetailsEntity.Relations.EventsEntityUsingEventId, true, signalRelatedEntity, "EventMeetingDetails", resetFKFields, new int[] { (int)EventMeetingDetailsFieldIndex.EventId });
     _events = null;
 }
 /// <summary> Removes the sync logic for member _events</summary>
 /// <param name="signalRelatedEntity">If set to true, it will call the related entity's UnsetRelatedEntity method</param>
 /// <param name="resetFKFields">if set to true it will also reset the FK fields pointing to the related entity</param>
 private void DesetupSyncEvents(bool signalRelatedEntity, bool resetFKFields)
 {
     base.PerformDesetupSyncRelatedEntity(_events, new PropertyChangedEventHandler(OnEventsPropertyChanged), "Events", HealthPlanFillEventCallQueueEntity.Relations.EventsEntityUsingEventId, true, signalRelatedEntity, "HealthPlanFillEventCallQueue", resetFKFields, new int[] { (int)HealthPlanFillEventCallQueueFieldIndex.EventId });
     _events = null;
 }
Example #20
0
 /// <summary> Removes the sync logic for member _events</summary>
 /// <param name="signalRelatedEntity">If set to true, it will call the related entity's UnsetRelatedEntity method</param>
 /// <param name="resetFKFields">if set to true it will also reset the FK fields pointing to the related entity</param>
 private void DesetupSyncEvents(bool signalRelatedEntity, bool resetFKFields)
 {
     base.PerformDesetupSyncRelatedEntity(_events, new PropertyChangedEventHandler(OnEventsPropertyChanged), "Events", PhysicianEventAssignmentEntity.Relations.EventsEntityUsingEventId, true, signalRelatedEntity, "PhysicianEventAssignment", resetFKFields, new int[] { (int)PhysicianEventAssignmentFieldIndex.EventId });
     _events = null;
 }
Example #21
0
 public EventsEntity Insert(EventsEntity _EventsEntity)
 {
     using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
     {
         adapter.SaveEntity(_EventsEntity, true);
     }
     return _EventsEntity;
 }
Example #22
0
        public EventsEntity Insert(string EventName, string EventType, string AddressUrl, string CreatedBy, DateTime CreatedDate, bool Approved, string ApprovedBy, DateTime ApprovedDate)
        {
            EventsEntity _EventsEntity = new EventsEntity();
            using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
            {

                _EventsEntity.EventName = EventName;
                _EventsEntity.EventType = EventType;
                _EventsEntity.AddressUrl = AddressUrl;
                _EventsEntity.CreatedBy = CreatedBy;
                _EventsEntity.CreatedDate = CreatedDate;
                _EventsEntity.Approved = Approved;
                _EventsEntity.ApprovedBy = ApprovedBy;
                _EventsEntity.ApprovedDate = ApprovedDate;
                adapter.SaveEntity(_EventsEntity, true);
            }
            return _EventsEntity;
        }
Example #23
0
 public EventsChannelContext(EventsEntity eventsEntity, LoggingContext loggingContext = null)
 {
     this.EventsEntity   = eventsEntity;
     this.LoggingContext = loggingContext;
 }
 /// <summary> Removes the sync logic for member _events</summary>
 /// <param name="signalRelatedEntity">If set to true, it will call the related entity's UnsetRelatedEntity method</param>
 /// <param name="resetFKFields">if set to true it will also reset the FK fields pointing to the related entity</param>
 private void DesetupSyncEvents(bool signalRelatedEntity, bool resetFKFields)
 {
     base.PerformDesetupSyncRelatedEntity(_events, new PropertyChangedEventHandler(OnEventsPropertyChanged), "Events", HospitalPartnerEventNotesEntity.Relations.EventsEntityUsingEventId, true, signalRelatedEntity, "HospitalPartnerEventNotes", resetFKFields, new int[] { (int)HospitalPartnerEventNotesFieldIndex.EventId });
     _events = null;
 }
Example #25
0
 /// <summary> Removes the sync logic for member _events</summary>
 /// <param name="signalRelatedEntity">If set to true, it will call the related entity's UnsetRelatedEntity method</param>
 /// <param name="resetFKFields">if set to true it will also reset the FK fields pointing to the related entity</param>
 private void DesetupSyncEvents(bool signalRelatedEntity, bool resetFKFields)
 {
     base.PerformDesetupSyncRelatedEntity(_events, new PropertyChangedEventHandler(OnEventsPropertyChanged), "Events", MarketingPrintOrderEventMappingEntity.Relations.EventsEntityUsingEventId, true, signalRelatedEntity, "MarketingPrintOrderEventMapping", resetFKFields, new int[] { (int)MarketingPrintOrderEventMappingFieldIndex.EventId });
     _events = null;
 }
Example #26
0
 public EventsEntity SelectOne(Guid Id)
 {
     EventsEntity toReturn = null;
     using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
     {
         EventsEntity _EventsEntity = new EventsEntity(Id);
         if (adapter.FetchEntity(_EventsEntity))
         {
             toReturn = _EventsEntity;
         }
     }
     return toReturn;
 }
Example #27
0
        public bool Update(EventsEntity _EventsEntity)
        {
            bool toReturn = false;
            using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
            {
                RelationPredicateBucket filter = new RelationPredicateBucket();
                IPredicateExpression _PredicateExpression = new PredicateExpression();
                _PredicateExpression.Add(EventsFields.Id == _EventsEntity.Id);

                filter.PredicateExpression.Add(_PredicateExpression);

                adapter.UpdateEntitiesDirectly(_EventsEntity, filter);
                toReturn = true;
            }
            return toReturn;
        }
Example #28
0
 public bool Update(EventsEntity _EventsEntity, RelationPredicateBucket filter)
 {
     bool toReturn = false;
     using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
     {
         adapter.UpdateEntitiesDirectly(_EventsEntity, filter);
         toReturn = true;
     }
     return toReturn;
 }