Пример #1
0
        private void addButton_Click(object sender, RoutedEventArgs e)
        {
            JiraTask jiraTask = new JiraTask();

            jiraTask.ID   = idTextBox.Text;
            jiraTask.Name = nameTextBox.Text;
            jiraTask.Note = noteTextBox.Text;
            App.DataModel.AddJiraTask(jiraTask);
            Frame.Navigate(typeof(MainPage));
        }
Пример #2
0
        public static async Task <IActionResult> RunAsync([HttpTrigger(AuthorizationLevel.Anonymous, "get", "options")] HttpRequest req, ILogger log)
        {
            log.LogInformation("C# HTTP trigger function processed a request.");

            var queryValues = req.GetQueryParameterDictionary();
            var key         = queryValues["key"];
            var site        = queryValues["site"];
            var email       = queryValues["email"];
            var token       = queryValues["token"];

            var headerValue        = $"{email}:{token}";
            var headerValueEncoded = Convert.ToBase64String(Encoding.ASCII.GetBytes(headerValue));

            _httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", headerValueEncoded);

            var response = await _httpClient.GetAsync($"{site}/rest/api/2/issue/{key}");

            // Reset the auth header so we don't accidentally store the credentials. This is needed
            // as the HttpClient instance is static and reused between requests.
            _httpClient.DefaultRequestHeaders.Authorization = null;

            if (response == null || !response.IsSuccessStatusCode)
            {
                return(null);
            }

            var issue = await response.Content.ReadAsAsync <dynamic>();

            try
            {
                var task = new JiraTask();

                task.Key     = issue.key;
                task.Project = issue.fields.project.name;
                task.Summary = issue.fields.summary;

                if (issue.fields.timetracking?.originalEstimateSeconds != null)
                {
                    task.OriginalEstimate = (decimal)issue.fields.timetracking.originalEstimateSeconds / 60 / 60;
                }

                if (issue.fields.timetracking?.remainingEstimateSeconds != null)
                {
                    task.HoursRemaining = (decimal)issue.fields.timetracking.remainingEstimateSeconds / 60 / 60;
                }

                if (issue.fields.timetracking?.timeSpentSeconds != null)
                {
                    task.HoursComplete = (decimal)issue.fields.timetracking.timeSpentSeconds / 60 / 60;
                }

                return(new OkObjectResult(task));
            }
            catch { return(null); }
        }
        /// <summary>
        /// The methods provided in this section are simply used to allow
        /// NavigationHelper to respond to the page's navigation methods.
        /// <para>
        /// Page specific logic should be placed in event handlers for the
        /// <see cref="NavigationHelper.LoadState"/>
        /// and <see cref="NavigationHelper.SaveState"/>.
        /// The navigation parameter is available in the LoadState method
        /// in addition to page state preserved during an earlier session.
        /// </para>
        /// </summary>
        /// <param name="e">Provides data for navigation methods and event
        /// handlers that cannot cancel the navigation request.</param>
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            this.navigationHelper.OnNavigatedTo(e);

            jiraTask = (JiraTask)e.Parameter;
            this.defaultViewModel["Task"] = jiraTask;

            taskNameHeadTextBox.Text = jiraTask.Name;
            idTextBox.Text           = jiraTask.ID;
            nameTextBox.Text         = jiraTask.Name;
            noteTextBox.Text         = jiraTask.Note;
        }
Пример #4
0
    public void GenerateJiraTask()
    {
        JiraTask newTask = Instantiate(Prefabs.JiraTaskPrefab).GetComponent <JiraTask>();

        float priorityRandom = Random.value;
        float typeRandom     = Random.value;
        float assigneeRandom = Random.value;

        newTask.Init(priorityRandom < 0.3f ? JiraTask.Priority.Critical : priorityRandom < 0.7f ? JiraTask.Priority.Major : JiraTask.Priority.Minor,
                     typeRandom < 0.3f ? JiraTask.Type.Amele : typeRandom < 0.7f ? JiraTask.Type.Bug : JiraTask.Type.Feature,
                     assigneeRandom < 0.4f ? JiraTask.Assignee.Atil : assigneeRandom < 0.8f ? JiraTask.Assignee.Enes : JiraTask.Assignee.None);

        newTask.transform.SetParent(TodoBoardParent);
    }
