Пример #1
0
        public PackageBase[] GetPackages()
        {
            string ToOrderedString(IEnumerable <string> a) => string.Join(",", a.OrderBy(c => c).ToArray());

            return((from rule in Rules
                    from build in JiraService.GetBuilds(rule.ProjectCode)
                    where rule.IsMatch(build)
                    group new { build, rule } by new
            {
                To = ToOrderedString(rule.HowToNotify !.MetaAddressers),
                Cc = ToOrderedString(rule.HowToNotify.MetaCarbonCopy),
                rule.HowToNotify.Subject
            }
                    into ag
                    select new Package <BenderSendsLetter, Build>
            {
                Items = ag.Select(a => a.build).ToArray(),
                Reaction = new BenderSendsLetter
                {
                    Addressees = new Addressees
                    {
                        To = ag.Key.To.Split(','),
                        Cc = ag.Key.Cc.Split(',')
                    },
                    Subject = ag.Key.Subject,
                    Recommendations = ag.First().rule.HowToNotify !.Recommendations
                }
            })
Пример #2
0
        public void ProcessRequest(HttpContext context)
        {
            var action = (context.Request["action"] ?? "").ToLower();

            if (action == "")
            {
                return;
            }

            var issueKey = context.Request["issue"];
            var issue    = JiraService.GetIssue(issueKey);
            var project  = issue.Fields.Project.Key;
            var version  = issue.Fields.Version;

            switch (action)
            {
            case "reject":
                ReleaseService.Reject(project, version, false);
                break;

            case "purge":
                ReleaseService.Reject(project, version, true);
                break;

            case "publish":
                var feedKey = context.Request["to"];
                if (string.IsNullOrWhiteSpace(feedKey))
                {
                    throw new ArgumentNullException("to");
                }
                ReleaseService.Publish(project, version, feedKey);
                break;
            }
        }
Пример #3
0
        public void TestBetween()
        {
            // Arrange
            var jiraService = new JiraService(new JiraLoader(_jiraConfig), new DashService(_jiraConfig), new LoggerMock());

            // Act
            var result = jiraService.GetJiraInfo(DateTimeOffset.Now.AddDays(-30), DateTimeOffset.Now);

            var settings = new ConnectionSettings(new Uri("http://127.0.0.1:9200")).DefaultIndex("jira");
            var client   = new ElasticClient(settings);

            client.DeleteByQuery <object>(del => del
                                          .Query(q => q.QueryString(qs => qs.Query("*"))));

            //var client = new ElasticClient();
            var r = client.Ping();

            foreach (var a in result)
            {
                var indexResponse = client.IndexDocument(a);
                if (!indexResponse.IsValid)
                {
                    // If the request isn't valid, we can take action here
                }
            }


            // Assert
            Assert.IsTrue(result.Count > 0);
        }
Пример #4
0
        static void Main(string[] args)
        {
            List <string> sources = new List <string>()
            {
                "DEMO-1", "DEMO-2", "DEMO-3"
            };
            string      user        = ConfigurationManager.AppSettings[Constants.USER_KEY];
            string      passwd      = ConfigurationManager.AppSettings[Constants.PASS_KEY];
            string      baseUrl     = ConfigurationManager.AppSettings[Constants.BASEURL_KEY];
            JiraService jiraService = new JiraService(baseUrl);

            foreach (string current in sources)
            {
                Issue issue = jiraService.GetJiraIssueByIdOrKey(current);
                PrintIssue(issue);
            }

            var issues = jiraService.GetIssuesBySprint("35mm Capture - 2.7.1");

            foreach (var issue in issues)
            {
                PrintIssue(issue);
            }

            Console.Read();
        }
Пример #5
0
        protected void InitTasks()
        {
            var iRPCSDbAccessor       = (IRPCSDbAccessor) new RPCSSingletonDbAccessor(_rpcsContextOptions);
            var rPCSRepositoryFactory = (IRepositoryFactory) new RPCSRepositoryFactory(iRPCSDbAccessor);

            var userService = (IUserService) new UserService(rPCSRepositoryFactory, _httpContextAccessor);
            var tsAutoHoursRecordService  = (ITSAutoHoursRecordService) new TSAutoHoursRecordService(rPCSRepositoryFactory, userService);
            var vacationRecordService     = (IVacationRecordService) new VacationRecordService(rPCSRepositoryFactory, userService);
            var reportingPeriodService    = (IReportingPeriodService) new ReportingPeriodService(rPCSRepositoryFactory);
            var productionCalendarService = (IProductionCalendarService) new ProductionCalendarService(rPCSRepositoryFactory);
            var tsHoursRecordService      = (ITSHoursRecordService) new TSHoursRecordService(rPCSRepositoryFactory, userService, _tsHoursRecordServiceLogger);
            var projectService            = (IProjectService) new ProjectService(rPCSRepositoryFactory, userService);
            var departmemtService         = new DepartmentService(rPCSRepositoryFactory, userService);
            var employeeService           = (IEmployeeService) new EmployeeService(rPCSRepositoryFactory, departmemtService, userService);
            var projectMembershipService  = (IProjectMembershipService) new ProjectMembershipService(rPCSRepositoryFactory);
            var projectReportRecords      = new ProjectReportRecordService(rPCSRepositoryFactory);
            var employeeCategoryService   = new EmployeeCategoryService(rPCSRepositoryFactory);
            var applicationUserService    = new ApplicationUserService(rPCSRepositoryFactory, employeeService, userService, departmemtService,
                                                                       _httpContextAccessor, _memoryCache, projectService, _onlyofficeOptions);
            var appPropertyService = new AppPropertyService(rPCSRepositoryFactory, _adOptions, _bitrixOptions, _onlyofficeOptions, _timesheetOptions);
            var financeService     = new FinanceService(rPCSRepositoryFactory, iRPCSDbAccessor, applicationUserService, appPropertyService, _ooService);
            var timesheetService   = new TimesheetService(employeeService, employeeCategoryService, tsAutoHoursRecordService,
                                                          tsHoursRecordService, projectService, projectReportRecords, vacationRecordService, productionCalendarService, financeService, _timesheetOptions);
            var projectExternalWorkspaceService = new ProjectExternalWorkspaceService(rPCSRepositoryFactory);
            var jiraService = new JiraService(userService, _jiraOptions, projectExternalWorkspaceService, projectService);

            _taskTimesheetProcessing = new TimesheetProcessingTask(tsAutoHoursRecordService, vacationRecordService, reportingPeriodService,
                                                                   productionCalendarService, tsHoursRecordService, userService, projectService, employeeService, projectMembershipService,
                                                                   timesheetService, _timesheetOptions, _smtpOptions, _jiraOptions, jiraService, projectExternalWorkspaceService);
        }
 public void SetUp()
 {
     _baseUri     = new Uri("http://localhost:9919");
     _http        = HttpMockRepository.At(_baseUri);
     _jiraService = new JiraService();
     _serializer  = new JavaScriptSerializer();
 }
Пример #7
0
        public HttpResponseMessage GetIssuesBySprint(string sprint)
        {
            JiraService         service  = new JiraService(this._serverUrl);
            IEnumerable <Issue> issues   = service.GetIssuesBySprint(sprint);
            HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK, issues, "application/json");

            return(response);
        }
Пример #8
0
        public HttpResponseMessage GetIssueByKey(string id)
        {
            JiraService         service  = new JiraService(this._serverUrl);
            Issue               issue    = service.GetJiraIssueByIdOrKey(id);
            HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK, issue, "application/json");

            return(response);
        }
        public void JiraService_GetIssuesResolvedSinceDate_Returns_MultipleResults()
        {
            var service = new JiraService(new JiraSettings());

            var issues = service.GetIssuesResolvedSinceDate(DateTime.Now.AddMonths(12));

            Assert.Greater(issues.Count, 0);
        }
