/// <summary>
        ///     When overridden in a derived class, converts the provided dictionary into an object of the specified type.
        /// </summary>
        /// <param name="dictionary">
        ///     An <see cref="T:System.Collections.Generic.IDictionary`2" /> instance of property data stored
        ///     as name/value pairs.
        /// </param>
        /// <param name="type">The type of the resulting object.</param>
        /// <param name="serializer">The <see cref="T:System.Web.Script.Serialization.JavaScriptSerializer" /> instance.</param>
        /// <returns>
        ///     The deserialized object.
        /// </returns>
        public override object Deserialize(IDictionary<string, object> dictionary, Type type,
            JavaScriptSerializer serializer)
        {
            if (dictionary != null)
            {
                var timeEntry = new TimeEntry();

                timeEntry.Id = dictionary.GetValue<int>(RedmineKeys.ID);
                timeEntry.Activity =
                    dictionary.GetValueAsIdentifiableName(dictionary.ContainsKey(RedmineKeys.ACTIVITY)
                        ? RedmineKeys.ACTIVITY
                        : RedmineKeys.ACTIVITY_ID);
                timeEntry.Comments = dictionary.GetValue<string>(RedmineKeys.COMMENTS);
                timeEntry.Hours = dictionary.GetValue<decimal>(RedmineKeys.HOURS);
                timeEntry.Issue =
                    dictionary.GetValueAsIdentifiableName(dictionary.ContainsKey(RedmineKeys.ISSUE)
                        ? RedmineKeys.ISSUE
                        : RedmineKeys.ISSUE_ID);
                timeEntry.Project =
                    dictionary.GetValueAsIdentifiableName(dictionary.ContainsKey(RedmineKeys.PROJECT)
                        ? RedmineKeys.PROJECT
                        : RedmineKeys.PROJECT_ID);
                timeEntry.SpentOn = dictionary.GetValue<DateTime?>(RedmineKeys.SPENT_ON);
                timeEntry.User = dictionary.GetValueAsIdentifiableName(RedmineKeys.USER);
                timeEntry.CustomFields = dictionary.GetValueAsCollection<IssueCustomField>(RedmineKeys.CUSTOM_FIELDS);
                timeEntry.CreatedOn = dictionary.GetValue<DateTime?>(RedmineKeys.CREATED_ON);
                timeEntry.UpdatedOn = dictionary.GetValue<DateTime?>(RedmineKeys.UPDATED_ON);

                return timeEntry;
            }

            return null;
        }
        public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            if (dictionary != null)
            {
                var project = new Project();

                project.Id = dictionary.GetValue<int>(RedmineKeys.ID);
                project.Description = dictionary.GetValue<string>(RedmineKeys.DESCRIPTION);
                project.HomePage = dictionary.GetValue<string>(RedmineKeys.HOMEPAGE);
                project.Name = dictionary.GetValue<string>(RedmineKeys.NAME);
                project.Identifier = dictionary.GetValue<string>(RedmineKeys.IDENTIFIER);
                project.Status = dictionary.GetValue<ProjectStatus>(RedmineKeys.STATUS);
                project.CreatedOn = dictionary.GetValue<DateTime?>(RedmineKeys.CREATED_ON);
                project.UpdatedOn = dictionary.GetValue<DateTime?>(RedmineKeys.UPDATED_ON);
                project.Trackers = dictionary.GetValueAsCollection<ProjectTracker>(RedmineKeys.TRACKERS);
                project.CustomFields = dictionary.GetValueAsCollection<IssueCustomField>(RedmineKeys.CUSTOM_FIELDS);
                project.IsPublic = dictionary.GetValue<bool>(RedmineKeys.IS_PUBLIC);
                project.Parent = dictionary.GetValueAsIdentifiableName(RedmineKeys.PARENT);
                project.IssueCategories = dictionary.GetValueAsCollection<ProjectIssueCategory>(RedmineKeys.ISSUE_CATEGORIES);
                project.EnabledModules = dictionary.GetValueAsCollection<ProjectEnabledModule>(RedmineKeys.ENABLED_MODULES);
                return project;
            }

            return null;
        }
        public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            if (dictionary != null)
            {
                var projectMembership = new ProjectMembership();

                projectMembership.Id = dictionary.GetValue<int>(RedmineKeys.ID);
                projectMembership.Group = dictionary.GetValueAsIdentifiableName(RedmineKeys.GROUP);
                projectMembership.Project = dictionary.GetValueAsIdentifiableName(RedmineKeys.PROJECT);
                projectMembership.Roles = dictionary.GetValueAsCollection<MembershipRole>(RedmineKeys.ROLES);
                projectMembership.User = dictionary.GetValueAsIdentifiableName(RedmineKeys.USER);

                return projectMembership;
            }
            return null;
        }
        public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            if (dictionary != null)
            {
                var issueCategory = new IssueCategory();

                issueCategory.Id = dictionary.GetValue<int>(RedmineKeys.ID);
                issueCategory.Project = dictionary.GetValueAsIdentifiableName(RedmineKeys.PROJECT);
                issueCategory.AsignTo = dictionary.GetValueAsIdentifiableName(RedmineKeys.ASSIGNED_TO);
                issueCategory.Name = dictionary.GetValue<string>(RedmineKeys.NAME);

                return issueCategory;
            }

            return null;
        }
        public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            if (dictionary != null)
            {
                var issueCategory = new IssueCategory();

                issueCategory.Id = dictionary.GetValue<int>("id");
                issueCategory.Project = dictionary.GetValueAsIdentifiableName("project");
                issueCategory.AsignTo = dictionary.GetValueAsIdentifiableName("assigned_to");
                issueCategory.Name = dictionary.GetValue<string>("name");

                return issueCategory;
            }

            return null;
        }
        public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            if (dictionary != null)
            {
                var project = new Project();

                project.Id = dictionary.GetValue<int>("id");
                project.Description = dictionary.GetValue<string>("description");
                project.HomePage = dictionary.GetValue<string>("homepage");
                project.Name = dictionary.GetValue<string>("name");
                project.Identifier = dictionary.GetValue<string>("identifier");
                project.Status = dictionary.GetValue<ProjectStatus>("status");
                project.CreatedOn = dictionary.GetValue<DateTime?>("created_on");
                project.UpdatedOn = dictionary.GetValue<DateTime?>("updated_on");
                project.Trackers = dictionary.GetValueAsCollection<ProjectTracker>("trackers");
                project.CustomFields = dictionary.GetValueAsCollection<IssueCustomField>("custom_fields");
                project.IsPublic = dictionary.GetValue<bool>("is_public");
                project.Parent = dictionary.GetValueAsIdentifiableName("parent");
                project.IssueCategories = dictionary.GetValueAsCollection<ProjectIssueCategory>("issue_categories");
                project.EnabledModules = dictionary.GetValueAsCollection<ProjectEnabledModule>("enabled_modules");
                return project;
            }

            return null;
        }
        public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            if (dictionary != null)
            {
                var projectMembership = new ProjectMembership();

                projectMembership.Id = dictionary.GetValue<int>("id");
                projectMembership.Group = dictionary.GetValueAsIdentifiableName("group");
                projectMembership.Project = dictionary.GetValueAsIdentifiableName("project");
                projectMembership.Roles = dictionary.GetValueAsCollection<MembershipRole>("roles");
                projectMembership.User = dictionary.GetValueAsIdentifiableName("user");

                return projectMembership;
            }
            return null;
        }
        public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            if (dictionary != null)
            {
                var news = new News();

                news.Id = dictionary.GetValue<int>("id");
                news.Author = dictionary.GetValueAsIdentifiableName("author");
                news.CreatedOn = dictionary.GetValue<DateTime?>("created_on");
                news.Description = dictionary.GetValue<string>("description");
                news.Project = dictionary.GetValueAsIdentifiableName("project");
                news.Summary = dictionary.GetValue<string>("summary");
                news.Title = dictionary.GetValue<string>("title");

                return news;
            }
            return null;
        }
        public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            if (dictionary != null)
            {
                var news = new News();

                news.Id = dictionary.GetValue<int>(RedmineKeys.ID);
                news.Author = dictionary.GetValueAsIdentifiableName(RedmineKeys.AUTHOR);
                news.CreatedOn = dictionary.GetValue<DateTime?>(RedmineKeys.CREATED_ON);
                news.Description = dictionary.GetValue<string>(RedmineKeys.DESCRIPTION);
                news.Project = dictionary.GetValueAsIdentifiableName(RedmineKeys.PROJECT);
                news.Summary = dictionary.GetValue<string>(RedmineKeys.SUMMARY);
                news.Title = dictionary.GetValue<string>(RedmineKeys.TITLE);

                return news;
            }
            return null;
        }
        public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            if (dictionary != null)
            {
                var issue = new Issue();

                issue.Id = dictionary.GetValue<int>(RedmineKeys.ID);
                issue.Description = dictionary.GetValue<string>(RedmineKeys.DESCRIPTION);
                issue.Project = dictionary.GetValueAsIdentifiableName(RedmineKeys.PROJECT);
                issue.Tracker = dictionary.GetValueAsIdentifiableName(RedmineKeys.TRACKER);
                issue.Status = dictionary.GetValueAsIdentifiableName(RedmineKeys.STATUS);
                issue.CreatedOn = dictionary.GetValue<DateTime?>(RedmineKeys.CREATED_ON);
                issue.UpdatedOn = dictionary.GetValue<DateTime?>(RedmineKeys.UPDATED_ON);
                issue.ClosedOn = dictionary.GetValue<DateTime?>(RedmineKeys.CLOSED_ON);
                issue.Priority = dictionary.GetValueAsIdentifiableName(RedmineKeys.PRIORITY);
                issue.Author = dictionary.GetValueAsIdentifiableName(RedmineKeys.AUTHOR);
                issue.AssignedTo = dictionary.GetValueAsIdentifiableName(RedmineKeys.ASSIGNED_TO);
                issue.Category = dictionary.GetValueAsIdentifiableName(RedmineKeys.CATEGORY);
                issue.FixedVersion = dictionary.GetValueAsIdentifiableName(RedmineKeys.FIXED_VERSION);
                issue.Subject = dictionary.GetValue<string>(RedmineKeys.SUBJECT);
                issue.Notes = dictionary.GetValue<string>(RedmineKeys.NOTES);
                issue.IsPrivate = dictionary.GetValue<bool>(RedmineKeys.IS_PRIVATE);
                issue.StartDate = dictionary.GetValue<DateTime?>(RedmineKeys.START_DATE);
                issue.DueDate = dictionary.GetValue<DateTime?>(RedmineKeys.DUE_DATE);
                issue.DoneRatio = dictionary.GetValue<float>(RedmineKeys.DONE_RATIO);
                issue.EstimatedHours = dictionary.GetValue<float>(RedmineKeys.ESTIMATED_HOURS);
                issue.SpentHours = dictionary.GetValue<float>(RedmineKeys.SPENT_HOURS);
                issue.ParentIssue = dictionary.GetValueAsIdentifiableName(RedmineKeys.PARENT);

                issue.CustomFields = dictionary.GetValueAsCollection<IssueCustomField>(RedmineKeys.CUSTOM_FIELDS);
                issue.Attachments = dictionary.GetValueAsCollection<Attachment>(RedmineKeys.ATTACHMENTS);
                issue.Relations = dictionary.GetValueAsCollection<IssueRelation>(RedmineKeys.RELATIONS);
                issue.Journals = dictionary.GetValueAsCollection<Journal>(RedmineKeys.JOURNALS);
                issue.Changesets = dictionary.GetValueAsCollection<ChangeSet>(RedmineKeys.CHANGESETS);
                issue.Watchers = dictionary.GetValueAsCollection<Watcher>(RedmineKeys.WATCHERS);
                issue.Children = dictionary.GetValueAsCollection<IssueChild>(RedmineKeys.CHILDREN);

                //easy redmine
                issue.ActivityId = dictionary.GetValue<int?>(RedmineKeys.ACTIVITY_ID);
                return issue;
            }

            return null;
        }
        public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            if (dictionary != null)
            {
                var timeEntry = new TimeEntry();

                timeEntry.Id = dictionary.GetValue<int>("id");
                timeEntry.Activity = dictionary.GetValueAsIdentifiableName(dictionary.ContainsKey("activity") ? "activity" : "activity_id");
                timeEntry.Comments = dictionary.GetValue<string>("comments");
                timeEntry.Hours = dictionary.GetValue<decimal>("hours");
                timeEntry.Issue = dictionary.GetValueAsIdentifiableName(dictionary.ContainsKey("issue") ? "issue" : "issue_id");
                timeEntry.Project = dictionary.GetValueAsIdentifiableName(dictionary.ContainsKey("project") ? "project" : "project_id");
                timeEntry.SpentOn = dictionary.GetValue<DateTime?>("spent_on");
                timeEntry.User = dictionary.GetValueAsIdentifiableName("user");
                timeEntry.CustomFields = dictionary.GetValueAsCollection<IssueCustomField>("custom_fields");
                timeEntry.CreatedOn = dictionary.GetValue<DateTime?>("created_on");
                timeEntry.UpdatedOn = dictionary.GetValue<DateTime?>("updated_on");

                return timeEntry;
            }

            return null;
        }
        public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            if (dictionary != null)
            {
                var issue = new Issue();

                issue.Id = dictionary.GetValue<int>("id");
                issue.Description = dictionary.GetValue<string>("description");
                issue.Project = dictionary.GetValueAsIdentifiableName("project");
                issue.Tracker = dictionary.GetValueAsIdentifiableName("tracker");
                issue.Status = dictionary.GetValueAsIdentifiableName("status");
                issue.CreatedOn = dictionary.GetValue<DateTime?>("created_on");
                issue.UpdatedOn = dictionary.GetValue<DateTime?>("updated_on");
                issue.ClosedOn = dictionary.GetValue<DateTime?>("closed_on");
                issue.Priority = dictionary.GetValueAsIdentifiableName("priority");
                issue.Author = dictionary.GetValueAsIdentifiableName("author");
                issue.AssignedTo = dictionary.GetValueAsIdentifiableName("assigned_to");
                issue.Category = dictionary.GetValueAsIdentifiableName("category");
                issue.FixedVersion = dictionary.GetValueAsIdentifiableName("fixed_version");
                issue.Subject = dictionary.GetValue<string>("subject");
                issue.Notes = dictionary.GetValue<string>("notes");
                issue.IsPrivate = dictionary.GetValue<bool>("is_private");
                issue.StartDate = dictionary.GetValue<DateTime?>("start_date");
                issue.DueDate = dictionary.GetValue<DateTime?>("due_date");
                issue.DoneRatio = dictionary.GetValue<float>("done_ratio");
                issue.EstimatedHours = dictionary.GetValue<float>("estimated_hours");
                issue.ParentIssue = dictionary.GetValueAsIdentifiableName("parent");

                issue.CustomFields = dictionary.GetValueAsCollection<IssueCustomField>("custom_fields");
                issue.Attachments = dictionary.GetValueAsCollection<Attachment>("attachments");
                issue.Relations = dictionary.GetValueAsCollection<IssueRelation>("relations");
                issue.Journals = dictionary.GetValueAsCollection<Journal>("journals");
                issue.Changesets = dictionary.GetValueAsCollection<ChangeSet>("changesets");
                issue.Watchers = dictionary.GetValueAsCollection<Watcher>("watchers");
                issue.Children = dictionary.GetValueAsCollection<IssueChild>("children");
                return issue;
            }

            return null;
        }
        public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            if (dictionary != null)
            {
                var issueChild = new IssueChild
                {
                    Id = dictionary.GetValue<int>("id"),
                    Tracker = dictionary.GetValueAsIdentifiableName("tracker"),
                    Subject = dictionary.GetValue<string>("subject")
                };

                return issueChild;
            }

            return null;
        }
        public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            if (dictionary != null)
            {
                var issueChild = new IssueChild
                {
                    Id = dictionary.GetValue<int>(RedmineKeys.ID),
                    Tracker = dictionary.GetValueAsIdentifiableName(RedmineKeys.TRACKER),
                    Subject = dictionary.GetValue<string>(RedmineKeys.SUBJECT)
                };

                return issueChild;
            }

            return null;
        }
        public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            if (dictionary != null)
            {
                var journal = new Journal();

                journal.Id = dictionary.GetValue<int>(RedmineKeys.ID);
                journal.Notes = dictionary.GetValue<string>(RedmineKeys.NOTES);
                journal.User = dictionary.GetValueAsIdentifiableName(RedmineKeys.USER);
                journal.CreatedOn = dictionary.GetValue<DateTime?>(RedmineKeys.CREATED_ON);
                journal.Details = dictionary.GetValueAsCollection<Detail>(RedmineKeys.DETAILS);

                return journal;
            }

            return null;
        }
        public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            if (dictionary != null)
            {
                var journal = new Journal();

                journal.Id = dictionary.GetValue<int>("id");
                journal.Notes = dictionary.GetValue<string>("notes");
                journal.User = dictionary.GetValueAsIdentifiableName("user");
                journal.CreatedOn = dictionary.GetValue<DateTime?>("created_on");
                journal.Details = dictionary.GetValueAsCollection<Detail>("details");

                return journal;
            }

            return null;
        }
        public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            if (dictionary != null)
            {
                var changeSet = new ChangeSet
                {
                    Revision = dictionary.GetValue<int>("revision"),
                    Comments = dictionary.GetValue<string>("comments"),
                    User = dictionary.GetValueAsIdentifiableName("user"),
                    CommittedOn = dictionary.GetValue<DateTime?>("committed_on")
                };

                return changeSet;
            }

            return null;
        }
        /// <summary>
        /// When overridden in a derived class, converts the provided dictionary into an object of the specified type.
        /// </summary>
        /// <param name="dictionary">An <see cref="T:System.Collections.Generic.IDictionary`2" /> instance of property data stored as name/value pairs.</param>
        /// <param name="type">The type of the resulting object.</param>
        /// <param name="serializer">The <see cref="T:System.Web.Script.Serialization.JavaScriptSerializer" /> instance.</param>
        /// <returns>
        /// The deserialized object.
        /// </returns>
        public override object Deserialize(IDictionary<string, object> dictionary, Type type,
            JavaScriptSerializer serializer)
        {
            if (dictionary != null)
            {
                var changeSet = new ChangeSet
                {
                    Revision = dictionary.GetValue<int>(RedmineKeys.REVISION),
                    Comments = dictionary.GetValue<string>(RedmineKeys.COMMENTS),
                    User = dictionary.GetValueAsIdentifiableName(RedmineKeys.USER),
                    CommittedOn = dictionary.GetValue<DateTime?>(RedmineKeys.COMMITTED_ON)
                };

                return changeSet;
            }

            return null;
        }
        public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            if (dictionary != null)
            {
                var attachment = new Attachment();

                attachment.Id = dictionary.GetValue<int>("id");
                attachment.Description = dictionary.GetValue<string>("description");
                attachment.Author = dictionary.GetValueAsIdentifiableName("author");
                attachment.ContentType = dictionary.GetValue<string>("content_type");
                attachment.ContentUrl = dictionary.GetValue<string>("content_url");
                attachment.CreatedOn = dictionary.GetValue<DateTime?>("created_on");
                attachment.FileName = dictionary.GetValue<string>("filename");
                attachment.FileSize = dictionary.GetValue<int>("filesize");

                return attachment;
            }

            return null;
        }
        public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            if (dictionary != null)
            {
                var attachment = new Attachment();

                attachment.Id = dictionary.GetValue<int>(RedmineKeys.ID);
                attachment.Description = dictionary.GetValue<string>(RedmineKeys.DESCRIPTION);
                attachment.Author = dictionary.GetValueAsIdentifiableName(RedmineKeys.AUTHOR);
                attachment.ContentType = dictionary.GetValue<string>(RedmineKeys.CONTENT_TYPE);
                attachment.ContentUrl = dictionary.GetValue<string>(RedmineKeys.CONTENT_URL);
                attachment.CreatedOn = dictionary.GetValue<DateTime?>(RedmineKeys.CREATED_ON);
                attachment.FileName = dictionary.GetValue<string>(RedmineKeys.FILENAME);
                attachment.FileSize = dictionary.GetValue<int>(RedmineKeys.FILESIZE);

                return attachment;
            }

            return null;
        }
        public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            if (dictionary != null)
            {
                var tracker = new WikiPage();

                tracker.Id = dictionary.GetValue<int>("id");
                tracker.Author = dictionary.GetValueAsIdentifiableName("author");
                tracker.Comments = dictionary.GetValue<string>("comments");
                tracker.CreatedOn = dictionary.GetValue<DateTime?>("created_on");
                tracker.Text = dictionary.GetValue<string>("text");
                tracker.Title = dictionary.GetValue<string>("title");
                tracker.UpdatedOn = dictionary.GetValue<DateTime?>("updated_on");
                tracker.Version = dictionary.GetValue<int>("version");
                tracker.Attachments = dictionary.GetValueAsCollection<Attachment>("attachments");

                return tracker;
            }

            return null;
        }
        public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            if (dictionary != null)
            {
                var tracker = new WikiPage();

                tracker.Id = dictionary.GetValue<int>(RedmineKeys.ID);
                tracker.Author = dictionary.GetValueAsIdentifiableName(RedmineKeys.AUTHOR);
                tracker.Comments = dictionary.GetValue<string>(RedmineKeys.COMMENTS);
                tracker.CreatedOn = dictionary.GetValue<DateTime?>(RedmineKeys.CREATED_ON);
                tracker.Text = dictionary.GetValue<string>(RedmineKeys.TEXT);
                tracker.Title = dictionary.GetValue<string>(RedmineKeys.TITLE);
                tracker.UpdatedOn = dictionary.GetValue<DateTime?>(RedmineKeys.UPDATED_ON);
                tracker.Version = dictionary.GetValue<int>(RedmineKeys.VERSION);
                tracker.Attachments = dictionary.GetValueAsCollection<Attachment>(RedmineKeys.ATTACHMENTS);

                return tracker;
            }

            return null;
        }
