Beispiel #1
0
        protected override void CommitCore()
        {
            var xml  = new XmlDocument();
            var root = xml.CreateElement("issue");

            EmitIfChanged(Original.Parent, Parent, xml, root, "parent_issue_id", RedmineUtility.EmitObjectId);

            EmitIfChanged(Original.Tracker, Tracker, xml, root, "tracker_id", RedmineUtility.EmitObjectId);
            EmitIfChanged(Original.Status, Status, xml, root, "status_id", RedmineUtility.EmitObjectId);
            EmitIfChanged(Original.Priority, Priority, xml, root, "priority_id", RedmineUtility.EmitObjectId);

            EmitIfChanged(Original.AssignedTo, AssignedTo, xml, root, "assigned_to_id", RedmineUtility.EmitObjectId);
            EmitIfChanged(Original.Category, Category, xml, root, "category_id", RedmineUtility.EmitObjectId);
            EmitIfChanged(Original.FixedVersion, FixedVersion, xml, root, "fixed_version_id", RedmineUtility.EmitObjectId);

            EmitIfChanged(Original.Subject, Subject, xml, root, "subject", RedmineUtility.EmitString);
            EmitIfChanged(Original.Description, Description, xml, root, "description", RedmineUtility.EmitString);
            EmitIfChanged(string.Empty, Notes, xml, root, "notes", RedmineUtility.EmitString);

            EmitIfChanged(Original.StartDate, StartDate, xml, root, "start_date", RedmineUtility.EmitDate);
            EmitIfChanged(Original.DueDate, DueDate, xml, root, "due_date", RedmineUtility.EmitDate);

            EmitIfChanged(Original.DoneRatio, DoneRatio, xml, root, "done_ratio", RedmineUtility.EmitDouble);
            EmitIfChanged(Original.EstimatedHours, EstimatedHours, xml, root, "estimated_hours", RedmineUtility.EmitDouble);

            var cfv = xml.CreateElement("custom_fields");

            _customFields.EmitChanged(cfv);
            if (cfv.ChildNodes.Count != 0)
            {
                var attr = xml.CreateAttribute("type");
                attr.Value = "array";
                cfv.Attributes.Append(attr);
                root.AppendChild(cfv);
            }

            if (root.ChildNodes.Count == 0)
            {
                return;
            }

            xml.AppendChild(root);

            var url = string.Format(CultureInfo.InvariantCulture,
                                    "issues/{0}.xml", Original.Id);

            Original.Context.PutXml(url, xml);
            Original.Update();
        }
Beispiel #2
0
        protected override void CommitCore()
        {
            var xml  = new XmlDocument();
            var root = xml.CreateElement("issue");

            EmitIfChanged(null, Project, xml, root, "project_id", RedmineUtility.EmitObjectId);
            EmitIfChanged(null, Parent, xml, root, "parent_issue_id", RedmineUtility.EmitObjectId);

            EmitIfChanged(null, Tracker, xml, root, "tracker_id", RedmineUtility.EmitObjectId);
            EmitIfChanged(null, Status, xml, root, "status_id", RedmineUtility.EmitObjectId);
            EmitIfChanged(null, Priority, xml, root, "priority_id", RedmineUtility.EmitObjectId);

            EmitIfChanged(null, AssignedTo, xml, root, "assigned_to_id", RedmineUtility.EmitObjectId);
            EmitIfChanged(null, Category, xml, root, "category_id", RedmineUtility.EmitObjectId);
            EmitIfChanged(null, FixedVersion, xml, root, "fixed_version_id", RedmineUtility.EmitObjectId);

            EmitIfChanged(null, Subject, xml, root, "subject", RedmineUtility.EmitString);
            EmitIfChanged(null, Description, xml, root, "description", RedmineUtility.EmitString);

            EmitIfChanged(null, StartDate, xml, root, "start_date", RedmineUtility.EmitDate);
            EmitIfChanged(null, DueDate, xml, root, "due_date", RedmineUtility.EmitDate);

            EmitIfChanged(0, DoneRatio, xml, root, "done_ratio", RedmineUtility.EmitDouble);
            EmitIfChanged(0, EstimatedHours, xml, root, "estimated_hours", RedmineUtility.EmitDouble);

            var cfv = xml.CreateElement("custom_fields");

            _customFields.EmitChanged(cfv);
            if (cfv.ChildNodes.Count != 0)
            {
                var attr = xml.CreateAttribute("type");
                attr.Value = "array";
                cfv.Attributes.Append(attr);
                root.AppendChild(cfv);
            }

            xml.AppendChild(root);

            const string url = "issues.xml";

            Context.PostXml(url, xml);
        }