Пример #10
0
        public HttpResponseMessage GetProjectById(int id)
        {
            string              serverUrl = "http://jira.atlassian.com/rest/api/2";
            JiraService         service   = new JiraService(serverUrl);
            Project             project   = service.GetProjectById(id);
            HttpResponseMessage response  = Request.CreateResponse(HttpStatusCode.OK, project, "application/json");

            return(response);
        }
Пример #11
0
        /// <summary>
        /// App entry point.
        /// </summary>
        /// <param name="args">Input parameters.</param>
        static async Task Main(string[] args)
        {
            // Create command.
            var app = new CommandLineApplication();

            // Add a command-line options for command.
            var optionDate     = app.Option("-d|--date=<DATE>", "Date", CommandOptionType.SingleOrNoValue);
            var optionUsername = app.Option("-u|--username=<EMAIL>", "Email", CommandOptionType.SingleValue);
            var optionPassword = app.Option("-p|--password=<PASSWORD>", "Password", CommandOptionType.SingleValue);

            DateTime date     = DateTime.Now;
            string   username = string.Empty;
            string   password = string.Empty;

            // Invoke command.
            app.OnExecute(() =>
            {
                if (optionDate.HasValue())
                {
                    try
                    {
                        date = DateTime.Parse(optionDate.Value());
                    }
                    catch (FormatException)
                    {
                        Console.WriteLine("Invalid date.");
                    }
                }
                else
                {
                    date = DateTime.Today;
                }

                username = optionUsername.HasValue()
                            ? optionUsername.Value()
                            : app.GetHelpText();

                password = optionPassword.HasValue()
                            ? optionPassword.Value()
                            : app.GetHelpText();
            });

            app.Execute(args);

            JiraService  jiraService = new JiraService(username, password);
            JiraReporter reporter    = new JiraReporter(jiraService);

            string report = await reporter.GetDailyReportAsync(username, date);

            Console.WriteLine(report);

            // Delay.
            Console.ReadKey();
        }
        public async Task <ContentResult> DialogActionAsync()
        {
            // Parse the body of the request using the Protobuf JSON parser,
            // *not* Json.NET.
            string textToReturn = "";
            string requestJson;

            using (TextReader reader = new StreamReader(Request.Body))
            {
                requestJson = await reader.ReadToEndAsync();
            }

            WebhookRequest request;

            request = jsonParser.Parse <WebhookRequest>(requestJson);


            // Add a comment
            if (request.QueryResult.Action == "addIssueComment")
            {
                textToReturn = await JiraService.AddComment(request);
            }

            // Change issue status
            else if (request.QueryResult.Action == "changeIssueStatus")
            {
                textToReturn = await JiraService.ChangeStatusOfIssue(request);
            }
            // Get issue details
            else if (request.QueryResult.Action == "getIssueDetails")
            {
                textToReturn = await JiraService.GetIssueDetails(request);
            }

            // Get all the issues asssigned to the user
            else if (request.QueryResult.Action == "getAllAssignedIssues")
            {
                textToReturn = JiraHelper.CreateAssignedIssueTable(await JiraAPIContext.GetAssignedIssues());
            }


            else
            {
                textToReturn = "Your action could not be resolved!";
            }

            string responseJson = DialogService.populateResponse(textToReturn);
            var    content      = Content(responseJson, "application/json");

            return(content);
        }
        public InspectionReporter(InspectionOptions options, string file)
        {
            _currentFilePath      = file;
            _webhook              = options.Webhook;
            _buildId              = options.BuildId;
            _output               = options.Output;
            _threshold            = options.Threshold;
            _teamcityService      = new TeamCityServiceClient(options.TeamCityUrl, options.TeamCityToken);
            _gitPath              = options.Git;
            _relativeSolutionPath = options.Solution;
            _mailNotifier         = new SoftwareQualityMailNotifier(options.Login, options.Password);

            _jira = new JiraService(options.JiraLogin, options.JiraPassword);
        }
