示例#1
0
        public Task GetEntity(int id)
        {
            var mongoDbtask = m_tasksDataSource.GetTask(id);

            var result = new Task(mongoDbtask);

            return(result);
        }
示例#2
0
        public void SaveEvents(Event[] events)
        {
            foreach (var eventItem in events)
            {
                var mongoEvent = new MongoDbEvent(eventItem);
                m_eventDataSource.SaveEvent(mongoEvent);

                if (eventItem.TaskId.HasValue)
                {
                    var tasksDataSource = new MongoDbTasksDataSource();
                    var task            = tasksDataSource.GetTask(eventItem.TaskId.Value);

                    switch ((InputType)eventItem.InputType)
                    {
                    case InputType.TaskStatusChange:
                        task = ChangeTaskStatus(eventItem, task);
                        break;

                    case InputType.ImageId:
                        task.ImageId = eventItem.Text;
                        break;

                    case InputType.SignatureId:
                        task.SignatureId = eventItem.Text;
                        break;

                    case InputType.UserComment:
                        task.UserComment = eventItem.Text;
                        break;
                    }

                    tasksDataSource.SaveTask(task);
                }
            }
        }