Пример #5
0
    public void OnPlayerSelectedTask(JiraTask task, Player player)
    {
        task.transform.SetParent(player.currentTaskParent);
        if (task == Atil.highlightedTask)
        {
            Atil.highlightedTask = null;
        }
        if (task == Enes.highlightedTask)
        {
            Enes.highlightedTask = null;
        }

        task.atilSelection.SetActive(false);
        task.enesSelection.SetActive(false);
    }
Пример #6
0
    void UpdateReviewTimer()
    {
        if (ReviewBoardParent.childCount > 0)
        {
            currentReviewTime += Time.deltaTime;
        }
        if (currentReviewTime > reviewCooldown && ReviewBoardParent.childCount > 0)
        {
            currentReviewTime = 0;

            JiraTask taskToReview = ReviewBoardParent.GetChild(0).GetComponent <JiraTask>();
            if (taskToReview.solution == taskToReview.playerSubmission)
            {
                taskToReview.transform.SetParent(null);
                Destroy(taskToReview.gameObject);
            }
            else
            {
                taskToReview.state = JiraTask.State.Open;
                taskToReview.transform.SetParent(TodoBoardParent);
            }
        }
    }
Пример #7
0
 public static TaskComplexity Complexity(this JiraTask self) =>
 new TaskComplexity(self.DevJob.Amount, self.DevJob.Amount);
Пример #8
0
 protected override JobStatus WorkOn(JiraTask task) =>
 task.QAJob.Perform();
Пример #9
0
    void HandleInput()
    {
        if (selectedTask != null)
        {
            if (Input.GetKeyDown(UpKey))
            {
                currentSequence += "U";
                GameObject newSequenceObject = Instantiate(Prefabs.UpArrow);
                newSequenceObject.transform.SetParent(sequenceParent);
            }
            if (Input.GetKeyDown(DownKey))
            {
                currentSequence += "D";
                GameObject newSequenceObject = Instantiate(Prefabs.DownArrow);
                newSequenceObject.transform.SetParent(sequenceParent);
            }
            if (Input.GetKeyDown(LeftKey))
            {
                currentSequence += "L";
                GameObject newSequenceObject = Instantiate(Prefabs.LeftArrow);
                newSequenceObject.transform.SetParent(sequenceParent);
            }
            if (Input.GetKeyDown(RightKey))
            {
                currentSequence += "R";
                GameObject newSequenceObject = Instantiate(Prefabs.RightArrow);
                newSequenceObject.transform.SetParent(sequenceParent);
            }
            if (Input.GetKeyDown(SubmitKey))
            {
                foreach (Transform t in sequenceParent)
                {
                    Destroy(t.gameObject);
                }
                foreach (Transform t in currentTaskSequence)
                {
                    Destroy(t.gameObject);
                }
                gameManager.OnPlayerSubmittedTask(selectedTask, this, currentSequence);
                selectedTask    = null;
                currentSequence = "";
            }
        }
        else
        {
            if (highlightedTask == null && gameManager.TodoBoardParent.childCount == 0)
            {
                return;
            }

            if (highlightedTask == null)
            {
                highlightedTask = gameManager.TodoBoardParent.GetChild(0).GetComponent <JiraTask>();
            }

            if (Input.GetKeyDown(DownKey))
            {
                int currentIndex = highlightedTask.transform.GetSiblingIndex();
                if (currentIndex < gameManager.TodoBoardParent.childCount - 1)
                {
                    highlightedTask = gameManager.TodoBoardParent.GetChild(currentIndex + 1).GetComponent <JiraTask>();
                }
            }
            if (Input.GetKeyDown(UpKey))
            {
                int currentIndex = highlightedTask.transform.GetSiblingIndex();
                if (currentIndex > 0)
                {
                    highlightedTask = gameManager.TodoBoardParent.GetChild(currentIndex - 1).GetComponent <JiraTask>();
                }
            }

            if (Input.GetKeyDown(SubmitKey))
            {
                selectedTask    = highlightedTask;
                highlightedTask = null;
                gameManager.OnPlayerSelectedTask(selectedTask, this);

                foreach (char ch in selectedTask.solution)
                {
                    GameObject newSequenceObject;
                    if (ch == 'U')
                    {
                        newSequenceObject = Instantiate(Prefabs.UpArrow);
                    }
                    else if (ch == 'D')
                    {
                        newSequenceObject = Instantiate(Prefabs.DownArrow);
                    }
                    else if (ch == 'L')
                    {
                        newSequenceObject = Instantiate(Prefabs.LeftArrow);
                    }
                    else
                    {
                        newSequenceObject = Instantiate(Prefabs.RightArrow);
                    }
                    newSequenceObject.transform.SetParent(currentTaskSequence);
                }
            }
        }
    }