Пример #14
0
        //        public async System.Threading.Tasks.Tasks<ActionResult> IndexAsync(int project)
        public ActionResult Index(int Projects)
        {
            Session["CurrentProId"] = Projects;
            var Outcomes = Outcomeservice.Get(Projects);
            //Taskservice.Save(listTasks);
            var jira = JiraService.GetJira(Projects);

            ViewBag.Jira     = jira;
            ViewBag.Projects = Projectservice.Get(Projects);

            ViewBag.OutcomesUntilNow = Outcomes.Sum(i => i.Cost);
            ViewBag.OuotcomeDiff     = ViewBag.Projects.TaskTotalCost - Outcomes.Sum(i => i.Cost);
            var percentage = (ViewBag.OuotcomeDiff / ViewBag.Projects.TaskTotalCost) * 100;

            percentage           = Math.Floor(percentage);
            ViewBag.Percenses    = percentage;
            ViewBag.ProjectsName = Projectservice.GetnameProjects(Projects);

            ViewBag.Status   = ToDoListStatusesService.Get();
            ViewBag.Projects = Projectservice.Get();
            //var closestRisks = Riskservice.(Projects);
            //ViewBag.Days = Enumerable.Range(0, 1 + (closestRisks.Date - DateTime.Now).Days)
//.Select(offset => (DateTime.Now).AddDays(offset)).Count();
            var percentageSprint = jira.ClosedIssuesInActiveSprint / ViewBag.Jira.AllIssuesInActiveSprint * 100;

            if (percentageSprint > 0)
            {
                ViewBag.PercentageSprint = percentageSprint;
            }
            else
            {
                ViewBag.PercentageSprint = 0;
            }
            var percentageCloseSprint = jira.ClosestSprint * 100 / jira.CountSprint;

            if (percentageCloseSprint > 0)
            {
                ViewBag.PercentageCloseSprint = percentageCloseSprint;
            }
            else
            {
                ViewBag.PercentageCloseSprint = 0;
            }
            //ViewBag.ClosestRisks = closestRisks;
            ViewBag.ProjectId      = Projects;
            ViewBag.CurrentProject = Projectservice.Get(Projects);
            Session["isManneger"]  = Userservice.IsProjectManager(Projects, ((UsersViewModel)Session["CurrentUsers"]).Id);
            return(View());
        }
