Ejemplo n.º 1
0
        private void LogChange(Component component, ContentStatus status)
        {
            ContentVersionInfo info = new ContentVersionInfo
            {
                ComponentID = component.ID,
                ParentID    = component.ParentID,
                Status      = status,
                Component   = component,
                Date        = DateTime.Now
            };

            switch (_type)
            {
            case ApplicationType.Diction:
                if (ChangesDiction.FindIndex(x => x.ComponentID == component.ID && x.ParentID == component.ParentID) == -1)
                {
                    ChangesDiction.Add(info);
                }
                else
                {
                    info           = ChangesDiction.Find(x => x.ComponentID == component.ID && x.ParentID == component.ParentID);
                    info.ParentID  = component.ParentID;
                    info.Status    = status;
                    info.Component = component;
                }
                break;

            case ApplicationType.Teachers:
                if (ChangesTeachers.FindIndex(x => x.ComponentID == component.ID && x.ParentID == component.ParentID) == -1)
                {
                    ChangesTeachers.Add(info);
                }
                else
                {
                    info           = ChangesTeachers.Find(x => x.ComponentID == component.ID && x.ParentID == component.ParentID);
                    info.ParentID  = component.ParentID;
                    info.Status    = status;
                    info.Component = component;
                }
                break;

            case ApplicationType.Audio:
                if (ChangesAudio.FindIndex(x => x.ComponentID == component.ID && x.ParentID == component.ParentID) == -1)
                {
                    ChangesAudio.Add(info);
                }
                else
                {
                    info           = ChangesAudio.Find(x => x.ComponentID == component.ID && x.ParentID == component.ParentID);
                    info.ParentID  = component.ParentID;
                    info.Status    = status;
                    info.Component = component;
                }
                break;

            default:
                break;
            }
        }
Ejemplo n.º 2
0
 private void CompareAndMergeChangesLists(List <ContentVersionInfo> changes)
 {
     lock (_changesLock)
     {
         foreach (ContentVersionInfo change in changes)
         {
             if (_changes.Exists(x => x.ComponentID == change.ComponentID && x.ParentID == change.ParentID))
             {
                 ContentVersionInfo info = _changes.Find(x => x.ComponentID == change.ComponentID && x.ParentID == change.ParentID);
                 info.ParentID  = change.ParentID;
                 info.Status    = change.Status;
                 info.Component = change.Component;
             }
             else
             {
                 _changes.Add(change);
             }
         }
         _currentVersion = DateTime.Now;
     }
 }