示例#1
0
        private ITimeEntry getTimeEntry(NSDictionary dict)
        {
            if (dict == null)
            {
                return(null);
            }

            var id          = dict.GetLongForKey(timeEntryId).Value;
            var workspaceId = dict.GetLongForKey(timeEntryWorkspaceId).Value;
            var userId      = dict.GetLongForKey(timeEntryUserId).Value;

            var description = dict.GetStringForKey(timeEntryDescription);
            var startTime   = dict.GetDateTimeOffsetForKey(timeEntryStartTime).Value;
            var duration    = dict.GetLongForKey(timeEntryDuration);
            var isBillable  = dict.GetBoolForKey(timeEntryIsBillable).Value;

            var projectId       = dict.GetLongForKey(timeEntryProjectId);
            var taskId          = dict.GetLongForKey(timeEntryTaskId);
            var serverDeletedAt = dict.GetDateTimeOffsetForKey(timeEntryServerDeletedAt);
            var at = dict.GetDateTimeOffsetForKey(timeEntryAt).Value;

            return(new TimeEntry(
                       workspaceId,
                       projectId,
                       taskId,
                       isBillable,
                       startTime,
                       duration,
                       description,
                       null,
                       userId,
                       id,
                       serverDeletedAt,
                       at));
        }
示例#2
0
        private Suggestion fromDictionary(NSDictionary dict)
        {
            if (dict == null)
            {
                return(null);
            }

            var workspaceId  = dict.GetLongForKey(suggestionWorkspaceId).Value;
            var description  = dict.GetStringForKey(suggestionDescription);
            var projectId    = dict.GetLongForKey(suggestionProjectId);
            var projectName  = dict.GetStringForKey(suggestionProjectName);
            var projectColor = dict.GetStringForKey(suggestionProjectColor);
            var taskId       = dict.GetLongForKey(suggestionTaskId);
            var taskName     = dict.GetStringForKey(suggesitonTaskName);
            var clientName   = dict.GetStringForKey(suggestionClientName);
            var isBillable   = dict.GetBoolForKey(suggestionIsBillable).Value;

            var tagIdsString = dict.GetStringForKey(suggestionTagIds);
            var tagIds       = string.IsNullOrEmpty(tagIdsString)
                ? new long[0]
                : tagIdsString.Split(tagsSeparator).Select(long.Parse).ToArray();

            return(new Suggestion(
                       workspaceId,
                       description,
                       projectId,
                       projectName,
                       projectColor,
                       taskId,
                       taskName,
                       clientName,
                       isBillable,
                       tagIds));
        }