Пример #15
0
        protected override Issue[] GetIssues(IssueInclusionToStructRule rule)
        {
            var enumerator = (from s in rule.Structures
                              from id in JiraService.GetIssuesInStructure(s)
                              group id by id into g
                              where g.Count() > 1
                              select JiraService.GetIssueById(g.Key))
            ;

            if (MaxIssueCount > 0)
            {
                enumerator = enumerator.Take(MaxIssueCount);
            }

            return(enumerator.ToArray());
        }
Пример #16
0
        public static async Task Run()
        {
            Console.WriteLine("Getting projects...");

            var service = new JiraService("server", "username", "password");

            var projects = await service.GetProjectsAsync();

            foreach (var project in projects)
            {
                Console.WriteLine($"Id: {project.Id}  Name: {project.Name}  Key: {project.Key}");
            }


            Console.ReadKey();
        }
Пример #17
0
        protected override Issue[] GetIssues(JqlRule rule)
        {
            try
            {
                return(JiraService.GetIssuesForJql(rule.Jql));
            }
            catch (Exception e)
            {
                if (!(e is InvalidOperationException) && !(e is RuntimeBinderException))
                {
                    throw;
                }

                _logger.Error(e, "Failed to get issues from Jira Service for Jql Rule: {@rule}", rule);
                return(new Issue[] { });
            }
        }
Пример #18
0
        private async Task GetTasksAsync()
        {
            Tasks = new List <JiraTask>();

            var keys = Keys.Split(' ').Select(x => x.Trim()).Where(x => !string.IsNullOrWhiteSpace(x)).ToList();

            foreach (var key in keys)
            {
                var task = await JiraService.GetTaskAsync(key);

                if (task != null)
                {
                    Tasks.Add(task);
                }

                await TasksChanged.InvokeAsync(Tasks);
            }
        }
