コード例 #1
0
        public static JiraIssue ToJiraIssue(this SdpApi sdpIncident, string projectKey, string sdpBaseUrl, JiraIssueType issueType)
        {
            var jiraIssue = new JiraIssue();


            jiraIssue.Fields = new Fields()
            {
                Project = new Project()
                {
                    Key = projectKey
                },
                Description =
                    sdpIncident.Response.Operation.Details.Parameters.First(p => p.Name == SdpParaNames.ShortDescription)
                    .Value,
                IssueType = new IssueType()
                {
                    Name = issueType.ToString()
                },
                Summary =
                    sdpIncident.Response.Operation.Details.Parameters.First(p => p.Name == SdpParaNames.Subject)
                    .Value
            };

            var incidentId =
                sdpIncident.Response.Operation.Details.Parameters.First(p => p.Name == SdpParaNames.WorkOrderId)
                .Value;

            jiraIssue.Fields.Description = jiraIssue.Fields.Description + Environment.NewLine + Environment.NewLine;
            jiraIssue.Fields.Description = jiraIssue.Fields.Description + "Click below link to view in SDP" + Environment.NewLine;
            jiraIssue.Fields.Description = jiraIssue.Fields.Description + string.Format(sdpBaseUrl, incidentId);

            return(jiraIssue);
        }
コード例 #2
0
        public static string SerializeObject(SdpApi toSerialize)
        {
            var xmlSerializer = new System.Xml.Serialization.XmlSerializer(typeof(SdpApi));
            var textWriter    = new StringWriter();
            var ns            = new XmlSerializerNamespaces();

            ns.Add("", "");
            xmlSerializer.Serialize(textWriter, toSerialize, ns);
            return(textWriter.ToString());
        }