public void CreateWorkItem(WorkItem workItem)
        {
            var entry = WorkItemLogEntry.CreateEntry(workItem);

            _workflow.CreateWorkItem(workItem);
            _log.AddLogEntry(entry);
        }
        public void UpdateWorkItem(WorkItem workItem)
        {
            var oldWorkItem = _workflow.GetWorkItem(workItem.Id);

            var entry = WorkItemLogEntry.UpdateEntry(workItem, oldWorkItem);

            _workflow.UpdateWorkItem(workItem);
            _log.AddLogEntry(entry);
        }
        public void DeleteWorkItem(string workItemId)
        {
            var oldWorkItem = _workflow.GetWorkItem(workItemId);

            _workflow.DeleteWorkItem(workItemId);

            var entry = WorkItemLogEntry.DeleteEntry(oldWorkItem);

            _log.AddLogEntry(entry);
        }
        public void AddLogEntry(WorkItemLogEntry logEntry)
        {
            if (logEntry.LogOperation == LogOperationType.Delete)
            {
                _writer.WriteLine("{0},{1},{2}", "DELETE ITEM", logEntry.Timestamp, logEntry.WorkItem.Id);
            }
            else if (logEntry.LogOperation == LogOperationType.Create)
            {
                var serializedProperties = logEntry.WorkItem.Properties.Select(kv => kv.Key + "=" + kv.Value).Join('&');
                _writer.WriteLine("{0},{1},{2},{3},{4}", "CREATE ITEM", logEntry.Timestamp, logEntry.WorkItem.Id, logEntry.WorkItem.Path, serializedProperties);
            }
            else if (logEntry.LogOperation == LogOperationType.Update)
            {
                var serializedProperties = logEntry.WorkItem.Properties.Select(kv => kv.Key + "=" + kv.Value).Join('&');
                _writer.WriteLine("{0},{1},{2},{3},{4},{5}", "UPDATE ITEM", DateTime.Now, logEntry.PreviousWorkItem.Id, logEntry.PreviousWorkItem.Path, logEntry.WorkItem.Path, serializedProperties);
            }

            _writer.Flush();
        }
        public void AddLogEntry(WorkItemLogEntry logEntry)
        {
            if(logEntry.LogOperation==LogOperationType.Delete)
            {
                _writer.WriteLine("{0},{1},{2}", "DELETE ITEM", logEntry.Timestamp, logEntry.WorkItem.Id);
            }
            else if (logEntry.LogOperation == LogOperationType.Create)
            {
                var serializedProperties = logEntry.WorkItem.Properties.Select(kv => kv.Key + "=" + kv.Value).Join('&');
                _writer.WriteLine("{0},{1},{2},{3},{4}", "CREATE ITEM", logEntry.Timestamp, logEntry.WorkItem.Id, logEntry.WorkItem.Path, serializedProperties);
            }
            else if (logEntry.LogOperation == LogOperationType.Update)
            {
                var serializedProperties = logEntry.WorkItem.Properties.Select(kv => kv.Key + "=" + kv.Value).Join('&');
                _writer.WriteLine("{0},{1},{2},{3},{4},{5}", "UPDATE ITEM", DateTime.Now, logEntry.PreviousWorkItem.Id, logEntry.PreviousWorkItem.Path, logEntry.WorkItem.Path, serializedProperties);
            }

            _writer.Flush();
        }
 public void AddLogEntry(WorkItemLogEntry logEntry)
 {
     _workItemLogEntries.Add(logEntry);
 }