Пример #19
0
        public Task Execute(IJobExecutionContext context)
        {
            try
            {
                var iRPCSDbAccessor       = (IRPCSDbAccessor) new RPCSSingletonDbAccessor(_dbOptions);
                var rPCSRepositoryFactory = (IRepositoryFactory) new RPCSRepositoryFactory(iRPCSDbAccessor);

                var userService = (IUserService) new UserService(rPCSRepositoryFactory, _httpContextAccessor);
                var tsAutoHoursRecordService  = (ITSAutoHoursRecordService) new TSAutoHoursRecordService(rPCSRepositoryFactory, userService);
                var vacationRecordService     = (IVacationRecordService) new VacationRecordService(rPCSRepositoryFactory, userService);
                var reportingPeriodService    = (IReportingPeriodService) new ReportingPeriodService(rPCSRepositoryFactory);
                var productionCalendarService = (IProductionCalendarService) new ProductionCalendarService(rPCSRepositoryFactory);
                var tsHoursRecordService      = (ITSHoursRecordService) new TSHoursRecordService(rPCSRepositoryFactory, userService, _tsHoursRecordServiceLogger);
                var projectService            = (IProjectService) new ProjectService(rPCSRepositoryFactory, userService);
                var departmentService         = new DepartmentService(rPCSRepositoryFactory, userService);
                var employeeService           = (IEmployeeService) new EmployeeService(rPCSRepositoryFactory, departmentService, userService);
                var projectMembershipService  = (IProjectMembershipService) new ProjectMembershipService(rPCSRepositoryFactory);
                var employeeCategoryService   = new EmployeeCategoryService(rPCSRepositoryFactory);
                var projectReportRecords      = new ProjectReportRecordService(rPCSRepositoryFactory);
                var applicationUserService    = new ApplicationUserService(rPCSRepositoryFactory, employeeService, userService,
                                                                           departmentService, _httpContextAccessor, _memoryCache, projectService, _onlyOfficeOptions);
                var appPropertyService = new AppPropertyService(rPCSRepositoryFactory, _adConfigOptions, _bitrixConfigOptions, _onlyOfficeOptions, _timesheetConfigOptions);
                var ooService          = new OOService(applicationUserService, _onlyOfficeOptions);
                var financeService     = new FinanceService(rPCSRepositoryFactory, iRPCSDbAccessor, applicationUserService, appPropertyService, ooService);
                var timesheetService   = new TimesheetService(employeeService, employeeCategoryService, tsAutoHoursRecordService, tsHoursRecordService,
                                                              projectService, projectReportRecords, vacationRecordService, productionCalendarService, financeService, _timesheetConfigOptions);
                var projectExternalWorkspace = new ProjectExternalWorkspaceService(rPCSRepositoryFactory);
                var jiraService = new JiraService(userService, _jiraConfigOptions, projectExternalWorkspace, projectService);


                var taskTimesheetProcessing = new TimesheetProcessingTask(tsAutoHoursRecordService, vacationRecordService, reportingPeriodService, productionCalendarService,
                                                                          tsHoursRecordService, userService, projectService, employeeService, projectMembershipService, timesheetService, _timesheetConfigOptions, _smtpConfigOptions, _jiraConfigOptions, jiraService, projectExternalWorkspace);

                _timesheetJobLogger.LogInformation("Начало синхронизации с Timesheet!");
                string id = Guid.NewGuid().ToString();
                TimesheetProcessingResult timesheetProcessingResult = null;
                var fileHtmlReport = string.Empty;

                if (taskTimesheetProcessing.Add(id, true) == true)
                {
                    try
                    {
                        bool syncWithExternalTimesheet = false;
                        bool processVacationRecords    = false;
                        bool processTSAutoHoursRecords = false;
                        bool sendTSEmailNotifications  = false;
                        bool syncWithJIRA = false;
                        bool syncWithJIRASendEmailNotifications = false;


                        try
                        {
                            syncWithExternalTimesheet = _timesheetConfig.ProcessingSyncWithExternalTimesheets;
                        }
                        catch (Exception)
                        {
                        }

                        try
                        {
                            processVacationRecords = _timesheetConfig.ProcessingProcessVacationRecords;
                        }
                        catch (Exception)
                        {
                        }

                        try
                        {
                            processTSAutoHoursRecords = _timesheetConfig.ProcessingProcessTSAutoHoursRecords;
                        }
                        catch (Exception)
                        {
                        }
                        try
                        {
                            sendTSEmailNotifications = _timesheetConfig.ProcessingSendTSEmailNotifications;
                        }
                        catch (Exception)
                        {
                        }

                        try
                        {
                            syncWithJIRA = _timesheetConfig.ProcessingSyncWithJIRA;
                        }
                        catch (Exception)
                        {
                        }


                        timesheetProcessingResult = taskTimesheetProcessing.ProcessLongRunningAction("", id,
                                                                                                     syncWithExternalTimesheet, DateTime.MinValue, DateTime.MinValue, false, true, true, true, false, 350,
                                                                                                     processVacationRecords,
                                                                                                     processTSAutoHoursRecords,
                                                                                                     sendTSEmailNotifications, DateTime.Today,
                                                                                                     syncWithJIRA, DateTime.MinValue, DateTime.MinValue, false, DateTime.Today, syncWithJIRASendEmailNotifications);



                        foreach (var html in timesheetProcessingResult.fileHtmlReport)
                        {
                            fileHtmlReport += html;
                        }

                        _memoryCache.Set(timesheetProcessingResult.fileId, fileHtmlReport);
                    }
                    catch (Exception)
                    {
                    }
                    taskTimesheetProcessing.Remove(id);
                }
                if (timesheetProcessingResult != null &&
                    String.IsNullOrEmpty(fileHtmlReport) == false &&
                    !string.IsNullOrEmpty(_timesheetConfig.ProcessingReportEmailReceivers))
                {
                    byte[] binFileHtmlReport = Encoding.UTF8.GetPreamble().Concat(Encoding.UTF8.GetBytes(fileHtmlReport)).ToArray();
                    using (MemoryStream streamFileHtmlReport = new MemoryStream(binFileHtmlReport))
                    {
                        try
                        {
                            string subject  = "Отчет об обработке данных Таймшит " + DateTime.Now.ToString();
                            string bodyHtml = RPCSEmailHelper.GetSimpleHtmlEmailBody("Отчет об обработке данных Таймшит", "Отчет об обработке данных Таймшит во вложении.", null);
                            RPCSEmailHelper.SendHtmlEmailViaSMTP(_timesheetConfig.ProcessingReportEmailReceivers,
                                                                 subject,
                                                                 null,
                                                                 null,
                                                                 bodyHtml,
                                                                 null,
                                                                 null,
                                                                 streamFileHtmlReport,
                                                                 "TimesheetProcessingReport" + DateTime.Now.ToString("ddMMyyHHmmss") + ".html");
                        }
                        catch (Exception)
                        {
                        }
                    }
                }
            }
            catch (Exception e)
            {
                _timesheetJobLogger.LogError(e.Message);
                Console.WriteLine(e);
                throw;
            }
            _timesheetJobLogger.LogInformation("Синхронизация с Timesheet закончена!");
            return(Task.CompletedTask);
        }
