private Activity GetFileActivity(FileEntry fileEntry, DateTimeRange range)
        {
            object wrapper;

            if (fileEntry is File)
                wrapper = new FileWrapper((File) fileEntry);
            else
                wrapper = new FolderWrapper((Folder) fileEntry);

            var activity = new Activity(Documents, wrapper)
            {
                Action = (range.In(fileEntry.CreateOn) ? ActivityAction.Created : ActivityAction.Undefined) | (range.In(fileEntry.ModifiedOn) ? ActivityAction.Updated : ActivityAction.Undefined) | (range.In(fileEntry.SharedToMeOn) ? ActivityAction.Shared : ActivityAction.Undefined),
                ItemType = "file",
            };

            if (range.In(fileEntry.CreateOn))
            {
                activity.CreatedBy = fileEntry.CreateBy;
                activity.When = fileEntry.CreateOn;
            }
            else if (range.In(fileEntry.ModifiedOn))
            {
                activity.CreatedBy = fileEntry.ModifiedBy;
                activity.When = fileEntry.ModifiedOn;
            }
            else if (range.In(fileEntry.SharedToMeOn))
            {
                activity.CreatedBy = new Guid(fileEntry.SharedToMeBy);
                activity.When = fileEntry.SharedToMeOn;
            }

            return activity;
        }
Exemplo n.º 2
0
        public ApiActivity(Activity activity)
        {
            this.Action = activity.Action;
            this.Importance = activity.Importance;
            this.IsNew = activity.IsNew;
            this.Item = activity.Item;
            this.ItemType = activity.ItemType;
            this.Priority = activity.Priority;
            this.Source = activity.Source;
            this.ValidTo = (ApiDateTime) activity.ValidTo;
            this.When = (ApiDateTime) activity.When;

            if (activity.CreatedBy.HasValue)
            {
                this.CreatedBy = Employee.EmployeeWraper.Get(activity.CreatedBy.Value);
            }
            this.RelativeTo = activity.RelativeTo;
        }