Beispiel #23
0
        public override object Deserialize(IDictionary <string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            if (dictionary != null)
            {
                var project = new Project();

                project.Id              = dictionary.GetValue <int>("id");
                project.Description     = dictionary.GetValue <string>("description");
                project.HomePage        = dictionary.GetValue <string>("homepage");
                project.Name            = dictionary.GetValue <string>("name");
                project.Identifier      = dictionary.GetValue <string>("identifier");
                project.CreatedOn       = dictionary.GetValue <DateTime?>("created_on");
                project.UpdatedOn       = dictionary.GetValue <DateTime?>("updated_on");
                project.Trackers        = dictionary.GetValueAsCollection <ProjectTracker>("trackers");
                project.CustomFields    = dictionary.GetValueAsCollection <CustomField>("custom_fields");
                project.Parent          = dictionary.GetValueAsIdentifiableName("parent");
                project.IssueCategories = dictionary.GetValueAsCollection <IssueCategory>("issue_categories");
                return(project);
            }

            return(null);
        }
        public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            if (dictionary != null)
            {
                var version = new Version();

                version.Id = dictionary.GetValue<int>(RedmineKeys.ID);
                version.Description = dictionary.GetValue<string>(RedmineKeys.DESCRIPTION);
                version.Name = dictionary.GetValue<string>(RedmineKeys.NAME);
                version.CreatedOn = dictionary.GetValue<DateTime?>(RedmineKeys.CREATED_ON);
                version.UpdatedOn = dictionary.GetValue<DateTime?>(RedmineKeys.UPDATED_ON);
                version.DueDate = dictionary.GetValue<DateTime?>(RedmineKeys.DUE_DATE);
                version.Project = dictionary.GetValueAsIdentifiableName(RedmineKeys.PROJECT);
                version.Sharing = dictionary.GetValue<VersionSharing>(RedmineKeys.SHARING);
                version.Status = dictionary.GetValue<VersionStatus>(RedmineKeys.STATUS);
                version.CustomFields = dictionary.GetValueAsCollection<IssueCustomField>(RedmineKeys.CUSTOM_FIELDS);

                return version;
            }

            return null;
        }
        public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            if (dictionary != null)
            {
                var version = new Version();

                version.Id = dictionary.GetValue<int>("id");
                version.Description = dictionary.GetValue<string>("description");
                version.Name = dictionary.GetValue<string>("name");
                version.CreatedOn = dictionary.GetValue<DateTime?>("created_on");
                version.UpdatedOn = dictionary.GetValue<DateTime?>("updated_on");
                version.DueDate = dictionary.GetValue<DateTime?>("due_date");
                version.Project = dictionary.GetValueAsIdentifiableName("project");
                version.Sharing = dictionary.GetValue<VersionSharing>("sharing");
                version.Status = dictionary.GetValue<VersionStatus>("status");
                version.CustomFields = dictionary.GetValueAsCollection<IssueCustomField>("custom_fields");

                return version;
            }

            return null;
        }
