Esempio n. 1
0
        public void CreateJiraTasks()
        {
            var queries = JiraRepository.GetAllQueries();

            if (queries != null)
            {
                foreach (var query in queries)
                {
                    if (TaskRepository.IsPlanned(query.Id))
                    {
                        continue;
                    }

                    var latestRun = TaskRepository.GetLatestRunByReference(query.Id)?.ProcessedTime.Value ?? DateTime.Now;

                    if (FrequencyHelper.IsTimeToPlan(query.Frequency, latestRun, out DateTime plannedRunTime))
                    {
                        TaskRepository.CreateTask(new Task
                        {
                            Type        = TaskType.JIRA,
                            Status      = TaskStatus.PLANNED,
                            PlannedTime = plannedRunTime,
                            Reference   = query.Id
                        });
                    }
                }
            }
        }
Esempio n. 2
0
        public void SearchJira()
        {
            var jiraTask = TaskRepository.GetJiraPlanned();

            if (jiraTask == null)
            {
                Logger.WriteInfo($"No JIRA tasks planned for the run at: { DateTime.Now.ToString(Constants.DateTimeFormat) }");

                return;
            }

            var jiraQuery = JiraRepository.GetQueryById(jiraTask.Reference);

            if (jiraQuery == null)
            {
                Logger.WriteError($"No JIRA query found with id: { jiraTask.Reference }");

                return;
            }

            var success = new Action <string>((response) =>
            {
                TaskRepository.CreateTask(new Task
                {
                    PlannedTime = DateTime.Now.AddMinutes(5),
                    Type        = TaskType.MATTERMOST,
                    Status      = TaskStatus.PLANNED,
                    Reference   = jiraQuery.Id
                });

                TaskRepository.UpdateStatus(jiraQuery.Id, TaskStatus.COMPLETED);
            });

            var fail = new Action <string>((message) =>
            {
                TaskRepository.UpdateStatus(jiraQuery.Id, TaskStatus.FAILED);

                Logger.WriteError(message);
            });

            var request = new JiraRequestManager();

            request.Search(new JiraConfiguration
            {
                BaseAddress = "https://jira.devfactory.com",
                Username    = "******",
                Password    = "******",
                ApiPath     = "/rest/api/2/search",
                Query       = "fields=key&jql=assignee=mbigun&maxResults=10"
            },
                           success, fail).ConfigureAwait(false);
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            JiraRepository jr = new JiraRepository();

            jr.CreateTask(new List <TareaDTO>()
            {
                new TareaDTO()
            }
                          );



            //// TSL SECTION

            ////JsonService js = new JsonService();
            ////MassiveTasksService ms = new MassiveTasksService(new MassiveTaskRepository(new ExcelIOService()), new JsonService(), new JiraRepository());
            //MassiveTasksQueryResultsService mtqr = new MassiveTasksQueryResultsService();

            ////mtqr.GenerateDataBaseResult();
            ////mtqr.GenerateTlsResult();
            //mtqr.GenerateAppFabricPoolResult();



            //var dataBaseResult = (List<TaskModelData>)ms.GetDataBaseListDTO(); ;


            //var updatePoolResult = (List<TaskModelData>)ms.GetUpdatePoolListDTO();
            //var appfabricResult = (List<TaskModelData>)ms.GetAppfabricTasklingListDTO();
            //var updateTaskLingResult = (List<TaskModelData>)ms.GetUpdateTasklingListDTO();
            //var tlsResult = (List<TaskModelData>)ms.GetTlsListDTO();
            //var installTaskLingResult = (List<TaskModelData>)ms.GetInstallTasklingListDTO();

            //mtqr.AddFoundTeamList(dataBaseResult);
            //mtqr.AddFoundTeamList(updatePoolResult);
            //mtqr.AddFoundTeamList(appfabricResult);
            //mtqr.AddFoundTeamList(updateTaskLingResult);
            //mtqr.AddFoundTeamList(tlsResult);
            //mtqr.AddFoundTeamList(installTaskLingResult);


            //var res = mtqr.GetAllTeams();
        }