Пример #1
0
        void UpdRequestInternal(RequestEntity requestBefore, RequestEntity requestAfter)
        {
            _dbAccessor.UpdRequest(requestAfter);
            BindingCollection <TagEntity> forAddTag = null;
            BindingCollection <TagEntity> forUpdTag = null;
            BindingCollection <TagEntity> forDelTag = null;

            EntityList <TagEntity> .DiffTwoList(requestBefore.Tags, requestAfter.Tags, out forAddTag, out forUpdTag, out forDelTag);

            foreach (TagEntity tag in forAddTag)
            {
                _dbAccessor.InsReqTag(requestBefore.Id, tag);
            }
            foreach (TagEntity tag in forDelTag)
            {
                _dbAccessor.DelReqTag(requestBefore.Id, tag.Id);
            }

            BindingCollection <AttachEntity> forAddAttach = null;
            BindingCollection <AttachEntity> forUpdAttach = null;
            BindingCollection <AttachEntity> forDelAttach = null;

            EntityList <AttachEntity> .DiffTwoList(requestBefore.Attaches, requestAfter.Attaches, out forAddAttach, out forUpdAttach, out forDelAttach);

            foreach (AttachEntity attach in forAddAttach)
            {
                _dbAccessor.InsReqAttach(requestBefore.Id, attach);
            }
            foreach (AttachEntity attach in forDelAttach)
            {
                _dbAccessor.DelReqAttach(attach.Id);
            }

            _requestChangeCashe.Add(new RequestChangedMessage(RequestChangeType.Update, requestAfter));
        }