Beispiel #26
0
        public override object Deserialize(
            IDictionary <string, object> dictionary,
            Type type,
            JavaScriptSerializer serializer)
        {
            if (dictionary == null)
            {
                return(null);
            }
            var attachment = new Attachment
            {
                Id          = dictionary.GetValue <int>("id"),
                Description = dictionary.GetValue <string>("description"),
                Author      = dictionary.GetValueAsIdentifiableName("author"),
                ContentType = dictionary.GetValue <string>("content_type"),
                ContentUrl  = dictionary.GetValue <string>("content_url"),
                CreatedOn   = dictionary.GetValue <DateTime?>("created_on"),
                FileName    = dictionary.GetValue <string>("filename"),
                FileSize    = dictionary.GetValue <int>("filesize")
            };

            return(attachment);
        }
Beispiel #27
0
        /// <summary>
        ///     When overridden in a derived class, converts the provided dictionary into an object of the specified type.
        /// </summary>
        /// <param name="dictionary">
        ///     An <see cref="T:System.Collections.Generic.IDictionary`2" /> instance of property data stored
        ///     as name/value pairs.
        /// </param>
        /// <param name="type">The type of the resulting object.</param>
        /// <param name="serializer">The <see cref="T:System.Web.Script.Serialization.JavaScriptSerializer" /> instance.</param>
        /// <returns>
        ///     The deserialized object.
        /// </returns>
        public override object Deserialize(IDictionary <string, object> dictionary, Type type,
                                           JavaScriptSerializer serializer)
        {
            if (dictionary != null)
            {
                var version = new Version();

                version.Id           = dictionary.GetValue <int>(RedmineKeys.ID);
                version.Description  = dictionary.GetValue <string>(RedmineKeys.DESCRIPTION);
                version.Name         = dictionary.GetValue <string>(RedmineKeys.NAME);
                version.CreatedOn    = dictionary.GetValue <DateTime?>(RedmineKeys.CREATED_ON);
                version.UpdatedOn    = dictionary.GetValue <DateTime?>(RedmineKeys.UPDATED_ON);
                version.DueDate      = dictionary.GetValue <DateTime?>(RedmineKeys.DUE_DATE);
                version.Project      = dictionary.GetValueAsIdentifiableName(RedmineKeys.PROJECT);
                version.Sharing      = dictionary.GetValue <VersionSharing>(RedmineKeys.SHARING);
                version.Status       = dictionary.GetValue <VersionStatus>(RedmineKeys.STATUS);
                version.CustomFields = dictionary.GetValueAsCollection <IssueCustomField>(RedmineKeys.CUSTOM_FIELDS);

                return(version);
            }

            return(null);
        }