public void Delete(int id)
        {
            OccurrenceEntity entity = this.dal.Find(id);

            if (entity == null)
            {
                throw new ArgumentNullException("entity");
            }
            this.dal.Attach(entity);
            this.dal.Remove(entity);
            this.unitOfWork.Commit();
        }
        public void Add(Occurrence occur)
        {
            if (occur == null)
            {
                throw new ArgumentNullException("entity");
            }
            var entity = new OccurrenceEntity();

            DomainToDal.Map(entity, occur);
            this.dal.Add(entity);
            this.unitOfWork.Commit();
        }
        public void Update(Occurrence entity)
        {
            if (entity == null)
            {
                throw new ArgumentNullException("entity");
            }
            var newEntity = new OccurrenceEntity();

            DomainToDal.Map(newEntity, entity);
            if (entity.ID == Constants.NEW_DATABASE_ID_VALUE)
            {
                dal.Add(newEntity);
            }
            else
            {
                OccurrenceEntity occur = dal.Find(entity.ID);
                occur.Count = newEntity.Count;
            }
            this.unitOfWork.Commit();
            this.unitOfWork.Dispose();
        }
        private Activity BuildWithPreviewCard(
            EventEntity eventEntity,
            OccurrenceEntity occurrenceEntity,
            UserEntity userEntity)
        {
            var attachment = this.previewCardRenderer.BuildAttachment(
                eventEntity.Id,
                eventEntity.Title,
                eventEntity.Message,
                eventEntity.Image,
                occurrenceEntity.Id,
                occurrenceEntity.OwnerAadObjectId,
                userEntity.Name);

            var message = string.Format(
                OccurrenceInitializationExecutor.PreviewMessageFormat,
                userEntity.Name);

            var activity = this.botActivityBuilder.CreateActivity(userEntity.ServiceUrl, userEntity.ConversationId);

            activity.Text = message;
            activity.Attachments.Add(attachment);
            return(activity);
        }
예제 #5
0
 internal static Occurrence Map(OccurrenceEntity item)
 {
     return(new Occurrence {
         ID = item.OccurenceID, Count = item.Count
     });
 }
예제 #6
0
 internal static void Map(OccurrenceEntity entity, Occurrence occur)
 {
     entity.OccurenceID = occur.ID;
     entity.Count       = occur.Count;
 }