/// <summary> /// Register log info as new issue on Redmine project management /// </summary> /// <param name="logInfo">Log info that must register in Redmine</param> /// <returns>Determine issue registration success or not</returns> private bool RegisterIssue(LogInfo logInfo) { try { // Get target project that issues must register on it if (this._redmineProject == null) this._redmineProject = this._redmineManager.GetObjectList<Project>(new NameValueCollection()) .FirstOrDefault(f => f.Name == this._redmineConfiguration.ProjectName); // If project not found we couldn't do anything more if (this._redmineProject == null) return false; var description = string.Format( "Source file path : {0}{1}Method name : {2}{3}Line number : {4}", logInfo.CallerInfo.SourceFilePath, Environment.NewLine, logInfo.CallerInfo.MethodName, Environment.NewLine, logInfo.CallerInfo.LineNumber); // Generate new issue using grabbed data var issue = new Issue { Project = this._redmineProject, Description = description, Subject = logInfo.Message, Uploads = new List<Upload> { // Upload serialized log info as attachment this.UploadLogInfoAsAttachment(logInfo, ".ql") }, }; // Get list of Priority from Redmine var priorityList = this._redmineManager.GetObjectList<IssuePriority>(new NameValueCollection()); // Get priority of current log usign Redmine's pirority list int? priorityId = issue.GetPriorityId(priorityList, this._redmineConfiguration.IssuePirories[logInfo.LogType]); if (priorityId != null) issue.Priority = new IdentifiableName {Id = priorityId.Value}; // Register issue on Redmine Issue registeredIssue = this._redmineManager.CreateObject(issue, this._redmineManager.ImpersonateUser); return (registeredIssue != null); } catch (Exception ex) { return false; } }