Пример #20
0
 public void Test1()
 {
     var jiraService = new JiraService(new JiraLoader(_jiraConfig.Object), new DashService(), new LoggerMock());
     var result      = jiraService.GetJiraInfo(DateTimeOffset.Now.AddDays(-20), DateTimeOffset.Now);
 }
Пример #21
0
 public JQLController(IRepository <JQLFilterDTO, int> repository, IRepository <SystemDTO, int> repositorySystem)
 {
     _repository       = repository;
     _repositorySystem = repositorySystem;
     _jiraService      = new JiraService();
 }
Пример #22
0
 /// <summary> Информация по Jira </summary>
 public JiraController(ILogger <JiraController> logger, JiraService jiraService, JiraElasticService jiraElasticService)
 {
     _logger             = logger;
     _jiraService        = jiraService;
     _jiraElasticService = jiraElasticService;
 }
Пример #23
0
 /// <summary> Информация по Jira </summary>
 public JiraController(ILogger <JiraController> logger, IMemoryCache cache, JiraService jiraService)
 {
     _logger      = logger;
     _cache       = cache;
     _jiraService = jiraService;
 }
Пример #24
0
 /// <summary>
 /// Constructor class.
 /// </summary>
 public JiraReporter(JiraService jiraService)
 {
     this.jiraService = jiraService;
 }
