Exemplo n.º 1
0
        public override void WriteXml(XmlWriter writer)
        {
            writer.WriteElementString(RedmineKeys.NAME, Name);
            writer.WriteElementString(RedmineKeys.IDENTIFIER, Identifier);
            writer.WriteElementString(RedmineKeys.DESCRIPTION, Description);
            writer.WriteElementString(RedmineKeys.INHERIT_MEMBERS, InheritMembers.ToString());
            writer.WriteElementString(RedmineKeys.IS_PUBLIC, IsPublic.ToString());
            writer.WriteIdOrEmpty(Parent, RedmineKeys.PARENT_ID);
            writer.WriteElementString(RedmineKeys.HOMEPAGE, HomePage);

            if (Trackers != null)
            {
                foreach (var item in Trackers)
                {
                    writer.WriteElementString(RedmineKeys.TRACKER_IDS, item.Id.ToString());
                }
            }

            if (EnabledModules != null)
            {
                foreach (var item in EnabledModules)
                {
                    writer.WriteElementString(RedmineKeys.ENABLED_MODULE_NAMES, item.Name);
                }
            }

            if (Id == 0)
            {
                return;
            }

            writer.WriteArray(CustomFields, RedmineKeys.CUSTOM_FIELDS);
        }
Exemplo n.º 2
0
 public override void WriteXml(XmlWriter writer)
 {
     writer.WriteElementString("name", Name);
     writer.WriteElementString("identifier", Identifier);
     writer.WriteElementString("description", Description);
     writer.WriteElementString("inherit_members", InheritMembers.ToString());
     writer.WriteElementString("is_public", IsPublic.ToString());
     writer.WriteIdIfNotNull(Parent, "parent_id");
     writer.WriteElementString("homepage", HomePage);
     if (!string.IsNullOrEmpty(EnabledModuleNames))
     {
         var tokens = EnabledModuleNames.Split(
             ",".ToCharArray(),
             StringSplitOptions.RemoveEmptyEntries);
         foreach (var token in tokens)
         {
             writer.WriteElementString("enabled_module_names", token);
         }
     }
     if (Id == 0)
     {
         return;
     }
     if (CustomFields != null)
     {
         writer.WriteStartElement("custom_fields");
         writer.WriteAttributeString("type", "array");
         foreach (var cf in CustomFields)
         {
             new XmlSerializer(cf.GetType()).Serialize(writer, cf);
         }
         writer.WriteEndElement();
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// </summary>
        /// <param name="writer"></param>
        public override void WriteXml(XmlWriter writer)
        {
            writer.WriteElementString(RedmineKeys.NAME, Name);
            writer.WriteElementString(RedmineKeys.IDENTIFIER, Identifier);
            writer.WriteElementString(RedmineKeys.DESCRIPTION, Description);
            writer.WriteElementString(RedmineKeys.INHERIT_MEMBERS, InheritMembers.ToString().ToLowerInvariant());
            writer.WriteElementString(RedmineKeys.IS_PUBLIC, IsPublic.ToString().ToLowerInvariant());
            writer.WriteIdOrEmpty(Parent, RedmineKeys.PARENT_ID);
            writer.WriteElementString(RedmineKeys.HOMEPAGE, HomePage);

            var trackers = new List <IValue>();

            foreach (var tracker in Trackers)
            {
                trackers.Add(tracker as IValue);
            }
            var enabledModules = new List <IValue>();

            foreach (var enabledModule in EnabledModules)
            {
                enabledModules.Add(enabledModule as IValue);
            }

            writer.WriteListElements(trackers, RedmineKeys.TRACKER_IDS);
            writer.WriteListElements(enabledModules, RedmineKeys.ENABLED_MODULE_NAMES);

            if (Id == 0)
            {
                return;
            }

            writer.WriteArray(CustomFields, RedmineKeys.CUSTOM_FIELDS);
        }
Exemplo n.º 4
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (_projectsService != null ? _projectsService.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (_navigationService != null ? _navigationService.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (DetailCommand != null ? DetailCommand.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (EditCommand != null ? EditCommand.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Identify != null ? StringComparer.CurrentCulture.GetHashCode(Identify) : 0);
         hashCode = (hashCode * 397) ^ Id;
         hashCode = (hashCode * 397) ^ (Name != null ? StringComparer.CurrentCulture.GetHashCode(Name) : 0);
         hashCode = (hashCode * 397) ^ (Identifier != null ? StringComparer.CurrentCulture.GetHashCode(Identifier) : 0);
         hashCode = (hashCode * 397) ^ (Description != null ? StringComparer.CurrentCulture.GetHashCode(Description) : 0);
         hashCode = (hashCode * 397) ^ (Parent != null ? Parent.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (HomePage != null ? StringComparer.CurrentCulture.GetHashCode(HomePage) : 0);
         hashCode = (hashCode * 397) ^ CreatedOn.GetHashCode();
         hashCode = (hashCode * 397) ^ UpdatedOn.GetHashCode();
         hashCode = (hashCode * 397) ^ (int)Status;
         hashCode = (hashCode * 397) ^ IsPublic.GetHashCode();
         hashCode = (hashCode * 397) ^ InheritMembers.GetHashCode();
         hashCode = (hashCode * 397) ^ (Trackers != null ? Trackers.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (CustomFields != null ? CustomFields.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (IssueCategories != null ? IssueCategories.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (EnabledModules != null ? EnabledModules.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (TimeEntryActivities != null ? TimeEntryActivities.GetHashCode() : 0);
         return(hashCode);
     }
 }
Exemplo n.º 5
0
        /// <summary>
        /// </summary>
        /// <param name="writer"></param>
        public override void WriteXml(System.Xml.XmlWriter writer)
        {
            writer.WriteElementString(RedmineKeys.NAME, Name);
            writer.WriteElementString(RedmineKeys.IDENTIFIER, Identifier);
            writer.WriteElementString(RedmineKeys.DESCRIPTION, Description);
            writer.WriteElementString(RedmineKeys.INHERIT_MEMBERS, InheritMembers.ToString().ToLowerInvariant());
            writer.WriteElementString(RedmineKeys.IS_PUBLIC, IsPublic.ToString().ToLowerInvariant());
            writer.WriteIdOrEmpty(Parent, RedmineKeys.PARENT_ID);
            writer.WriteElementString(RedmineKeys.HOMEPAGE, HomePage);

            writer.WriteListElements(Trackers as System.Collections.Generic.List <IValue>, RedmineKeys.TRACKER_IDS);
            writer.WriteListElements(EnabledModules as System.Collections.Generic.List <IValue>, RedmineKeys.ENABLED_MODULE_NAMES);

            if (Id == 0)
            {
                return;
            }

            writer.WriteArray(CustomFields, RedmineKeys.CUSTOM_FIELDS);
        }
Exemplo n.º 6
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (Identifier != null ? Identifier.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Description != null ? Description.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Parent != null ? Parent.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (HomePage != null ? HomePage.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ CreatedOn.GetHashCode();
         hashCode = (hashCode * 397) ^ UpdatedOn.GetHashCode();
         hashCode = (hashCode * 397) ^ (int)Status;
         hashCode = (hashCode * 397) ^ IsPublic.GetHashCode();
         hashCode = (hashCode * 397) ^ InheritMembers.GetHashCode();
         hashCode = (hashCode * 397) ^ (Trackers != null ? Trackers.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (CustomFields != null ? CustomFields.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (IssueCategories != null ? IssueCategories.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (EnabledModules != null ? EnabledModules.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (TimeEntryActivities != null ? TimeEntryActivities.GetHashCode() : 0);
         return(hashCode);
     }
 }
Exemplo n.º 7
0
        public override void WriteXml(XmlWriter writer)
        {
            writer.WriteElementString("name", Name);
            writer.WriteElementString("identifier", Identifier);
            writer.WriteElementString("description", Description);
            writer.WriteElementString("inherit_members", InheritMembers.ToString());
            writer.WriteElementString("is_public", IsPublic.ToString());
            writer.WriteIdIfNotNull(Parent, "parent_id");
            writer.WriteElementString("homepage", HomePage);

            if (EnabledModules != null)
            {
                var enabledModuleNames = "";
                foreach (var projectEnabledModule in EnabledModules)
                {
                    if (!string.IsNullOrEmpty(projectEnabledModule.Name))
                    {
                        enabledModuleNames += projectEnabledModule.Name;
                    }
                }

                writer.WriteElementString("enabled_module_names", enabledModuleNames);
            }

            if (Id == 0)
            {
                return;
            }

            if (CustomFields != null)
            {
                writer.WriteStartElement("custom_fields");
                writer.WriteAttributeString("type", "array");
                foreach (var cf in CustomFields)
                {
                    new XmlSerializer(cf.GetType()).Serialize(writer, cf);
                }
                writer.WriteEndElement();
            }
        }