using System; using System.Collections.Generic; using System.Linq; using System.Text; using JIRAFacade; using System.Reflection; using System.IO; using System.Xml.Serialization; namespace CloseIssueConsole { class Program { public static string _issueKey = string.Empty; public static string _issueSummary = string.Empty; public static string _issueIsClosed; public static string _jiraUserName = string.Empty; public static string _jiraPassword = string.Empty; public static string _jiraURL = string.Empty; public static IssueList _issueList = new IssueList(); public static void Main(string[] args) { try { DeserializeXml(); string[] issueKeyArray = _issueKey.Split('|'); string[] issueSumArray = _issueSummary.Split('|'); string[] issueIsClosedArray = _issueIsClosed.ToString().Split('|'); for (int i = 0; i < issueKeyArray.Length; i++) { if (issueIsClosedArray[i] != string.Empty | issueKeyArray[i] != string.Empty) { ReadWriteXML readXML = new ReadWriteXML(); _jiraUserName = readXML.Jirausername(); _jiraPassword = readXML.JiraPassword(); _jiraURL = readXML.JiraURL(); JiraFacade.JIRA.ServiceURL = _jiraURL + "/rpc/soap/jirasoapservice-v2?wsdl"; JiraFacade.JIRA.Login(_jiraUserName, _jiraPassword); JiraFacade.JIRA.ProgressWorkFlowAction(issueKeyArray[i], "Close Issue", issueSumArray[i]); } } } catch (Exception ex) { throw ex; } finally { ResetIssueXML(); } } public static void DeserializeXml() { IssueXML issuexml = new IssueXML(); string filePath = Assembly.GetCallingAssembly().Location; string sStartupPath = System.IO.Path.GetDirectoryName(filePath); TextReader r = new StreamReader(sStartupPath + @"\issueXml.xml"); XmlSerializer s = new XmlSerializer(typeof(IssueXML)); issuexml = (IssueXML)s.Deserialize(r); _issueKey = issuexml.IssueKey; _issueSummary = issuexml.Summary; _issueIsClosed = issuexml.IsClosed; r.Close(); } public static void ResetIssueXML() { IssueXML issuexml = new IssueXML(); issuexml.IsClosed = string.Empty; issuexml.IssueKey = string.Empty; issuexml.Summary = string.Empty; // Serialization for empty XML File string filePath = Assembly.GetCallingAssembly().Location; string sStartupPath = System.IO.Path.GetDirectoryName(filePath); XmlSerializer s = new XmlSerializer(typeof(IssueXML)); TextWriter w = new StreamWriter(sStartupPath + @"\issueXml.xml"); s.Serialize(w, issuexml); w.Close(); } } }
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)