Пример #25
0
	public static List<JiraIssue> getItems(String jql) 
	{
		List <JiraIssue> jiraIssues = new List<JiraIssue>();
		String finalUrl = "";
		String mes = "";

		try 
		{
			String u = JIRA_USER;
			String p = JIRA_PW;
			String jiraBaseUrl = JIRA_BASE_URL;

			finalUrl = jiraBaseUrl + search + "?"+jql;
			mes += "URL="+finalUrl;
			//getJiraIssues++;
			
			//string response = Unirest.get(finalUrl).basicAuth(u, p).asJson();
			mes += " 48";
			mes += " 60";


			HttpWebRequest request = (HttpWebRequest)WebRequest.Create(finalUrl);
			request.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
			request.Credentials = GetCredential( finalUrl );
			request.PreAuthenticate = true;

			using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
			using (Stream stream = response.GetResponseStream())
			using (StreamReader reader = new StreamReader(stream))
			{
				string jsonStatus = reader.ReadToEnd();
				//CallbackScheduleState?.Invoke(jsonStatus);

			}


			/* replace with .net json parsing */

			/*JSONObject obj = new JSONObject("" + response.getBody());
			JSONArray issues = obj.getJSONArray("issues");

			for (int i = 0; i < issues.length(); i++)
			{
				JiraIssue jiraIssue = new JiraIssue();
				jiraIssues.add(jiraIssue);
				JSONObject issueObj = issues.getJSONObject(i);
				String id = issueObj.getString("id");
				jiraIssue.setId(id);

				JSONObject fieldsObj = issueObj.getJSONObject("fields");
				String summary = fieldsObj.getString("summary");
				jiraIssue.setSummary(summary);

				String description = fieldsObj.get("description").toString();
				jiraIssue.setDescription(description);

				JSONObject assObj = fieldsObj.getJSONObject("assignee");
				String assigneeName = assObj.get("name").toString();
				jiraIssue.setAssignee(assigneeName); ;

				JSONObject creatorObj = fieldsObj.getJSONObject("creator");
				String creatorName = assObj.get("name").toString();
				jiraIssue.setCreator(creatorName);
			}    	    
    	*/
			mes += " 105 ";

			//Once we have completed the first pass, let's try to get the keys now

			for (int i = 0; i < jiraIssues.size(); i++)
			{
				JiraIssue issue = jiraIssues.get(i);
				JiraIssue issueWithKey = JiraService.getJiraIssue(issue.getId());
				String key = issueWithKey.getKey();
				issue.setKey(key);
				//URl http://compplayer.crha-health.ab.ca:8080/browse/CKCMFK-269
				String url = jiraBaseUrl + "/browse/" + issue.getKey();
				issue.setUrl(url);
			}
			mes += " 18 ";

 
		} catch (Exception e)
		{

			//e.printStackTrace();
			throw new Exception(mes);
		}



		return jiraIssues;
	}
Пример #26
0
 public JiraCommand(JiraService jiraService, WorkItemStore workItemStore)
 {
     _jiraService   = jiraService;
     _workItemStore = workItemStore;
     ConfigureCommand();
 }