Пример #10
0
 protected abstract JobStatus WorkOn(JiraTask task);
Пример #11
0
 public void Assign(JiraTask task)
 {
     Task          = task.Name;
     task.Assignee = Id;
 }
Пример #12
0
 public void OnPlayerSubmittedTask(JiraTask task, Player player, string playerSolution)
 {
     task.OnPlayerSubmitted(playerSolution);
     task.transform.SetParent(ReviewBoardParent.transform);
 }
Пример #13
0
        private async void btnListWorkLogList_Click(object sender, EventArgs e)
        {
            this.btnListWorkLogList.Enabled = false;

            DateTime from = this.dtpFrom.Value;
            DateTime to   = this.dtpTo.Value;

            from = DateTime.Today.AddDays(-1);
            to   = DateTime.Today.AddDays(1);

            var GetUpdatedIssueListByAssignee = JiraProxy.GetUpdatedIssueListByTimeslot(from, to);
            var issueList = await GetUpdatedIssueListByAssignee;

            if (issueList == null || issueList.Count == 0)
            {
                return;
            }

            Dictionary <string, JiraTask> workLogsStore = new Dictionary <string, JiraTask>();

            foreach (var issue in issueList)
            {
                if (issue == null)
                {
                    continue;
                }

                string taskKey        = issue.fields.parent.key;
                string taskSummary    = issue.fields.parent.fields.summary;
                string taskType       = issue.fields.parent.fields.issuetype.name;
                string subTaskkey     = issue.key;
                string subTaskSummary = issue.fields.summary;

                var workLogs = await JiraProxy.GetWorklogs(issue);

                if (workLogs != null && workLogs.Count > 0)
                {
                    foreach (var worklog in workLogs)
                    {
                        if (worklog.created.Year == DateTime.Today.Year &&
                            worklog.created.Month == DateTime.Today.Month &&
                            worklog.created.Day == DateTime.Today.Day)
                        {
                            if (!workLogsStore.ContainsKey(taskKey))
                            {
                                JiraTask jiraTask = new JiraTask();
                                jiraTask.Key      = taskKey;
                                jiraTask.summary  = taskSummary;
                                jiraTask.Type     = taskType;
                                jiraTask.subTasks = new Dictionary <string, SubTask>();
                                workLogsStore.Add(taskKey, jiraTask);
                            }

                            JiraTask jiraTask1 = workLogsStore[taskKey];
                            if (!jiraTask1.subTasks.ContainsKey(subTaskkey))
                            {
                                SubTask subTask = new SubTask();
                                subTask.Key     = subTaskkey;
                                subTask.summary = subTaskSummary;
                                jiraTask1.subTasks.Add(subTaskkey, subTask);
                            }

                            SubTask subTask1 = jiraTask1.subTasks[subTaskkey];
                            if (subTask1.worklogs == null)
                            {
                                subTask1.worklogs = new List <Worklog>();
                            }

                            Worklog workLog = new Worklog();
                            workLog.displayName = worklog.author.displayName;
                            workLog.timeSpent   = worklog.timeSpent;
                            workLog.comment     = worklog.comment.Replace("\r\n", ";");
                            subTask1.worklogs.Add(workLog);

                            jiraTask1.subTasks[subTaskkey] = subTask1;
                            workLogsStore[taskKey]         = jiraTask1;
                        }
                    }
                }
            }

            /*
             * string dailyWorkLogSummaryReport = "";
             * int index1 = 1;
             * foreach (string taskKey in workLogsStore.Keys)
             * {
             *  JiraTask jiraTask = workLogsStore[taskKey];
             *
             *  dailyWorkLogSummaryReport += index1 + " " + jiraTask.Type + " - " + taskKey + " " + jiraTask.summary + "<br/>";
             *
             *  int index2 = 1;
             *  foreach (string subTaskkey in jiraTask.subTasks.Keys)
             *  {
             *      SubTask subTask = jiraTask.subTasks[subTaskkey];
             *
             *      dailyWorkLogSummaryReport += index1 + "." + index2 + " Sub Task: " + subTaskkey + " " + subTask.summary + "<br/>";
             *
             *      int index3 = 1;
             *      foreach (var workLog in subTask.worklogs)
             *      {
             *          dailyWorkLogSummaryReport += index1 + "." + index2 + "." + index3 + " " + workLog.displayName + "[" + workLog.timeSpent + "]" + workLog.comment + "<br/>";
             *
             *          index3++;
             *      }
             *
             *      index2++;
             *  }
             *
             *  dailyWorkLogSummaryReport += "<br/><br/>";
             *  index1++;
             * }
             */

            string dailyWorkLogSummaryReport = "";
            Dictionary <string, List <IndividualWorkLog> > IndividualWorkLogs = new Dictionary <string, List <IndividualWorkLog> >();

            foreach (string taskKey in workLogsStore.Keys)
            {
                JiraTask jiraTask = workLogsStore[taskKey];
                foreach (string subTaskkey in jiraTask.subTasks.Keys)
                {
                    SubTask subTask = jiraTask.subTasks[subTaskkey];
                    foreach (var workLog in subTask.worklogs)
                    {
                        IndividualWorkLog individualWorkLog = new IndividualWorkLog();
                        individualWorkLog.jiraKey        = taskKey;
                        individualWorkLog.summary        = jiraTask.summary;
                        individualWorkLog.subTaskSummary = subTask.summary;
                        individualWorkLog.timeSpent      = workLog.timeSpent;
                        individualWorkLog.comment        = workLog.comment;

                        if (!IndividualWorkLogs.ContainsKey(workLog.displayName))
                        {
                            IndividualWorkLogs.Add(workLog.displayName, new List <IndividualWorkLog>());
                        }
                        List <IndividualWorkLog> workLogs = IndividualWorkLogs[workLog.displayName];
                        workLogs.Add(individualWorkLog);
                        IndividualWorkLogs[workLog.displayName] = workLogs;
                    }
                }
            }

            dailyWorkLogSummaryReport = @"<table cellspacing='1' cellpadding='1' border='0' bgcolor='111111' style='border-collapse:collapse;border-spacing:0;border-left:1px solid #888;border-top:1px solid #888;background:#efefef;'>
                                            <tr>
                                                <td align='center' style='border-right:1px solid #888;border-bottom:1px solid #888;padding:1px 10px;'>No</td>
                                                <td align='center' style='border-right:1px solid #888;border-bottom:1px solid #888;padding:1px 10px;'>Name</td>
                                                <td align='center' style='border-right:1px solid #888;border-bottom:1px solid #888;padding:1px 10px;'>Work Logs</td>                                               
                                            </tr>";

            int i = 1;

            foreach (string name in IndividualWorkLogs.Keys)
            {
                dailyWorkLogSummaryReport += "  <tr>";
                dailyWorkLogSummaryReport += "      <td align='center' style='border-right:1px solid #888;border-bottom:1px solid #888;padding:1px 10px;'>" + i + "</td>";
                dailyWorkLogSummaryReport += "      <td align='center' style='border-right:1px solid #888;border-bottom:1px solid #888;padding:1px 10px;'>" + name + "</td>";
                dailyWorkLogSummaryReport += "      <td align='left' style='border-right:1px solid #888;border-bottom:1px solid #888;padding:1px 10px;'>";

                int j = 1;
                List <IndividualWorkLog> workLogs = IndividualWorkLogs[name];
                foreach (var worklog in workLogs)
                {
                    dailyWorkLogSummaryReport += "" + j + ") " + worklog.jiraKey + " - " + worklog.summary + "<br/>";
                    dailyWorkLogSummaryReport += "[" + worklog.subTaskSummary + "] " + worklog.timeSpent + " - " + worklog.comment + "<br/>";
                    j++;
                }
                dailyWorkLogSummaryReport += "      </td>";
                dailyWorkLogSummaryReport += "  </tr>";

                i++;
            }

            dailyWorkLogSummaryReport += "</table>";

            string content          = @"Hi, All guys<br/><br/>Below is the work log summary report.<br/><br/>" + dailyWorkLogSummaryReport + "Thanks<br/>Accela Support Team";
            string fromEmailAddress = "*****@*****.**";
            string toEmailAddress   = "[email protected];[email protected]";
            string ccEmailAddress   = "*****@*****.**";
            string subject          = "Daily Work Log Summary - " + DateTime.Now.Month + "/" + DateTime.Now.Day + "/" + DateTime.Now.Year;

            try
            {
                EmailUtil.SendEmail(fromEmailAddress, toEmailAddress, ccEmailAddress, subject, content);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Failed to send email");
            }

            System.Console.WriteLine(dailyWorkLogSummaryReport);

            this.btnListWorkLogList.Enabled = true;
        }