コード例 #1
0
        /// <summary>
        /// Get the existing production bug count
        /// </summary>
        private async void GetExistingProductionBugCount()
        {
            int count        = 0;
            var GetIssueList = JiraProxy.GetProductionIssueList();
            var issueListTmp = await GetIssueList;

            count = issueListTmp.ToArray().Length;

            this.txtProductionBugCount.Text = "" + count;
        }
コード例 #2
0
        public async Task <string> createSubTask(string issueKey, string summary, string description)
        {
            IssueRef issueRef = new IssueRef();

            issueRef.key = issueKey;

            var issue = await JiraProxy.CreateSubTask(summary, description, issueRef);

            return(issue.key);
        }
コード例 #3
0
        /// <summary>
        /// Get new jira tickect count for specified duration
        /// </summary>
        /// <param name="startDate">start date</param>
        /// <param name="endDate">end date</param>
        private async void GetNewJiraTiketCount(DateTime startDate, DateTime endDate)
        {
            int count = 0;

            var GetIssueList = JiraProxy.GetIssueListByCreatedDate(startDate, endDate);
            var issueListTmp = await GetIssueList;

            count = issueListTmp.ToArray().Length;

            this.txtNewJiraTicketCount.Text = "" + count;
        }
コード例 #4
0
        public ApiBase(JiraProxy jiraProxy, IHttpContextAccessor httpContextAccessor)
        {
            _jiraProxy = jiraProxy;
            var currentContext = httpContextAccessor.HttpContext;
            var accessToken    = currentContext.Request.Headers["Authorization"].ToString();

            if (!string.IsNullOrEmpty(accessToken))
            {
                var token = accessToken.Split("Bearer ")[1];
                _jiraProxy.SetToken(token);
            }
        }
コード例 #5
0
        private async void CloseSubTaskk(string subTaskKey)
        {
            IssueRef issueRef = new IssueRef();

            issueRef.key = subTaskKey;
            issueRef.id  = subTaskKey;

            var issue = await JiraProxy.LoadIssue(issueRef);

            if (issue == null || issue.fields == null)
            {
                return;
            }

            JiraProxy.CloseSubTask(issueRef);
        }
コード例 #6
0
        private async void btnSubmit_Click(object sender, EventArgs e)
        {
            this.btnSubmit.Enabled = false;

            DataTable dataTable = dgvSubTaskTable.DataSource as DataTable;

            if (dataTable != null)
            {
                string SubTaskKey = "";
                string MEO        = "";

                int rowCount = dataTable.Rows.Count;
                for (int k = 0; k < rowCount; k++)
                {
                    DataRow row = dataTable.Rows[k];

                    SubTaskKey = row["SubTaskKey"] as string;
                    MEO        = row["MEO"] as string;

                    if (!String.IsNullOrEmpty(SubTaskKey) &&
                        !String.IsNullOrEmpty(MEO) &&
                        MEO.Trim().Length > 0)
                    {
                        IssueRef issueRef = new IssueRef();
                        issueRef.key = SubTaskKey;

                        var issue = await JiraProxy.LoadIssue(issueRef);

                        if (issue == null || issue.fields == null)
                        {
                            return;
                        }

                        issue.fields.customfield_14101       = new MEOOption();
                        issue.fields.customfield_14101.value = MEO;

                        JiraProxy.UpdateSubTask(issue);
                    }
                }
            }

            this.btnSubmit.Enabled = true;
        }
コード例 #7
0
        public async void updateSubTask(string subTaskKey, string assignee)
        {
            IssueRef issueRef = new IssueRef();

            issueRef.key = subTaskKey;

            var issue = await JiraProxy.LoadIssue(issueRef);

            if (issue == null || issue.fields == null)
            {
                return;
            }

            // https://accelaeng.atlassian.net/rest/api/2/user/[email protected]
            JiraUser jiraUser = new JiraUser();

            jiraUser.name         = assignee;
            issue.fields.assignee = jiraUser;

            JiraProxy.UpdateSubTask(issue);
        }
コード例 #8
0
        private async Task <SubTask> GetAssigneeAndStatus(string subTaskKey)
        {
            SubTask subTask = new SubTask();

            IssueRef issueRef = new IssueRef();

            issueRef.key = subTaskKey;

            var issue = await JiraProxy.LoadIssue(issueRef);

            if (issue == null || issue.fields == null)
            {
                return(null);
            }

            subTask.Key           = issue.key;
            subTask.Name          = issue.fields.summary;
            subTask.Assignee      = issue.fields.assignee.displayName;
            subTask.AssigneeEmail = issue.fields.assignee.name;
            subTask.Status        = issue.fields.status.name;
            subTask.Estimation    = 0;

            return(subTask);
        }
コード例 #9
0
        private async void btnSync_Click(object sender, EventArgs e)
        {
            this.btnSync.Enabled = false;

            if (jiraIssueList == null || jiraIssueList.Count <= 0)
            {
                this.btnSync.Enabled = true;
                return;
            }

            foreach (var issue in jiraIssueList)
            {
                if (issue.subtasks == null || issue.subtasks.Count <= 0)
                {
                    continue;
                }

                foreach (var key in issue.subtasks.Keys)
                {
                    var subTask = issue.subtasks[key];

                    IssueRef issueRef = new IssueRef();
                    issueRef.key = subTask.key;
                    issueRef.id  = subTask.key;

                    if (subTask == null ||
                        subTask.timespent <= 0 ||
                        subTask.worklogs == null ||
                        subTask.worklogs.Count <= 0)
                    {
                        continue;
                    }

                    var lastWorkLog = subTask.worklogs[subTask.worklogs.Count - 1];
                    var lastAssigneeEmailAddress = lastWorkLog.assigneeEmailAddress;

                    var subTaskItem = await JiraProxy.LoadIssue(issueRef);

                    if (subTaskItem == null || subTaskItem.fields == null)
                    {
                        continue;
                    }

                    if (subTask.assignee == "Jerry Lu")
                    {
                        // https://accelaeng.atlassian.net/rest/api/2/user/[email protected]
                        JiraUser jiraUser = new JiraUser();

                        if ("*****@*****.**" == lastAssigneeEmailAddress)
                        {
                            lastAssigneeEmailAddress = "likko.zhang";
                        }
                        jiraUser.name = lastAssigneeEmailAddress;
                        subTaskItem.fields.assignee = jiraUser;

                        JiraProxy.UpdateSubTask(subTaskItem);
                    }

                    if ("Closed".Equals(issue.status, StringComparison.InvariantCultureIgnoreCase) &&
                        !"Closed".Equals(subTask.status, StringComparison.InvariantCultureIgnoreCase))
                    {
                        if ("Case".Equals(issue.issueType, StringComparison.InvariantCultureIgnoreCase))
                        {
                            if ("Review and Recreate(QA)".Equals(subTask.name, StringComparison.InvariantCultureIgnoreCase) ||
                                "Review and Recreate(Dev)".Equals(subTask.name, StringComparison.InvariantCultureIgnoreCase) ||
                                "Research Root Cause".Equals(subTask.name, StringComparison.InvariantCultureIgnoreCase))
                            {
                                JiraProxy.CloseSubTask(issueRef);
                            }
                        }

                        if ("Bug".Equals(issue.issueType, StringComparison.InvariantCultureIgnoreCase))
                        {
                            if ("Review and Recreate(QA)".Equals(subTask.name, StringComparison.InvariantCultureIgnoreCase) ||
                                "Review and Recreate(Dev)".Equals(subTask.name, StringComparison.InvariantCultureIgnoreCase) ||
                                "Research Root Cause".Equals(subTask.name, StringComparison.InvariantCultureIgnoreCase) ||
                                "Code Fix(Dev)".Equals(subTask.name, StringComparison.InvariantCultureIgnoreCase) ||
                                "Write Test Case(QA)".Equals(subTask.name, StringComparison.InvariantCultureIgnoreCase) ||
                                "Execute Test Case(QA)".Equals(subTask.name, StringComparison.InvariantCultureIgnoreCase) ||
                                "Write Release Notes(Dev)".Equals(subTask.name, StringComparison.InvariantCultureIgnoreCase) ||
                                "Review Release Notes(QA)".Equals(subTask.name, StringComparison.InvariantCultureIgnoreCase))
                            {
                                JiraProxy.CloseSubTask(issueRef);
                            }
                        }
                    }
                }
            }

            this.btnSync.Enabled = true;
        }
コード例 #10
0
        private void btnMerge_Click(object sender, EventArgs e)
        {
            this.btnSync.Enabled  = false;
            this.btnMerge.Enabled = false;

            DataTable dataTable = this.dgdMergeFileList.DataSource as DataTable;

            DataView dataTableView = dataTable.DefaultView;

            dataTableView.Sort = "CaseNumber ASC, UploadDate ASC";
            dataTable          = dataTableView.ToTable();

            if (dataTable != null)
            {
                int    rowCount            = dataTable.Rows.Count;
                bool   IsMerged            = false;
                string caseId              = "";
                string caseNumber          = "";
                string caseAttachmentId    = "";
                string caseFileName        = "";
                string caseAttchmentId     = "";
                string caseAttachmentType  = "";
                string uploadedBy          = "";
                string uploadDate          = "";
                string jiraId              = "";
                string jiraKey             = "";
                string currentCaseNumber   = "";
                string commentMoveFileList = string.Empty;

                IssueRef issueRef = new IssueRef();
                for (int i = 0; i < rowCount; i++)
                {
                    DataRow row = dataTable.Rows[i];
                    IsMerged           = bool.Parse(row["IsMerged"].ToString());
                    caseId             = row["CaseId"] as string;
                    caseNumber         = row["CaseNumber"] as string;
                    caseAttachmentId   = row["CaseAttchmentId"] as string;
                    caseFileName       = row["CaseFileName"] as string;
                    caseAttchmentId    = row["CaseAttchmentId"] as string;
                    caseAttachmentType = row["CaseAttachmentType"] as string;
                    uploadDate         = row["UploadDate"] as string;
                    uploadedBy         = row["UploadedBy"] as string;
                    jiraId             = row["JiraId"] as string;
                    jiraKey            = row["JiraKey"] as string;

                    if (!String.IsNullOrEmpty(commentMoveFileList) && currentCaseNumber != caseNumber)
                    {
                        // Upload jira comment
                        commentMoveFileList = "Copy some attachments from salesforce \n------------------------------------------------------------------------\n" + commentMoveFileList;
                        JiraProxy.CreateComment(issueRef, commentMoveFileList);
                        commentMoveFileList = string.Empty;
                    }

                    issueRef.id  = jiraId;
                    issueRef.key = jiraKey;

                    if (IsMerged)
                    {
                        byte[] fileStream = SalesforceProxy.GetCaseAttachmentById(caseAttachmentId);
                        JiraProxy.UploadAttachment(issueRef, caseFileName, fileStream);

                        commentMoveFileList += "The file : <<" + caseFileName + ">> uploaded by <<" + uploadedBy + ">> on " + uploadDate + "\n";
                    }

                    currentCaseNumber = caseNumber;
                }

                if (!String.IsNullOrEmpty(commentMoveFileList))
                {
                    // Upload jira comment
                    commentMoveFileList = "Copy some attachments from salesforce \n------------------------------------------------------------------------\n" + commentMoveFileList;
                    JiraProxy.CreateComment(issueRef, commentMoveFileList);
                    commentMoveFileList = string.Empty;
                }
            }

            this.btnSync.Enabled  = true;
            this.btnMerge.Enabled = false;
        }
コード例 #11
0
        private async void btnCheck_Click(object sender, EventArgs e)
        {
            //
            this.btnCheck.Enabled = false;

            string strSFID = this.txtSFID.Text.Trim();

            var GetCaseInfoByID = SalesforceProxy.GetCaseInfoByID(strSFID);
            var caseInfo        = await GetCaseInfoByID;

            AccelaCase[] accelaCaseList = caseInfo.ToArray();
            if (accelaCaseList.Length == 0)
            {
                MessageBox.Show("No case is found.");
            }
            else
            {
                this.txtCustomerInfo.Text        = accelaCaseList[0].Customer != null ? accelaCaseList[0].Customer.Name : (accelaCaseList[0].Account != null ? accelaCaseList[0].Account.Name : "");
                this.txtVersion.Text             = accelaCaseList[0].CurrentVersion;
                this.chbAccelaHostedFlag.Checked = (accelaCaseList[0].Hosted != null && accelaCaseList[0].Hosted.IndexOf("Accela") >= 0 ? true : false);
                this.txtCaseOwner.Text           = accelaCaseList[0].CreatedBy.Name;
                this.txtIssueSubject.Text        = accelaCaseList[0].Subject;
                this.txtProduct.Text             = accelaCaseList[0].Product;
                this.txtPriority.Text            = "";
                if (accelaCaseList[0].Priority.IndexOf("Critical") >= 0)
                {
                    this.txtPriority.Text = "Critical";
                }

                if (accelaCaseList[0].Priority.IndexOf("High") >= 0)
                {
                    this.txtPriority.Text = "High";
                }

                if (accelaCaseList[0].Priority.IndexOf("Medium") >= 0)
                {
                    this.txtPriority.Text = "Medium";
                }

                if (accelaCaseList[0].Priority.IndexOf("Low") >= 0)
                {
                    this.txtPriority.Text = "Low";
                }
            }

            var GetIssueByID = JiraProxy.GetIssueByID("ENGSUPP", "", strSFID);
            var issueInfo    = await GetIssueByID;

            if (issueInfo == null)
            {
                return;
            }

            this.txtEngsuppID.Text = issueInfo.key;
            this.txtReviewer.Text  = issueInfo.fields.assignee.name;

            bool hasOldDB = issueInfo.fields.labels.IndexOf("DB") >= 0;

            if (hasOldDB && AccelaDBMapper.ContainsKey(this.txtCustomerInfo.Text))
            {
                AcccelaDBModel acccelaDBInfo = AccelaDBMapper[this.txtCustomerInfo.Text];
                this.txtDBType.Text       = acccelaDBInfo.DBType;
                this.txtDBServerIP.Text   = acccelaDBInfo.IP;
                this.txtDBServerPort.Text = acccelaDBInfo.Port;
                this.txtDBInstance.Text   = acccelaDBInfo.DBName;
                this.txtDBVersion.Text    = acccelaDBInfo.Version;
                this.txtDBUser.Text       = acccelaDBInfo.User;
                this.txtDBPassword.Text   = acccelaDBInfo.Password;
                this.txtRelatedCase.Text  = acccelaDBInfo.SFCase;
            }

            var GetDBTaskBySFID = JiraProxy.GetDatabaseTaskByCaseID("DATABASE", "Task", strSFID);
            var taskInfo        = await GetDBTaskBySFID;

            if (taskInfo != null)
            {
                this.txtDatabaseID.Text = taskInfo.key;
            }

            this.btnRequest.Enabled = true;
            this.btnCheck.Enabled   = true;
        }
コード例 #12
0
        private async void btnPull_Click(object sender, EventArgs e)
        {
            this.btnPull.Enabled = false;

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

            var issues = await JiraProxy.GetUpdatedIssueList(from, to);

            if (issues == null || issues.Count == 0)
            {
                this.btnPull.Enabled = true;
                return;
            }

            jiraIssueList.Clear();
            JiraIssue jiraIssue = null;

            foreach (var issue in issues)
            {
                jiraIssue                      = new JiraIssue();
                jiraIssue.key                  = issue.key;
                jiraIssue.issueType            = issue.fields.issueType.name;
                jiraIssue.name                 = issue.fields.summary;
                jiraIssue.assignee             = issue.fields.assignee.name;
                jiraIssue.assigneeEmailAddress = issue.fields.assignee.emailAddress;
                jiraIssue.assigneeDisplayName  = issue.fields.assignee.displayName;
                jiraIssue.status               = issue.fields.status.name;

                jiraIssue.subtasks = new Dictionary <string, SubTask>();

                if (issue.fields.subtasks == null || issue.fields.subtasks.Count == 0)
                {
                    jiraIssueList.Add(jiraIssue);
                    continue;
                }

                double timeSpentSeconds = 0;
                foreach (var subtask in issue.fields.subtasks)
                {
                    string subTaskKey  = subtask.key;
                    string subTaskName = subtask.fields.summary;
                    bool   isSubTask   = subtask.fields.issuetype.subtask;

                    if (isSubTask && !jiraIssue.subtasks.ContainsKey(subTaskName))
                    {
                        IssueRef issueRef = new IssueRef();
                        issueRef.id  = subTaskKey;
                        issueRef.key = subTaskKey;
                        var subTaskInfo = await JiraProxy.LoadIssue(issueRef);


                        if (subTaskInfo == null)
                        {
                            continue;
                        }

                        SubTask subTaskItem = new SubTask();
                        subTaskItem.key      = subTaskInfo.key;
                        subTaskItem.name     = subTaskInfo.fields.summary;
                        subTaskItem.assignee = subTaskInfo.fields.assignee.displayName;
                        subTaskItem.status   = subTaskInfo.fields.status.name;
                        subTaskItem.MEO      = subTaskInfo.fields.customfield_14101 == null ? "" : subTaskInfo.fields.customfield_14101.value;

                        var worklogs = await JiraProxy.GetWorklogs(issueRef);

                        if (worklogs == null && worklogs.Count == 0)
                        {
                            jiraIssue.subtasks.Add(subTaskItem.name, subTaskItem);
                            continue;
                        }

                        subTaskItem.worklogs = new List <WorkLog>();
                        foreach (var worklog in worklogs)
                        {
                            WorkLog individualWorkLog = new WorkLog();
                            individualWorkLog.assignee             = worklog.author.displayName;
                            individualWorkLog.assigneeEmailAddress = worklog.author.emailAddress;
                            individualWorkLog.timeSpent            = worklog.timeSpent;
                            individualWorkLog.comment = worklog.comment.Replace("\r\n", ";");

                            subTaskItem.worklogs.Add(individualWorkLog);

                            timeSpentSeconds += worklog.timeSpentSeconds;
                        }

                        subTaskItem.timespent = Math.Round((double)subTaskInfo.fields.timespent / 3600, 2);
                        jiraIssue.subtasks.Add(subTaskItem.name, subTaskItem);
                    }
                }

                jiraIssue.timespent = Math.Round((double)timeSpentSeconds / 3600, 2);
                jiraIssueList.Add(jiraIssue);
            }

            DataTable table = new DataTable("Daily Work Log Report");

            table.Columns.Add("No", typeof(int));
            table.Columns.Add("IssueType", typeof(string));
            table.Columns.Add("JiraKey", typeof(string));
            table.Columns.Add("Summary", typeof(string));
            table.Columns.Add("Status", typeof(string));
            table.Columns.Add("Assignee", typeof(string));
            table.Columns.Add("AssigneeQA", typeof(string));
            table.Columns.Add("TimeSpent", typeof(string));
            table.Columns.Add("ReviewAndRecreateQA", typeof(string));
            table.Columns.Add("Assignee1", typeof(string));
            table.Columns.Add("Status1", typeof(string));
            table.Columns.Add("MEO1", typeof(string));
            table.Columns.Add("TimeSpent1", typeof(string));
            table.Columns.Add("ReviewAndRecreateDev", typeof(string));
            table.Columns.Add("Assignee2", typeof(string));
            table.Columns.Add("Status2", typeof(string));
            table.Columns.Add("MEO2", typeof(string));
            table.Columns.Add("TimeSpent2", typeof(string));
            table.Columns.Add("ResearchRootCauseDev", typeof(string));
            table.Columns.Add("Assignee3", typeof(string));
            table.Columns.Add("Status3", typeof(string));
            table.Columns.Add("MEO3", typeof(string));
            table.Columns.Add("TimeSpent3", typeof(string));
            table.Columns.Add("CodeFixDev", typeof(string));
            table.Columns.Add("Assignee4", typeof(string));
            table.Columns.Add("Status4", typeof(string));
            table.Columns.Add("MEO4", typeof(string));
            table.Columns.Add("TimeSpent4", typeof(string));
            table.Columns.Add("WriteTestCaseQA", typeof(string));
            table.Columns.Add("Assignee5", typeof(string));
            table.Columns.Add("Status5", typeof(string));
            table.Columns.Add("MEO5", typeof(string));
            table.Columns.Add("TimeSpent5", typeof(string));
            table.Columns.Add("ExecuteTestCaseQA", typeof(string));
            table.Columns.Add("Assignee6", typeof(string));
            table.Columns.Add("Status6", typeof(string));
            table.Columns.Add("MEO6", typeof(string));
            table.Columns.Add("TimeSpent6", typeof(string));
            table.Columns.Add("WriteReleaseNotesDev", typeof(string));
            table.Columns.Add("Assignee7", typeof(string));
            table.Columns.Add("Status7", typeof(string));
            table.Columns.Add("MEO7", typeof(string));
            table.Columns.Add("TimeSpent7", typeof(string));
            table.Columns.Add("ReviewReleaseNotesQA", typeof(string));
            table.Columns.Add("Assignee8", typeof(string));
            table.Columns.Add("Status8", typeof(string));
            table.Columns.Add("MEO8", typeof(string));
            table.Columns.Add("TimeSpent8", typeof(string));

            int index = 1;

            foreach (var jiraIssueItem in jiraIssueList)
            {
                DataRow row = table.NewRow();
                row["No"]         = index;
                row["IssueType"]  = jiraIssueItem.issueType;
                row["JiraKey"]    = jiraIssueItem.key;
                row["Summary"]    = jiraIssueItem.name;
                row["Status"]     = jiraIssueItem.status;
                row["Assignee"]   = jiraIssueItem.assignee;
                row["AssigneeQA"] = jiraIssueItem.assignee;
                row["TimeSpent"]  = jiraIssueItem.timespent;

                SubTask subTaskReviewAndRecreateQA = jiraIssueItem.subtasks.ContainsKey("Review and Recreate(QA)") ? jiraIssueItem.subtasks["Review and Recreate(QA)"] : null;
                if (subTaskReviewAndRecreateQA != null)
                {
                    row["ReviewAndRecreateQA"] = subTaskReviewAndRecreateQA.key;
                    row["Assignee1"]           = subTaskReviewAndRecreateQA.assignee;
                    row["Status1"]             = subTaskReviewAndRecreateQA.status;
                    row["MEO1"]       = subTaskReviewAndRecreateQA.MEO;
                    row["TimeSpent1"] = subTaskReviewAndRecreateQA.timespent;
                }

                SubTask subTaskReviewAndRecreateDev = jiraIssueItem.subtasks.ContainsKey("Review and Recreate(Dev)") ? jiraIssueItem.subtasks["Review and Recreate(Dev)"] : null;
                if (subTaskReviewAndRecreateDev != null)
                {
                    row["ReviewAndRecreateDev"] = subTaskReviewAndRecreateDev.key;
                    row["Assignee2"]            = subTaskReviewAndRecreateDev.assignee;
                    row["Status2"]    = subTaskReviewAndRecreateDev.status;
                    row["MEO2"]       = subTaskReviewAndRecreateDev.MEO;
                    row["TimeSpent2"] = subTaskReviewAndRecreateDev.timespent;
                }

                SubTask subTaskResearchRootCause = jiraIssueItem.subtasks.ContainsKey("Research Root Cause") ? jiraIssueItem.subtasks["Research Root Cause"] : null;
                if (subTaskResearchRootCause != null)
                {
                    row["ResearchRootCauseDev"] = subTaskResearchRootCause.key;
                    row["Assignee3"]            = subTaskResearchRootCause.assignee;
                    row["Status3"]    = subTaskResearchRootCause.status;
                    row["MEO3"]       = subTaskResearchRootCause.MEO;
                    row["TimeSpent3"] = subTaskResearchRootCause.timespent;
                }

                SubTask subTaskCodeFixDev = jiraIssueItem.subtasks.ContainsKey("Code Fix(Dev)") ? jiraIssueItem.subtasks["Code Fix(Dev)"] : null;
                if (subTaskCodeFixDev != null)
                {
                    row["CodeFixDev"] = subTaskCodeFixDev.key;
                    row["Assignee4"]  = subTaskCodeFixDev.assignee;
                    row["Status4"]    = subTaskCodeFixDev.status;
                    row["MEO4"]       = subTaskCodeFixDev.MEO;
                    row["TimeSpent4"] = subTaskCodeFixDev.timespent;
                }

                SubTask subTaskWriteTestCaseQA = jiraIssueItem.subtasks.ContainsKey("Write Test Case(QA)") ? jiraIssueItem.subtasks["Write Test Case(QA)"] : null;
                if (subTaskWriteTestCaseQA != null)
                {
                    row["WriteTestCaseQA"] = subTaskWriteTestCaseQA.key;
                    row["Assignee5"]       = subTaskWriteTestCaseQA.assignee;
                    row["Status5"]         = subTaskWriteTestCaseQA.status;
                    row["MEO5"]            = subTaskWriteTestCaseQA.MEO;
                    row["TimeSpent5"]      = subTaskWriteTestCaseQA.timespent;
                }


                SubTask subTaskExecuteTestCaseQA = jiraIssueItem.subtasks.ContainsKey("Execute Test Case(QA)") ? jiraIssueItem.subtasks["Execute Test Case(QA)"] : null;
                if (subTaskExecuteTestCaseQA != null)
                {
                    row["ExecuteTestCaseQA"] = subTaskExecuteTestCaseQA.key;
                    row["Assignee6"]         = subTaskExecuteTestCaseQA.assignee;
                    row["Status6"]           = subTaskExecuteTestCaseQA.status;
                    row["MEO6"]       = subTaskExecuteTestCaseQA.MEO;
                    row["TimeSpent6"] = subTaskExecuteTestCaseQA.timespent;
                }

                SubTask subTaskWriteReleaseNotesDev = jiraIssueItem.subtasks.ContainsKey("Write Release Notes(Dev)") ? jiraIssueItem.subtasks["Write Release Notes(Dev)"] : null;
                if (subTaskWriteReleaseNotesDev != null)
                {
                    row["WriteReleaseNotesDev"] = subTaskWriteReleaseNotesDev.key;
                    row["Assignee7"]            = subTaskWriteReleaseNotesDev.assignee;
                    row["Status7"]    = subTaskWriteReleaseNotesDev.status;
                    row["MEO7"]       = subTaskWriteReleaseNotesDev.MEO;
                    row["TimeSpent7"] = subTaskWriteReleaseNotesDev.timespent;
                }

                SubTask subTaskReviewReleaseNotesQA = jiraIssueItem.subtasks.ContainsKey("Review Release Notes(QA)") ? jiraIssueItem.subtasks["Review Release Notes(QA)"] : null;
                if (subTaskReviewReleaseNotesQA != null)
                {
                    row["ReviewReleaseNotesQA"] = subTaskReviewReleaseNotesQA.key;
                    row["Assignee8"]            = subTaskReviewReleaseNotesQA.assignee;
                    row["Status8"]    = subTaskReviewReleaseNotesQA.status;
                    row["MEO8"]       = subTaskReviewReleaseNotesQA.MEO;
                    row["TimeSpent8"] = subTaskReviewReleaseNotesQA.timespent;
                }

                table.Rows.Add(row);
                index++;
            }

            this.dgvSubTaskTable.AutoGenerateColumns = false;
            this.dgvSubTaskTable.DataSource          = table;

            this.btnPull.Enabled = true;
            return;
        }
コード例 #13
0
        private async void btnLookUpInJiraAndSF_Click(object sender, EventArgs e)
        {
            this.btnLookUpInJiraAndSF.Enabled = false;

            string emailAddress = this.ddlReviewerEmailAddress.SelectedValue as string;

            if ("*****@*****.**" == emailAddress)
            {
                emailAddress = emailAddress.Replace("@missionsky.com", "");
            }

            var issues = await JiraProxy.GetIssueList(emailAddress);

            List <string> caseList = new List <string>();
            Dictionary <string, AccelaIssueCaseMapper> JiraMapping = new Dictionary <string, AccelaIssueCaseMapper>();

            foreach (var issue in issues)
            {
                AccelaIssueCaseMapper accelaIssueCaseMapper = new AccelaIssueCaseMapper();
                accelaIssueCaseMapper.CaseNumber = issue.fields.customfield_10600;
                accelaIssueCaseMapper.Assignee   = (issue.fields.assignee == null ? "" : issue.fields.assignee.displayName);
                accelaIssueCaseMapper.JiraKey    = issue.key;
                accelaIssueCaseMapper.JiraId     = issue.id;
                accelaIssueCaseMapper.Status     = issue.fields.status.name;
                accelaIssueCaseMapper.HotCase    = issue.fields.labels.Contains("HotCase");

                if (String.IsNullOrEmpty(accelaIssueCaseMapper.CaseNumber))
                {
                    continue;
                }

                if (!JiraMapping.ContainsKey(accelaIssueCaseMapper.CaseNumber))
                {
                    JiraMapping.Add(accelaIssueCaseMapper.CaseNumber, accelaIssueCaseMapper);
                }
                else
                {
                    System.Console.WriteLine("Duplicated Case: " + accelaIssueCaseMapper.CaseNumber);
                    if ("CLOSED".Equals(JiraMapping[accelaIssueCaseMapper.CaseNumber].Status, StringComparison.CurrentCultureIgnoreCase))
                    {
                        JiraMapping[accelaIssueCaseMapper.CaseNumber] = accelaIssueCaseMapper;
                    }
                }
                caseList.Add(accelaIssueCaseMapper.CaseNumber);
            }

            DataTable table = new DataTable("CaseList");

            table.Columns.Add("ID", typeof(string));
            table.Columns.Add("No", typeof(int));
            table.Columns.Add("Product", typeof(string));
            table.Columns.Add("SalesforceID", typeof(string));
            table.Columns.Add("JiraKey", typeof(string));
            table.Columns.Add("JiraID", typeof(string));
            table.Columns.Add("Type", typeof(string));
            table.Columns.Add("Version", typeof(string));
            table.Columns.Add("Priority", typeof(string));
            table.Columns.Add("Customer", typeof(string));
            table.Columns.Add("Summary", typeof(string));
            table.Columns.Add("Reviewer", typeof(string));
            table.Columns.Add("ReopenedCount", typeof(string));
            table.Columns.Add("SFQueue", typeof(string));
            table.Columns.Add("SFStatus", typeof(string));
            table.Columns.Add("JiraStatus", typeof(string));
            table.Columns.Add("JiraNextStatus", typeof(string));

            if (caseList.Count == 0)
            {
                this.grdCaseList.DataSource          = table;
                this.grdCaseList.AutoGenerateColumns = false;
                this.btnLookUpInJiraAndSF.Enabled    = true;
                return;
            }

            Dictionary <string, string> Reviewers = new Dictionary <string, string>();

            Reviewers.Add("Jessy", "Jessy.Zhang");
            Reviewers.Add("Adger", "Adger.Chen");
            Reviewers.Add("Tim", "Tim.Liu");

            Reviewers.Add("Mia", "Mia.Huang");
            Reviewers.Add("Alvin", "Alvin.Li");
            Reviewers.Add("Mina", "Mina.Xiong");

            Reviewers.Add("Peter", "Peter.Peng");
            Reviewers.Add("John", "John.Huang");
            Reviewers.Add("Bass", "Bass.Yang");
            Reviewers.Add("Star", "Star.Li");
            Reviewers.Add("Shaun", "Shaun.Qiu");
            Reviewers.Add("Lex", "Lex.Wu");
            Reviewers.Add("Louis", "Louis.He");
            Reviewers.Add("Likko", "Likko.Zhang");
            Reviewers.Add("Sandy", "Sandy.Zheng");
            Reviewers.Add("Weber", "Weber.Yan");
            Reviewers.Add("Rick", "Rick.Liu");
            Reviewers.Add("Matt", "Matt.Ao");
            Reviewers.Add("Hyman", "Hyman.Zhang");
            Reviewers.Add("Feng", "Feng.Xuan");
            Reviewers.Add("Cheng", "Cheng.Xu");
            Reviewers.Add("Alex", "Alex.Li");

            Reviewers.Add("Mandy", "Mandy.Zhou");
            Reviewers.Add("Linda", "Linda.Xiao");
            Reviewers.Add("Leo", "Leo.Liu");
            Reviewers.Add("Abel", "Abel.Yu");
            Reviewers.Add("Claire", "Claire.Cao");
            Reviewers.Add("Viola", "Viola.Shi");
            Reviewers.Add("Larry", "Larry.Francisco");

            Reviewers.Add("Gordon", "Gordon.Chen");
            Reviewers.Add("Tracy", "Tracy.Xiang");

            Reviewers.Add("Jessie", "Jessie.Zhang");
            Reviewers.Add("William", "William.Wang");

            Reviewers.Add("Carly", "Carly.Xu");
            Reviewers.Add("Janice", "Janice.Zhong");
            Reviewers.Add("Jane", "Jane.Hu");
            Reviewers.Add("Amy", "Amy.Bao");
            Reviewers.Add("Iris", "Iris.Wang");
            Reviewers.Add("Grace", "Grace.Tang");
            Reviewers.Add("Cloud", "Clouid.Qi");
            Reviewers.Add("Carol", "Carol.Gong");

            Reviewers.Add("Manasi", "*****@*****.**");
            Reviewers.Add("Sasirekha", "*****@*****.**");
            Reviewers.Add("Jerry", "Jerry.Lu");

            var  jiraId                     = "";
            var  jiraKey                    = "";
            var  customer                   = "";
            var  assignee                   = "";
            var  jiaStstus                  = "";
            var  reopenCount                = 0;
            bool isCommentedToday           = false;
            int  index                      = 1;
            AccelaIssueCaseMapper tempIssue = null;
            var cases = await SalesforceProxy.GetCaseList(caseList);

            foreach (var caseinfo in cases)
            {
                tempIssue = null;
                if (JiraMapping.ContainsKey(caseinfo.CaseNumber))
                {
                    tempIssue = JiraMapping[caseinfo.CaseNumber];
                }

                DataRow row = table.NewRow();
                row["ID"]           = caseinfo.Id;
                row["No"]           = index;
                row["Product"]      = AccelaCaseUtil.AdjustProductName(caseinfo.Product, caseinfo.Solution, caseinfo.Subject, caseinfo.Description);
                row["SalesforceID"] = caseinfo.CaseNumber;
                jiraId         = (tempIssue != null ? tempIssue.JiraId : "");
                row["JiraID"]  = jiraId;
                jiraKey        = (tempIssue != null ? tempIssue.JiraKey : "");
                row["JiraKey"] = jiraKey;
                row["Type"]    = caseinfo.Type;
                row["Version"] = caseinfo.CurrentVersion;
                string[] severity = caseinfo.Priority.Split(' ');
                row["Priority"]      = severity[1];
                customer             = (caseinfo.Customer != null && !String.IsNullOrEmpty(caseinfo.Customer.Name) ? caseinfo.Customer.Name : (caseinfo.Account != null ? caseinfo.Account.Name : ""));
                row["Customer"]      = customer;
                row["Summary"]       = caseinfo.Subject;
                reopenCount          = (caseinfo.CaseComments != null && caseinfo.CaseComments.Records != null ? caseinfo.CaseComments.Records.Count - 1 : 0);
                row["ReopenedCount"] = reopenCount;
                row["SFQueue"]       = caseinfo.Owner.Name;
                row["SFStatus"]      = caseinfo.Status;
                jiaStstus            = (tempIssue != null ? tempIssue.Status : "");
                row["JiraStatus"]    = jiaStstus;

                assignee = (tempIssue != null ? tempIssue.Assignee : "");

                isCommentedToday = false;
                if (caseinfo.CaseComments != null && caseinfo.CaseComments.Records != null)
                {
                    CaseComment comment = caseinfo.CaseComments.Records[0];

                    isCommentedToday = (comment.CreatedDate.Year == DateTime.Now.Year && comment.CreatedDate.Month == DateTime.Now.Month && comment.CreatedDate.Day == DateTime.Now.Day ? true : false);
                    if (!String.IsNullOrEmpty(assignee) && comment.CommentBody.ToUpper().Contains(assignee.ToUpper()))
                    {
                    }
                    else
                    {
                        foreach (var key in Reviewers.Keys)
                        {
                            string value  = Reviewers[key];
                            string value1 = value.Replace('.', ' ');
                            if (comment.CommentBody.ToUpper().EndsWith(key.ToUpper()) ||
                                comment.CommentBody.ToUpper().EndsWith(value.ToUpper()) ||
                                comment.CommentBody.ToUpper().EndsWith(value1.ToUpper()))
                            {
                                assignee = Reviewers[key];
                                break;
                            }
                        }
                    }
                }

                /*
                 * if ("CLOSED".Equals(caseinfo.Status, StringComparison.InvariantCultureIgnoreCase)
                 *  && !"CLOSED".Equals(jiaStstus, StringComparison.InvariantCultureIgnoreCase))
                 * {
                 *  row["JiraNextStatus"] = "Closed";
                 * }
                 *
                 * if ("engineering".Equals(caseinfo.Owner.Name, StringComparison.InvariantCultureIgnoreCase)
                 *  && "eng new".Equals(caseinfo.Status, StringComparison.InvariantCultureIgnoreCase))
                 * {
                 *  if (isCommentedToday)
                 *  {
                 *      row["JiraNextStatus"] = "Pending";
                 *  }
                 *  else
                 *  {
                 *      if (!"Open".Equals(jiaStstus, StringComparison.InvariantCultureIgnoreCase)
                 *          && !"In Progress".Equals(jiaStstus, StringComparison.InvariantCultureIgnoreCase))
                 *      {
                 *          row["JiraNextStatus"] = "In Progress";
                 *      }
                 *  }
                 * }
                 *
                 * if (isCommentedToday && !"Pending".Equals(jiaStstus, StringComparison.InvariantCultureIgnoreCase))
                 * {
                 *  row["JiraNextStatus"] = "Pending";
                 * }
                 * */
                row["JiraNextStatus"] = AccelaCaseUtil.GetNextJIRAStatus(caseinfo.Owner.Name, caseinfo.Status, jiaStstus, isCommentedToday);

                row["Reviewer"] = assignee;

                table.Rows.Add(row);
                index++;
            }

            this.grdCaseList.AutoGenerateColumns = false;
            this.grdCaseList.DataSource          = table;

            this.btnLookUpInJiraAndSF.Enabled = true;
        }
コード例 #14
0
        private async void btnAssign_Click(object sender, EventArgs e)
        {
            this.btnAssign.Enabled = false;

            DataTable dataTable = dgvWorkLogReport.DataSource as DataTable;

            if (dataTable != null)
            {
                string Name            = "";
                string EmailAddress    = "";
                string Effort          = "";
                string SubTaskID       = "";
                string SubTaskSummary  = "";
                string SubTaskAssignee = "";
                string SubTaskComment  = "";
                string JiraKey         = "";
                string JiraSummary     = "";

                int rowCount = dataTable.Rows.Count;
                for (int k = 0; k < rowCount; k++)
                {
                    DataRow row = dataTable.Rows[k];

                    Name            = row["Name"] as string;
                    EmailAddress    = row["EmailAddress"] as string;
                    Effort          = row["Effort"] as string;
                    SubTaskID       = row["SubTaskID"] as string;
                    SubTaskSummary  = row["SubTaskSummary"] as string;
                    SubTaskAssignee = row["SubTaskAssignee"] as string;
                    SubTaskComment  = row["SubTaskComment"] as string;
                    JiraKey         = row["JiraKey"] as string;
                    JiraSummary     = row["JiraSummary"] as string;

                    if (!String.IsNullOrEmpty(SubTaskID) &&
                        !Name.Equals(SubTaskAssignee, StringComparison.InvariantCultureIgnoreCase))
                    {
                        IssueRef issueRef = new IssueRef();
                        issueRef.key = SubTaskID;

                        var issue = await JiraProxy.LoadIssue(issueRef);

                        if (issue == null || issue.fields == null)
                        {
                            return;
                        }

                        // https://accelaeng.atlassian.net/rest/api/2/user/[email protected]
                        JiraUser jiraUser = new JiraUser();

                        if ("*****@*****.**" == EmailAddress)
                        {
                            EmailAddress = "likko.zhang";
                        }
                        jiraUser.name         = EmailAddress;
                        issue.fields.assignee = jiraUser;

                        JiraProxy.UpdateSubTask(issue);
                    }
                }
            }

            this.btnAssign.Enabled = true;
        }
コード例 #15
0
        private async void btnSyncWithJiraAndSF_Click(object sender, EventArgs e)
        {
            this.btnSendSummaryReport.Enabled = false;
            this.btnSyncWithJiraAndSF.Enabled = false;

            List <string> problemCaseIDList = new List <string>();

            // 1, Construct one case list from the specified case list
            // 1.1 Check if the case list formate is valid or not
            // 1.2 Construct one case list
            string        caseIDs    = this.txtCaseIDList.Text;
            List <string> caseIdList = new List <string>();

            if (String.IsNullOrEmpty(caseIDs) || caseIDs.Trim().Length == 0)
            {
                // Show one error message "ERROR: Please enter case id"
                (this.MdiParent as MainForm).ShowStatusMessage("ERROR: Please enter case id");

                this.btnSendSummaryReport.Enabled = true;
                this.btnSyncWithJiraAndSF.Enabled = true;

                return;
            }
            else
            {
                (this.MdiParent as MainForm).ShowStatusMessage("");

                string[] caseIDArray = caseIDs.Split(',');
                Regex    reg         = new Regex(@"\d{2}ACC-\d{5}");
                foreach (string caseId in caseIDArray)
                {
                    if (reg.IsMatch(caseId))
                    {
                        if (!caseIdList.Contains(caseId.Trim()))
                        {
                            caseIdList.Add(caseId.Trim());
                        }
                    }
                    else
                    {
                        // Show one error message "ERROR: Invalid Format for XXXX"
                        (this.MdiParent as MainForm).ShowStatusMessage("ERROR: Invalid Format for " + caseId);

                        this.btnSendSummaryReport.Enabled = true;
                        this.btnSyncWithJiraAndSF.Enabled = true;

                        return;
                    }
                }
            }

            var caseList  = new List <AccelaCase>();
            var issueList = new List <Issue>();

            int N = 1;

            for (int i = 0; i < caseIdList.Count;)
            {
                List <string> caseIdListTemp = new List <string>();
                for (; i < N * 50 && i < caseIdList.Count; i++)
                {
                    caseIdListTemp.Add(caseIdList[i]);
                }

                N = N + 1;

                var GetCaseList  = SalesforceProxy.GetCaseList(caseIdListTemp);
                var GetIssueList = JiraProxy.GetIssueList(caseIdListTemp);

                var caseListTmp  = await GetCaseList;
                var issueListTmp = await GetIssueList;

                if (caseIdListTemp.Count != caseListTmp.Count)
                {
                    foreach (var tempCase in caseListTmp)
                    {
                        string caseID = tempCase.CaseNumber;
                        if (caseIdListTemp.Contains(caseID))
                        {
                            caseIdListTemp.Remove(caseID);
                        }
                    }

                    problemCaseIDList.AddRange(caseIdListTemp);
                }
                caseList.AddRange(caseListTmp);
                issueList.AddRange(issueListTmp);
            }

            if (problemCaseIDList != null && problemCaseIDList.Count > 0)
            {
                System.Console.WriteLine("Below case id are lost.");
                foreach (string lostCaseId in problemCaseIDList)
                {
                    System.Console.WriteLine(lostCaseId);
                }
            }

            Dictionary <string, AccelaIssueCaseMapper> JiraMapping = new Dictionary <string, AccelaIssueCaseMapper>();

            foreach (var issue in issueList)
            {
                if (!JiraMapping.ContainsKey(issue.fields.customfield_10600))
                {
                    AccelaIssueCaseMapper accelaIssueCaseMapper = new AccelaIssueCaseMapper();
                    accelaIssueCaseMapper.CaseNumber    = issue.fields.customfield_10600;
                    accelaIssueCaseMapper.Assignee      = (issue.fields.assignee == null ? "" : issue.fields.assignee.displayName);
                    accelaIssueCaseMapper.AssigneeQA    = (issue.fields.customfield_11702 == null ? "" : issue.fields.customfield_11702.displayName);
                    accelaIssueCaseMapper.JiraId        = issue.id;
                    accelaIssueCaseMapper.JiraKey       = issue.key;
                    accelaIssueCaseMapper.IssueCategory = (issue.fields.customfield_11502 != null && issue.fields.customfield_11502.Count > 0 ? issue.fields.customfield_11502[0].value : "--NONE--");
                    accelaIssueCaseMapper.LastModified  = issue.fields.customfield_10903;
                    accelaIssueCaseMapper.Status        = issue.fields.status.name;
                    accelaIssueCaseMapper.HotCase       = issue.fields.labels.Contains("HotCase");
                    accelaIssueCaseMapper.Missionsky    = issue.fields.labels.Contains("Missionsky");
                    accelaIssueCaseMapper.JiraLabels    = issue.fields.labels;
                    accelaIssueCaseMapper.FixVersions   = new List <string>();

                    if (issue.fields.fixVersions != null)
                    {
                        foreach (var fixVersion in issue.fields.fixVersions)
                        {
                            accelaIssueCaseMapper.FixVersions.Add(fixVersion.name);
                        }
                    }

                    JiraMapping.Add(accelaIssueCaseMapper.CaseNumber, accelaIssueCaseMapper);
                }
            }

            DataTable table = new DataTable("Daily Report");

            table.Columns.Add("ID", typeof(string));
            table.Columns.Add("No", typeof(int));
            table.Columns.Add("HotCase", typeof(bool));
            table.Columns.Add("Missionsky", typeof(bool));
            table.Columns.Add("JiraLabels", typeof(List <string>));
            table.Columns.Add("ProductForUI", typeof(string));
            table.Columns.Add("Product", typeof(string));
            table.Columns.Add("Solution", typeof(string));
            table.Columns.Add("Orgin", typeof(string));
            table.Columns.Add("OpenDate", typeof(string));
            table.Columns.Add("Severity", typeof(string));
            table.Columns.Add("Rank", typeof(int));
            table.Columns.Add("SalesforceID", typeof(string));
            table.Columns.Add("JiraID", typeof(string));
            table.Columns.Add("JiraKey", typeof(string));
            table.Columns.Add("Type", typeof(string));
            table.Columns.Add("Version", typeof(string));
            table.Columns.Add("Customer", typeof(string));
            table.Columns.Add("Summary", typeof(string));
            table.Columns.Add("Description", typeof(string));
            table.Columns.Add("Reviewer", typeof(string));
            table.Columns.Add("Comments", typeof(string));
            table.Columns.Add("ReopenedCount", typeof(string));
            table.Columns.Add("JiraStatus", typeof(string));
            table.Columns.Add("NextJiraStatus", typeof(string));
            table.Columns.Add("SFQueue", typeof(string));
            table.Columns.Add("SFStatus", typeof(string));
            table.Columns.Add("SFLastModified", typeof(string));
            table.Columns.Add("CaseComment", typeof(CaseComment));
            table.Columns.Add("FixVersions", typeof(string));
            table.Columns.Add("ReleaseInfo", typeof(string));
            table.Columns.Add("TargetedRelease", typeof(string));
            table.Columns.Add("InternalType", typeof(string));
            table.Columns.Add("EngineeringStatus", typeof(string));
            table.Columns.Add("BZID", typeof(string));
            table.Columns.Add("IssueCategory", typeof(string));
            table.Columns.Add("Assignee", typeof(string));
            table.Columns.Add("AssigneeQA", typeof(string));
            table.Columns.Add("CaseComments", typeof(List <CaseComment>));

            Dictionary <string, string> Reviewers = SalesforceProxy.GetReviewerNamesList();

            int index = 1;
            AccelaIssueCaseMapper tempIssue = null;
            string openDate    = "";
            string jiraKey     = "";
            string jiraId      = "";
            string customer    = "";
            string assignee    = "";
            int    reopenCount = 0;
            string jiaStstus   = "";

            string[] Severity         = null;
            string   temComment       = "";
            string   lastModifiedDate = "";

            int rank = 0;

            foreach (var caseinfo in caseList)
            {
                tempIssue = null;
                if (JiraMapping.ContainsKey(caseinfo.CaseNumber))
                {
                    tempIssue = JiraMapping[caseinfo.CaseNumber];
                }

                if (caseinfo.ReleaseInfo != null)
                {
                    //SalesforceProxy.GetReleaseInfoById(caseinfo.ReleaseInfo);
                }

                DataRow row = table.NewRow();
                row["ID"]            = caseinfo.Id;
                row["No"]            = index;
                row["HotCase"]       = (tempIssue != null && tempIssue.HotCase);
                row["Missionsky"]    = (tempIssue != null && tempIssue.Missionsky);
                row["JiraLabels"]    = (tempIssue != null ? tempIssue.JiraLabels : null);
                row["IssueCategory"] = (tempIssue != null ? tempIssue.IssueCategory : null);
                row["Assignee"]      = (tempIssue != null ? tempIssue.Assignee : null);
                row["AssigneeQA"]    = (tempIssue != null ? tempIssue.AssigneeQA : null);
                //row["HotCase"] = true;
                row["ProductForUI"] = AccelaCaseUtil.AdjustProductName(caseinfo.Product, caseinfo.Solution, caseinfo.Subject, caseinfo.Description);
                row["Product"]      = caseinfo.Product;
                row["Solution"]     = caseinfo.Solution;
                row["Orgin"]        = caseinfo.Origin;
                //openDate = caseinfo.CreatedDate.ToShortDateString();
                openDate = (caseinfo.CreatedDate.Month < 10 ? "0" + caseinfo.CreatedDate.Month : "" + caseinfo.CreatedDate.Month)
                           + "/" + (caseinfo.CreatedDate.Day < 10 ? "0" + caseinfo.CreatedDate.Day : "" + caseinfo.CreatedDate.Day)
                           + "/" + ("" + caseinfo.CreatedDate.Year);

                row["OpenDate"] = openDate;
                Severity        = caseinfo.Priority.Split(' ');
                row["Severity"] = Severity[1];

                rank = 0;
                if (!String.IsNullOrEmpty(caseinfo.RankOrder))
                {
                    rank = int.Parse(caseinfo.RankOrder);
                }
                else if (!String.IsNullOrEmpty(caseinfo.ServicesRank))
                {
                    rank = int.Parse(caseinfo.ServicesRank);
                }
                else
                {
                    rank = 0;
                }

                row["Rank"] = rank;

                row["SalesforceID"] = caseinfo.CaseNumber;
                jiraKey             = (tempIssue != null ? tempIssue.JiraKey : "");
                jiraId         = (tempIssue != null ? tempIssue.JiraId : "");
                row["JiraKey"] = jiraKey;
                row["JiraID"]  = jiraId;
                row["Type"]    = (String.IsNullOrEmpty(caseinfo.InternalType) ? caseinfo.Type : "Production " + caseinfo.InternalType);
                row["Version"] = caseinfo.CurrentVersion;
                customer       = (caseinfo.Customer != null && !String.IsNullOrEmpty(caseinfo.Customer.Name) ? caseinfo.Customer.Name : (caseinfo.Account != null ? caseinfo.Account.Name : ""));
                if (customer.IndexOf("Accela") >= 0 && caseinfo.Account != null && !String.IsNullOrEmpty(caseinfo.Account.Name))
                {
                    customer = caseinfo.Account.Name;
                }

                row["Customer"]    = customer;
                row["Summary"]     = caseinfo.Subject;
                row["Description"] = caseinfo.Description;
                assignee           = (tempIssue != null ? tempIssue.Assignee : "");

                temComment = "";

                //lastModifiedDate = DateTime.Now.Year + "-" + (DateTime.Now.Month < 10 ? "0" + DateTime.Now.Month : "" + DateTime.Now.Month) + "-" + (DateTime.Now.Day < 10 ? "0" + DateTime.Now.Day : "" + DateTime.Now.Day);
                DateTime Yesterday = DateTime.Now.AddDays(-1);
                lastModifiedDate = Yesterday.Year + "-" + Yesterday.Month + "-" + Yesterday.Day;
                if (caseinfo.CaseComments != null && caseinfo.CaseComments.Records != null)
                {
                    row["CaseComments"] = caseinfo.CaseComments.Records;

                    CaseComment comment = caseinfo.CaseComments.Records[0];
                    //lastModifiedDate = comment.CreatedDate.Year + "-" + (comment.CreatedDate.Month < 10 ? "0" + comment.CreatedDate.Month : "" + comment.CreatedDate.Month) + "-" + (comment.CreatedDate.Day < 10 ? "0" + comment.CreatedDate.Day : "" + comment.CreatedDate.Day);
                    if (DateTime.Now.Year != comment.CreatedDate.Year &&
                        DateTime.Now.Month != comment.CreatedDate.Month &&
                        DateTime.Now.Day != comment.CreatedDate.Day)
                    {
                        lastModifiedDate = comment.CreatedDate.Year + "-" + comment.CreatedDate.Month + "-" + comment.CreatedDate.Day;
                    }

                    row["CaseComment"] = comment;

                    if (!String.IsNullOrEmpty(comment.CommentBody))
                    {
                        if (comment.CommentBody.ToUpper().IndexOf("BUB") > 0)
                        {
                            temComment += "This is a bug.<br>";
                        }

                        if (comment.CommentBody.ToUpper().IndexOf("DEFECT") > 0)
                        {
                            temComment += "This is a defect.<br>";
                        }
                    }

                    if (!String.IsNullOrEmpty(assignee) && comment.CommentBody.ToUpper().Contains(assignee.ToUpper()))
                    {
                    }
                    else
                    {
                        foreach (var key in Reviewers.Keys)
                        {
                            string value  = Reviewers[key];
                            string value1 = value.Replace('.', ' ');
                            if (comment.CommentBody.ToUpper().EndsWith(key.ToUpper()) ||
                                comment.CommentBody.ToUpper().EndsWith(value.ToUpper()) ||
                                comment.CommentBody.ToUpper().EndsWith(value1.ToUpper()))
                            {
                                assignee = Reviewers[key];
                                break;
                            }
                        }
                    }
                }

                row["Reviewer"]      = assignee;
                row["Comments"]      = temComment;
                reopenCount          = (caseinfo.CaseComments != null && caseinfo.CaseComments.Records != null ? caseinfo.CaseComments.Records.Count - 1 : 0);
                row["ReopenedCount"] = reopenCount;
                jiaStstus            = (tempIssue != null ? tempIssue.Status : "");
                row["JiraStatus"]    = jiaStstus;
                row["SFQueue"]       = caseinfo.Owner.Name;
                row["SFStatus"]      = caseinfo.Status;

                bool isCommentedToday = false;
                if (caseinfo.CaseComments != null && caseinfo.CaseComments.Records != null)
                {
                    CaseComment comment = caseinfo.CaseComments.Records[0];

                    isCommentedToday = (comment.CreatedDate.Year == DateTime.Now.Year && comment.CreatedDate.Month == DateTime.Now.Month && comment.CreatedDate.Day == DateTime.Now.Day ? true : false);
                }

                row["NextJiraStatus"] = AccelaCaseUtil.GetNextJIRAStatus(caseinfo.Owner.Name, caseinfo.Status, jiaStstus, isCommentedToday);
                row["SFLastModified"] = lastModifiedDate;
                if (tempIssue != null && String.IsNullOrEmpty(tempIssue.LastModified))
                {
                    System.Console.WriteLine("Last Modified Date is empty");
                }

                if (tempIssue != null && tempIssue.FixVersions != null)
                {
                    bool isFirst = true;
                    foreach (var fixVersion in tempIssue.FixVersions)
                    {
                        if (isFirst)
                        {
                            row["FixVersions"] = fixVersion;
                            isFirst            = false;
                        }
                        else
                        {
                            row["FixVersions"] += "," + fixVersion;
                        }
                    }
                }

                row["ReleaseInfo"]       = caseinfo.ReleaseInfo;
                row["TargetedRelease"]   = caseinfo.TargetedRelease;
                row["BZID"]              = caseinfo.BZID;
                row["InternalType"]      = caseinfo.InternalType;
                row["EngineeringStatus"] = caseinfo.EngineeringStatus;

                table.Rows.Add(row);
                index++;
            }

            grdCaseList.AutoGenerateColumns = false;
            grdCaseList.DataSource          = table;



            this.btnSendSummaryReport.Enabled = true;
            this.btnSyncWithJiraAndSF.Enabled = true;
        }
コード例 #16
0
        private async void btnScanCaseCrossProject_Click(object sender, EventArgs e)
        {
            this.btnScanCaseCrossProject.Enabled = false;

            string        caseIDs    = this.txtCaseIdList.Text;
            List <string> caseIdList = new List <string>();

            if (String.IsNullOrEmpty(caseIDs) || caseIDs.Trim().Length == 0)
            {
                // Show one error message "ERROR: Please enter case id"
                (this.MdiParent as MainForm).ShowStatusMessage("ERROR: Please enter case id");

                this.btnScanCaseCrossProject.Enabled = true;
                return;
            }
            else
            {
                (this.MdiParent as MainForm).ShowStatusMessage("");

                string[] caseIDArray = caseIDs.Split(',');
                Regex    reg         = new Regex(@"\d{2}ACC-\d{5}");
                foreach (string caseId in caseIDArray)
                {
                    if (reg.IsMatch(caseId))
                    {
                        if (!caseIdList.Contains(caseId.Trim()))
                        {
                            caseIdList.Add(caseId.Trim());
                        }
                    }
                    else
                    {
                        // Show one error message "ERROR: Invalid Format for XXXX"
                        (this.MdiParent as MainForm).ShowStatusMessage("ERROR: Invalid Format for " + caseId);

                        this.btnScanCaseCrossProject.Enabled = true;
                        return;
                    }
                }
            }

            List <string> projects = new List <string>();

            projects.Add("ENGSUPP");

            if (this.chkProjectAATHETA.Checked)
            {
                projects.Add("AATHETA");
            }

            if (this.chkProjectCAGAMMA.Checked)
            {
                projects.Add("CAGAMMA");
            }

            if (this.chkProjectPMA.Checked)
            {
                projects.Add("PMA");
            }

            if (projects.Count == 0)
            {
                MessageBox.Show("Please select one project at least.");
                return;
            }

            var GetCaseList = SalesforceProxy.GetCaseList(caseIdList);
            var caseListTmp = await GetCaseList;
            Dictionary <string, AccelaCase> AccelaCaseMapper = new Dictionary <string, AccelaCase>();

            foreach (var caseInfo in caseListTmp)
            {
                AccelaCaseMapper.Add(caseInfo.CaseNumber, caseInfo);
            }

            List <AccelaCaseStatusMapper> AccelaCaseStatusMapper = new List <AccelaCaseStatusMapper>();

            foreach (string caseId in caseIdList)
            {
                var GetIssueListBySalesforceId = JiraProxy.GetIssueListBySalesforceId(caseId, projects);
                var issueListTmp = await GetIssueListBySalesforceId;
                AccelaCaseStatusMapper accelaCaseStatus = new AccelaCaseStatusMapper();

                foreach (var issue in issueListTmp)
                {
                    string jiraKey = issue.key;
                    string status  = (issue != null ? issue.fields.status.name : "");

                    if (jiraKey.StartsWith("ENGSUPP-"))
                    {
                        if (String.IsNullOrEmpty(accelaCaseStatus.SalesforceID))
                        {
                            accelaCaseStatus.SalesforceID = issue.fields.customfield_10600;
                        }

                        accelaCaseStatus.SuppJiraID     = jiraKey;
                        accelaCaseStatus.SuppJiraStatus = status;
                        accelaCaseStatus.SuppAssignee   = (issue.fields.assignee != null ? issue.fields.assignee.emailAddress : "");

                        if (AccelaCaseMapper.ContainsKey(accelaCaseStatus.SalesforceID))
                        {
                            AccelaCase accelaCase = AccelaCaseMapper[accelaCaseStatus.SalesforceID];
                            accelaCaseStatus.SFQueue  = accelaCase.Owner.Name;
                            accelaCaseStatus.SFStatus = accelaCase.Status;
                            accelaCaseStatus.Summary  = accelaCase.Subject;
                        }
                    }
                }

                foreach (var issue in issueListTmp)
                {
                    string jiraKey = issue.key;
                    string status  = (issue != null ? issue.fields.status.name : "");

                    if (!jiraKey.StartsWith("ENGSUPP-"))
                    {
                        if (String.IsNullOrEmpty(accelaCaseStatus.SalesforceID))
                        {
                            accelaCaseStatus.SalesforceID = issue.fields.customfield_10600;

                            if (AccelaCaseMapper.ContainsKey(accelaCaseStatus.SalesforceID))
                            {
                                AccelaCase accelaCase = AccelaCaseMapper[accelaCaseStatus.SalesforceID];
                                accelaCaseStatus.SFQueue  = accelaCase.Owner.Name;
                                accelaCaseStatus.SFStatus = accelaCase.Status;
                                accelaCaseStatus.Summary  = accelaCase.Subject;
                            }
                        }

                        // Skipe some jira issue when their status is same already.
                        //if (status == accelaCaseStatus.SuppJiraStatus)
                        //{
                        //    continue;
                        //}

                        if (String.IsNullOrEmpty(accelaCaseStatus.LinkedJiraID))
                        {
                            accelaCaseStatus.LinkedJiraID       = jiraKey;
                            accelaCaseStatus.LinkedJiraStatus   = status;
                            accelaCaseStatus.LinkedJiraAssignee = (issue.fields.assignee != null ? issue.fields.assignee.emailAddress : "");

                            if (status != accelaCaseStatus.SuppJiraStatus)
                            {
                                accelaCaseStatus.NeedSync = true;
                            }
                        }
                        else
                        {
                            accelaCaseStatus.LinkedJiraID += "," + jiraKey;

                            if (status != "" && accelaCaseStatus.LinkedJiraStatus.IndexOf(status) < 0)
                            {
                                accelaCaseStatus.LinkedJiraStatus += "," + status;
                            }

                            if (status != accelaCaseStatus.SuppJiraStatus)
                            {
                                accelaCaseStatus.NeedSync = true;
                            }

                            if (issue.fields.assignee != null && accelaCaseStatus.LinkedJiraAssignee.IndexOf(issue.fields.assignee.emailAddress) < 0)
                            {
                                accelaCaseStatus.LinkedJiraAssignee += "," + issue.fields.assignee.emailAddress;
                            }
                        }
                    }
                }

                // All status is same.
                //if (!String.IsNullOrEmpty(accelaCaseStatus.LinkedJiraID))
                {
                    AccelaCaseStatusMapper.Add(accelaCaseStatus);
                }
            }

            DataTable table = new DataTable("Accela Case Status Report");

            table.Columns.Add("No", typeof(int));
            table.Columns.Add("SFID", typeof(string));
            table.Columns.Add("SuppJiraID", typeof(string));
            table.Columns.Add("SuppJiraAssignee", typeof(string));
            table.Columns.Add("LinkedJiraID", typeof(string));
            table.Columns.Add("LinkedJiraAssignee", typeof(string));
            table.Columns.Add("Summary", typeof(string));
            table.Columns.Add("SFQueue", typeof(string));
            table.Columns.Add("SFStatus", typeof(string));
            table.Columns.Add("SuppJiraStatus", typeof(string));
            table.Columns.Add("LinkedJiraStatus", typeof(string));
            table.Columns.Add("Sync", typeof(bool));

            int index = 0;

            foreach (var accelaCaseStatus in AccelaCaseStatusMapper)
            {
                DataRow row = table.NewRow();
                row["No"]                 = ++index;
                row["SFID"]               = accelaCaseStatus.SalesforceID;
                row["SuppJiraID"]         = accelaCaseStatus.SuppJiraID;
                row["SuppJiraAssignee"]   = accelaCaseStatus.SuppAssignee;
                row["LinkedJiraID"]       = accelaCaseStatus.LinkedJiraID;
                row["LinkedJiraAssignee"] = accelaCaseStatus.LinkedJiraAssignee;
                row["Summary"]            = accelaCaseStatus.Summary;
                row["SFQueue"]            = accelaCaseStatus.SFQueue;
                row["SFStatus"]           = accelaCaseStatus.SFStatus;
                row["SuppJiraStatus"]     = accelaCaseStatus.SuppJiraStatus;
                row["LinkedJiraStatus"]   = accelaCaseStatus.LinkedJiraStatus;
                row["Sync"]               = accelaCaseStatus.NeedSync;

                table.Rows.Add(row);
            }

            this.grdAccelaCaseStatus.AutoGenerateColumns = false;
            this.grdAccelaCaseStatus.DataSource          = table;

            this.btnScanCaseCrossProject.Enabled = true;
        }
コード例 #17
0
        public async Task <string> createSubTask(string summary, string issueKey)
        {
            IssueRef issueRef = new IssueRef();

            issueRef.key = issueKey;

            string description = "";

            if ("Review and Recreate(QA)" == summary)
            {
                description =
                    @"*{color:red}Notice{color}*: 
* {color:red}Just log QA effort spent on reviewing and recreating the assicaited production case{color}
* {color:red}Please DO NOT add comment in the sub task{color}

Following the below steps if you work on this sub task
# Assign this sub task to you
# Log all your effort spent on this case
# Post your comment in the parent jira ticket if neccessary
# Close this sub task when this case is recreated";
            }

            if ("Review and Recreate(Dev)" == summary)
            {
                description =
                    @"*{color:red}Notice{color}*: 
* {color:red}Just log Dev effort spent on reviewing and recreating the assicaited production case{color}
* {color:red}Please DO NOT add comment in the sub task{color}

Following the below steps if you work on this sub task
# Assign this sub task to you
# Log all your effort spent on this case
# Post your comment in the parent jira ticket if neccessary
# Close this sub task when this case is recreated";
            }

            if ("Research Root Cause" == summary)
            {
                description =
                    @"*{color:red}Notice{color}*: 
* {color:red}Just log Dev effort spent on researching root cause after the assicaited production case is recreated{color}
* {color:red}Please DO NOT add comment in the sub task{color}

Following the below steps if you work on this sub task
# Assign this sub task to you
# Log all your effort spent on this case
# Post your comment in the parent jira ticket if neccessary
# Close this sub task when this root cause is found";
            }

            // Code Fix(Dev)
            if ("Code Fix(Dev)" == summary)
            {
                description =
                    @"*{color:red}Notice{color}*: 
* {color:red}Just log Dev effort spent on solving the assicaited production bug{color}
* {color:red}Please DO NOT add comment in the sub task{color}

Following the below steps if you work on this sub task
# Assign this sub task to you
# Log all your effort spent on this case
# Post your comment in the parent jira ticket if neccessary
# Close this sub task when it is done";
            }

            // Write Test Case(QA)
            if ("Write Test Case(QA)" == summary)
            {
                description =
                    @"*{color:red}Notice{color}*: 
* {color:red}Just log QA effort spent on writing test case for the assicaited production bug{color}
* {color:red}Please DO NOT add comment in the sub task{color}

Following the below steps if you work on this sub task
# Assign this sub task to you
# Log all your effort spent on this case
# Post your comment in the parent jira ticket if neccessary
# Close this sub task when it is done";
            }

            // Execute Test Case(QA)
            if ("Execute Test Case(QA)" == summary)
            {
                description =
                    @"*{color:red}Notice{color}*: 
* {color:red}Just log QA effort spent on executing test case for the assicaited production bug{color}
* {color:red}Please DO NOT add comment in the sub task{color}

Following the below steps if you work on this sub task
# Assign this sub task to you
# Log all your effort spent on this case
# Post your comment in the parent jira ticket if neccessary
# Close this sub task when it is done";
            }

            // Write Release Notes(Dev)
            if ("Write Release Notes(Dev)" == summary)
            {
                description =
                    @"*{color:red}Notice{color}*: 
* {color:red}Just log Dev effort spent on writing release notes for the assicaited production bug{color}
* {color:red}Please DO NOT add comment in the sub task{color}

Following the below steps if you work on this sub task
# Assign this sub task to you
# Log all your effort spent on this case
# Post your comment in the parent jira ticket if neccessary
# Close this sub task when it is done";
            }

            // Review Release Notes(QA)
            if ("Review Release Notes(QA)" == summary)
            {
                description =
                    @"*{color:red}Notice{color}*: 
* {color:red}Just log QA effort spent on reviewing release notes for the assicaited production bug{color}
* {color:red}Please DO NOT add comment in the sub task{color}

Following the below steps if you work on this sub task
# Assign this sub task to you
# Log all your effort spent on this case
# Post your comment in the parent jira ticket if neccessary
# Close this sub task when it is done";
            }

            var issue = await JiraProxy.CreateSubTask(summary, description, issueRef);

            return(issue.key);
        }
コード例 #18
0
        private async void btnCheckJiraKey_Click(object sender, EventArgs e)
        {
            this.btnCheckJiraKey.Enabled = false;

            string jiraKey = this.txtJiraKey.Text;

            IssueRef issueRef = new IssueRef();

            issueRef.key = jiraKey;

            var issue = await JiraProxy.LoadIssue(issueRef);

            if (issue == null || issue.fields == null)
            {
                return;
            }

            this.txtAssignee.Text   = issue.fields.assignee.name;
            this.txtAssigneeQA.Text = issue.fields.customfield_11702 == null ? "" : issue.fields.customfield_11702.name;

            Dictionary <string, string> SubTaskMaper = new Dictionary <string, string>();

            foreach (var subTask in issue.fields.subtasks)
            {
                if (subTask != null && subTask.fields != null && subTask.fields.issuetype.subtask == true)
                {
                    if (!SubTaskMaper.ContainsKey(subTask.fields.summary))
                    {
                        SubTaskMaper.Add(subTask.fields.summary, subTask.key);
                    }
                }
            }

            if ("Case".Equals(issue.fields.issueType.name, StringComparison.InvariantCultureIgnoreCase))
            {
                //this.btnCreateSubTask.Enabled = true;
                //this.chkReviewAndRecreateQA.Enabled = true;
                //this.chkReviewAndRecreateDev.Enabled = true;
                //this.chkResearchRootCause.Enabled = true;

                this.chkCodeFix.Enabled = false;
                //this.chkWriteTestCase.Enabled = false;
                //this.chkExecuteTestCase.Enabled = false;
                //this.chkWriteReleaseNotes.Enabled = false;
                //this.chkReviewReleaseNotes.Enabled = false;

                foreach (string key in SubTaskMaper.Keys)
                {
                    // Review and Recreate(QA)
                    if (this.chkReviewAndRecreateQA.Text == key)
                    {
                        //this.chkReviewAndRecreateQA.Enabled = false;
                        this.txtReviewAndRecreateQASubTaskKey.Text = SubTaskMaper[key];

                        var assignee = await JiraProxy.GetAssigneeByJiraKey(SubTaskMaper[key]);

                        this.txtReviewAndRecreateQAAssignee.Text = assignee;
                    }

                    // Review and Recreate(Dev)
                    if (this.chkReviewAndRecreateDev.Text == key)
                    {
                        //this.chkReviewAndRecreateDev.Enabled = false;
                        this.txtReviewAndRecreateDevSubTaskKey.Text = SubTaskMaper[key];

                        var assignee = await JiraProxy.GetAssigneeByJiraKey(SubTaskMaper[key]);

                        this.txtReviewAndRecreateDevAssignee.Text = assignee;
                    }

                    // Research Root Cause
                    if (this.chkResearchRootCause.Text == key)
                    {
                        //this.chkResearchRootCause.Enabled = false;
                        this.txtResearchRootCauseSubTaskKey.Text = SubTaskMaper[key];

                        var assignee = await JiraProxy.GetAssigneeByJiraKey(SubTaskMaper[key]);

                        this.txtResearchRootCauseAssignee.Text = assignee;
                    }
                }
            }


            if ("Bug".Equals(issue.fields.issueType.name, StringComparison.InvariantCultureIgnoreCase))
            {
                this.btnCreateSubTask.Enabled        = true;
                this.chkReviewAndRecreateQA.Enabled  = false;
                this.chkReviewAndRecreateDev.Enabled = false;
                this.chkResearchRootCause.Enabled    = false;

                this.chkCodeFix.Enabled            = true;
                this.chkWriteTestCase.Enabled      = true;
                this.chkExecuteTestCase.Enabled    = true;
                this.chkWriteReleaseNotes.Enabled  = true;
                this.chkReviewReleaseNotes.Enabled = true;

                foreach (string key in SubTaskMaper.Keys)
                {
                    // Code Fix(Dev)
                    if (this.chkCodeFix.Text == key)
                    {
                        this.chkCodeFix.Enabled        = false;
                        this.txtCodeFixSubTaskKey.Text = SubTaskMaper[key];
                    }

                    // Write Test Case(QA)
                    if (this.chkWriteTestCase.Text == key)
                    {
                        this.chkWriteTestCase.Enabled        = false;
                        this.txtWriteTestCaseSubTaskKey.Text = SubTaskMaper[key];
                    }

                    // Execute Test Case(QA)
                    if (this.chkExecuteTestCase.Text == key)
                    {
                        this.chkExecuteTestCase.Enabled        = false;
                        this.txtExecuteTestCaseSubTaskKey.Text = SubTaskMaper[key];
                    }

                    // Write Release Notes(Dev)
                    if (this.chkWriteReleaseNotes.Text == key)
                    {
                        this.chkWriteReleaseNotes.Enabled        = false;
                        this.txtWriteReleaseNotesSubTaskKey.Text = SubTaskMaper[key];
                    }

                    // Review Release Notes(QA)
                    if (this.chkReviewReleaseNotes.Text == key)
                    {
                        this.chkReviewReleaseNotes.Enabled        = false;
                        this.txtReviewReleaseNotesSubTaskKey.Text = SubTaskMaper[key];
                    }
                }
            }

            this.btnCreateSubTask.Enabled = true;
            this.btnCheckJiraKey.Enabled  = true;
        }
コード例 #19
0
        private async void btnSync_Click(object sender, EventArgs e)
        {
            this.btnSync.Enabled = false;

            DateTime from      = this.dtpFrom.Value;
            DateTime to        = this.dtpTo.Value;
            var      issueList = await JiraProxy.GetUpdatedIssueListByAssigneeList(from, to, GetSupportTeamMembers());

            if (issueList == null || issueList.Count == 0)
            {
                this.btnSync.Enabled = true;
                return;
            }

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

            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;
                 */

                string            issueType         = issue.fields.issueType.name;
                IndividualWorkLog individualWorkLog = new IndividualWorkLog();

                if ("Sub-task".Equals(issueType, StringComparison.InvariantCultureIgnoreCase))
                {
                    /*
                     * issue.fields.assignee.name = "*****@*****.**"
                     * issue.fields.assignee.emailAddress = "*****@*****.**"
                     * issue.fields.assignee.displayName = "Gordon Chen"
                     * issue.fields.issueType.name = "Sub-task"
                     * issue.fields.issueType.subtask = true
                     * issue.fields.parent.key = "ENGSUPP-14215"
                     * issue.fields.parent.fields.summary = "Unable to delete logs in Batch Engine"
                     * issue.fields.parent.fields.status.name = "In Progress"
                     */
                    var workLogs = await JiraProxy.GetWorklogs(issue);

                    if (workLogs != null && workLogs.Count > 0)
                    {
                        foreach (var worklog in workLogs)
                        {
                            if (DateTime.Compare(worklog.created, from) >= 0 && DateTime.Compare(worklog.created, to) <= 0)
                            {
                                individualWorkLog                  = new IndividualWorkLog();
                                individualWorkLog.subTaskKey       = issue.key;
                                individualWorkLog.subTaskSummary   = issue.fields.summary;
                                individualWorkLog.subTaskAssignee  = issue.fields.assignee.displayName;
                                individualWorkLog.jiraIssueKey     = issue.fields.parent.key;
                                individualWorkLog.jiraIssueSummary = issue.fields.parent.fields.summary;

                                individualWorkLog.assignee             = worklog.author.displayName;
                                individualWorkLog.assigneeEmailAddress = worklog.author.emailAddress;
                                individualWorkLog.timeSpent            = worklog.timeSpent;
                                individualWorkLog.comment = worklog.comment.Replace("\r\n", ";");

                                if (!IndividualWorkLogs.ContainsKey(individualWorkLog.jiraIssueKey))
                                {
                                    IndividualWorkLogs.Add(individualWorkLog.jiraIssueKey, new List <IndividualWorkLog>());
                                }
                                List <IndividualWorkLog> individualWorkLogList = IndividualWorkLogs[individualWorkLog.jiraIssueKey];
                                individualWorkLogList.Add(individualWorkLog);
                                IndividualWorkLogs[individualWorkLog.jiraIssueKey] = individualWorkLogList;
                            }
                        }
                    }
                    else
                    {
                        System.Console.WriteLine("No work log on " + issue.key);
                    }
                }
                else
                {
                    var workLogs = await JiraProxy.GetWorklogs(issue);

                    if (workLogs != null && workLogs.Count > 0)
                    {
                        foreach (var worklog in workLogs)
                        {
                            System.Console.WriteLine("Work Log are created on " + worklog.created);

                            if (DateTime.Compare(worklog.created, from) >= 0 && DateTime.Compare(worklog.created, to) <= 0)
                            {
                                individualWorkLog = new IndividualWorkLog();
                                //individualWorkLog.subTaskKey = issue.fields.parent.key;
                                //individualWorkLog.subTaskSummary = issue.fields.summary;
                                //individualWorkLog.subTaskAssignee = issue.fields.assignee.displayName;
                                individualWorkLog.jiraIssueKey     = issue.key;
                                individualWorkLog.jiraIssueSummary = issue.fields.summary;

                                individualWorkLog.assignee             = worklog.author.displayName;
                                individualWorkLog.assigneeEmailAddress = worklog.author.emailAddress;
                                individualWorkLog.timeSpent            = worklog.timeSpent;
                                individualWorkLog.comment = worklog.comment.Replace("\r\n", ";");

                                if (!IndividualWorkLogs.ContainsKey(individualWorkLog.jiraIssueKey))
                                {
                                    IndividualWorkLogs.Add(individualWorkLog.jiraIssueKey, new List <IndividualWorkLog>());
                                }
                                List <IndividualWorkLog> individualWorkLogList = IndividualWorkLogs[individualWorkLog.jiraIssueKey];
                                individualWorkLogList.Add(individualWorkLog);
                                IndividualWorkLogs[individualWorkLog.jiraIssueKey] = individualWorkLogList;
                            }
                            else
                            {
                                System.Console.WriteLine("Work Log cannot be added.");
                            }
                        }
                    }
                    else
                    {
                        System.Console.WriteLine("No work log on " + issue.key);
                    }
                }
            }

            if (IndividualWorkLogs.Count == 0)
            {
                this.btnSync.Enabled = true;
                return;
            }

            DataTable table = new DataTable("Daily Work Log Report");

            table.Columns.Add("No", typeof(int));
            table.Columns.Add("Name", typeof(string));
            table.Columns.Add("EmailAddress", typeof(string));
            table.Columns.Add("Effort", typeof(string));
            table.Columns.Add("SubTaskID", typeof(string));
            table.Columns.Add("SubTaskSummary", typeof(string));
            table.Columns.Add("SubTaskAssignee", typeof(string));
            table.Columns.Add("SubTaskComment", typeof(string));
            table.Columns.Add("JiraKey", typeof(string));
            table.Columns.Add("JiraSummary", typeof(string));

            int index = 1;

            foreach (string key in IndividualWorkLogs.Keys)
            {
                List <IndividualWorkLog> individualWorkLogList = IndividualWorkLogs[key];
                foreach (var workLog in individualWorkLogList)
                {
                    DataRow row = table.NewRow();
                    row["No"]              = index;
                    row["Name"]            = workLog.assignee;
                    row["EmailAddress"]    = workLog.assigneeEmailAddress;
                    row["Effort"]          = workLog.timeSpent;
                    row["SubTaskID"]       = workLog.subTaskKey;
                    row["SubTaskSummary"]  = workLog.subTaskSummary;
                    row["SubTaskAssignee"] = workLog.subTaskAssignee;
                    row["SubTaskComment"]  = workLog.comment;
                    row["JiraKey"]         = workLog.jiraIssueKey;
                    row["JiraSummary"]     = workLog.jiraIssueSummary;

                    table.Rows.Add(row);
                    index++;
                }
            }

            dgvWorkLogReport.AutoGenerateColumns = false;
            dgvWorkLogReport.DataSource          = table;
            this.btnSync.Enabled = true;
        }
コード例 #20
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;
        }
コード例 #21
0
        private async void btnScanCrossProjects_Click(object sender, EventArgs e)
        {
            this.btnScanCrossProjects.Enabled = false;

            DateTime startDate = this.dtpStartDate.Value;
            DateTime endDate   = this.dtpEndDate.Value;

            if (endDate < startDate)
            {
                MessageBox.Show("End Date must be greater than Start Date.");
                return;
            }

            List <string> projects = new List <string>();

            if (this.chkProjectAATHETA.Checked)
            {
                projects.Add("AATHETA");
            }

            if (this.chkProjectCAGAMMA.Checked)
            {
                projects.Add("CAGAMMA");
            }

            if (this.chkProjectENGSUPP.Checked)
            {
                projects.Add("ENGSUPP");
            }

            if (this.chkProjectPMA.Checked)
            {
                projects.Add("PMA");
            }

            if (projects.Count == 0)
            {
                MessageBox.Show("Please select one project at least.");
                return;
            }

            var GetCaseListFromCrossProjects = JiraProxy.GetCaseListFromCrossProjects(startDate, endDate, projects);
            var issueListTmp = await GetCaseListFromCrossProjects;

            List <string> caseIdList = new List <string>();

            foreach (var issueInfo in issueListTmp)
            {
                string   caseIds     = issueInfo.fields.customfield_10600;
                String[] caseIDArray = caseIds.Split(',');

                Regex reg = new Regex(@"\d{2}ACC-\d{5}");
                foreach (string caseId in caseIDArray)
                {
                    if (reg.IsMatch(caseId))
                    {
                        if (!caseIdList.Contains(caseId.Trim()))
                        {
                            caseIdList.Add(caseId.Trim());
                        }
                    }
                }
            }

            string caseIdString = "";
            bool   isFirstOne   = true;

            foreach (string caseId in caseIdList)
            {
                if (isFirstOne)
                {
                    isFirstOne   = false;
                    caseIdString = caseId;
                }
                else
                {
                    caseIdString += "," + caseId;
                }
            }


            this.txtCaseIdList.Text = caseIdString;

            this.btnScanCrossProjects.Enabled = true;
        }
コード例 #22
0
        private async void btnSync_Click(object sender, EventArgs e)
        {
            this.btnSync.Enabled  = false;
            this.btnMerge.Enabled = false;

            // 1, Construct one case list from the specified case list
            // 1.1 Check if the case list formate is valid or not
            // 1.2 Construct one case list
            string        caseIDs    = this.txtInputCaseList.Text;
            List <string> caseIdList = new List <string>();

            if (String.IsNullOrEmpty(caseIDs) || caseIDs.Trim().Length == 0)
            {
                // Show one error message "ERROR: Please enter case id"
                (this.MdiParent as MainForm).ShowStatusMessage("ERROR: Please enter case id");

                this.btnSync.Enabled  = true;
                this.btnMerge.Enabled = false;

                return;
            }
            else
            {
                (this.MdiParent as MainForm).ShowStatusMessage("");

                string[] caseIDArray = caseIDs.Split(',');
                Regex    reg         = new Regex(@"\d{2}ACC-\d{5}");
                foreach (string caseId in caseIDArray)
                {
                    if (reg.IsMatch(caseId))
                    {
                        if (!caseIdList.Contains(caseId.Trim()))
                        {
                            caseIdList.Add(caseId.Trim());
                        }
                    }
                    else
                    {
                        // Show one error message "ERROR: Invalid Format for XXXX"
                        (this.MdiParent as MainForm).ShowStatusMessage("ERROR: Invalid Format for " + caseId);

                        this.btnSync.Enabled  = true;
                        this.btnMerge.Enabled = false;

                        return;
                    }
                }
            }

            if (caseIdList.Count == 0)
            {
                // Show one error message "ERROR: Please enter case id"
                (this.MdiParent as MainForm).ShowStatusMessage("ERROR: Please enter case id");

                this.btnSync.Enabled  = true;
                this.btnMerge.Enabled = false;

                return;
            }

            Dictionary <string, Dictionary <string, AccelaAttachmentMapper> > AttachmentMapper = new Dictionary <string, Dictionary <string, AccelaAttachmentMapper> >();
            var GetCaseAttachmentInfoByID = SalesforceProxy.GetCaseAttachmentInfoByID(caseIdList);
            var GetJiraIssueList          = JiraProxy.GetIssueList(caseIdList);

            var CaseAttachments = await GetCaseAttachmentInfoByID;

            foreach (AccelaCase accelaCase in CaseAttachments)
            {
                string caseId     = accelaCase.Id;
                string caseNumber = accelaCase.CaseNumber;

                if (!AttachmentMapper.ContainsKey(caseNumber))
                {
                    AttachmentMapper.Add(caseNumber, new Dictionary <string, AccelaAttachmentMapper>());
                }

                if (accelaCase.CaseAttachments != null && accelaCase.CaseAttachments.Records.Count > 0)
                {
                    Dictionary <string, AccelaAttachmentMapper> CaseAttachmentDic = AttachmentMapper[caseNumber];

                    foreach (CaseAttachment caseAttachment in accelaCase.CaseAttachments.Records)
                    {
                        string fileName = caseAttachment.Name;

                        var GetUserInfoById = SalesforceProxy.GetUserInfoById(caseAttachment.LastModifiedById);
                        var UserInfo        = await GetUserInfoById;

                        if (!CaseAttachmentDic.ContainsKey(fileName))
                        {
                            AccelaAttachmentMapper accelaAttachmentMapper = new AccelaAttachmentMapper();

                            accelaAttachmentMapper.IsMerged           = true;
                            accelaAttachmentMapper.CaseId             = caseId;
                            accelaAttachmentMapper.CaseNumber         = caseNumber;
                            accelaAttachmentMapper.CaseFileName       = fileName;
                            accelaAttachmentMapper.CaseAttchmentId    = caseAttachment.Id;
                            accelaAttachmentMapper.CaseAttachmentType = caseAttachment.ContentType;
                            accelaAttachmentMapper.CaseIsPrivate      = caseAttachment.IsPrivate;
                            accelaAttachmentMapper.UploadedBy         = UserInfo.Name;
                            accelaAttachmentMapper.UploadDate         = caseAttachment.LastModifiedDate;

                            CaseAttachmentDic.Add(fileName, accelaAttachmentMapper);
                        }
                    }
                }
            }

            var JiraIssueList = await GetJiraIssueList;

            foreach (Issue issue in JiraIssueList)
            {
                IssueRef issueRef = new IssueRef();
                issueRef.id  = issue.id;
                issueRef.key = issue.key;

                string caseNumber = issue.fields.customfield_10600;
                if (!AttachmentMapper.ContainsKey(caseNumber))
                {
                    AttachmentMapper.Add(caseNumber, new Dictionary <string, AccelaAttachmentMapper>());
                }

                Dictionary <string, AccelaAttachmentMapper> CaseAttachmentDic = AttachmentMapper[caseNumber];
                if (CaseAttachmentDic != null)
                {
                    foreach (AccelaAttachmentMapper accelaAttachmentMapper in CaseAttachmentDic.Values)
                    {
                        accelaAttachmentMapper.JiraId  = issue.id;
                        accelaAttachmentMapper.JiraKey = issue.key;
                    }
                }

                var GetAttachments     = JiraProxy.GetAttachments(issueRef);
                var JiraAttachmentList = await GetAttachments;

                if (JiraAttachmentList != null && JiraAttachmentList.Count > 0)
                {
                    foreach (Attachment attachment in JiraAttachmentList)
                    {
                        string fileName = attachment.filename;
                        AccelaAttachmentMapper accelaAttachmentMapper = null;
                        if (CaseAttachmentDic.ContainsKey(fileName))
                        {
                            accelaAttachmentMapper          = CaseAttachmentDic[fileName];
                            accelaAttachmentMapper.IsMerged = false;
                        }
                        else
                        {
                            accelaAttachmentMapper = new AccelaAttachmentMapper();
                            //accelaAttachmentMapper.CaseId = caseId;
                            accelaAttachmentMapper.CaseNumber = caseNumber;
                        }

                        accelaAttachmentMapper.JiraId           = issue.id;
                        accelaAttachmentMapper.JiraKey          = issue.key;
                        accelaAttachmentMapper.JiraFileName     = fileName;
                        accelaAttachmentMapper.JiraAttachmentId = attachment.id;
                        //CaseAttachmentDic.Add(fileName, accelaAttachmentMapper);
                        CaseAttachmentDic[fileName] = accelaAttachmentMapper;
                    }
                }
            }

            DataTable table = new DataTable("Merge Attachment");

            table.Columns.Add("IsMerged", typeof(bool));
            table.Columns.Add("CaseFileName", typeof(string));
            table.Columns.Add("CaseId", typeof(string));
            table.Columns.Add("CaseNumber", typeof(string));
            table.Columns.Add("CaseAttchmentId", typeof(string));
            table.Columns.Add("CaseAttachmentType", typeof(string));
            table.Columns.Add("CaseIsPrivate", typeof(bool));
            table.Columns.Add("UploadDate", typeof(string));
            table.Columns.Add("UploadedBy", typeof(string));
            table.Columns.Add("JiraFileName", typeof(string));
            table.Columns.Add("JiraId", typeof(string));
            table.Columns.Add("JiraKey", typeof(string));
            table.Columns.Add("JiraAttachmentId", typeof(string));

            foreach (string caseNumber in AttachmentMapper.Keys)
            {
                Dictionary <string, AccelaAttachmentMapper> CaseAttachmentDic = AttachmentMapper[caseNumber];
                foreach (AccelaAttachmentMapper accelaAttachMapper in CaseAttachmentDic.Values)
                {
                    DataRow row = table.NewRow();
                    row["IsMerged"]           = accelaAttachMapper.IsMerged;
                    row["CaseFileName"]       = accelaAttachMapper.CaseFileName;
                    row["CaseId"]             = accelaAttachMapper.CaseId;
                    row["CaseNumber"]         = accelaAttachMapper.CaseNumber;
                    row["CaseAttchmentId"]    = accelaAttachMapper.CaseAttchmentId;
                    row["CaseAttachmentType"] = accelaAttachMapper.CaseAttachmentType;
                    row["CaseIsPrivate"]      = accelaAttachMapper.CaseIsPrivate;
                    row["UploadDate"]         = accelaAttachMapper.UploadDate.ToShortDateString();
                    row["UploadedBy"]         = accelaAttachMapper.UploadedBy;
                    row["JiraFileName"]       = accelaAttachMapper.JiraFileName;
                    row["JiraId"]             = accelaAttachMapper.JiraId;
                    row["JiraKey"]            = accelaAttachMapper.JiraKey;
                    row["JiraAttachmentId"]   = accelaAttachMapper.JiraAttachmentId;

                    table.Rows.Add(row);
                }
            }

            DataView dataTableView = table.DefaultView;

            dataTableView.Sort = "CaseNumber ASC, UploadDate ASC";
            table = dataTableView.ToTable();

            this.dgdMergeFileList.AutoGenerateColumns = false;
            this.dgdMergeFileList.DataSource          = table;

            this.btnSync.Enabled  = true;
            this.btnMerge.Enabled = true;
        }
コード例 #23
0
        private async void btnSync_Click(object sender, EventArgs e)
        {
            this.btnSync.Enabled = false;

            try
            {
                DateTime from     = this.dtpFrom.Value;
                DateTime to       = this.dtpTo.Value;
                string   userName = this.txtUser.Text;
                string   password = this.txtPassword.Text;

                string MEOOption = this.cmbMEOOptions.SelectedValue as string;
                string status    = this.cmbSubTaskStatusOptions.SelectedValue as string;

                if (String.IsNullOrEmpty(userName) || userName.Trim().Length == 0 || String.IsNullOrEmpty(password) || password.Trim().Length == 0)
                {
                    MessageBox.Show("User Name and Password cannot be empty.");
                    this.btnSync.Enabled = true;
                    return;
                }

                List <string> subTaskStatusList = new List <string>();
                if (String.IsNullOrEmpty(status) && status.Trim().Length > 0 && status == "Empty")
                {
                    subTaskStatusList.Add(status);
                }

                List <string> meoOptions = new List <string>();
                if (!String.IsNullOrEmpty(MEOOption) && MEOOption.Trim().Length > 0 && MEOOption != "Empty")
                {
                    meoOptions.Add(MEOOption);
                }

                var issues = await JiraProxy.GetUpdatedIssueListByTimeslot(userName, password, from, to, subTaskStatusList, meoOptions);

                /*
                 * issue.fields.assignee.name = "*****@*****.**"
                 * issue.fields.assignee.emailAddress = "*****@*****.**"
                 * issue.fields.assignee.displayName = "Gordon Chen"
                 * issue.fields.issueType.name = "Sub-task"
                 * issue.fields.issueType.subtask = true
                 * issue.fields.parent.key = "ENGSUPP-14215"
                 * issue.fields.parent.fields.summary = "Unable to delete logs in Batch Engine"
                 * issue.fields.parent.fields.status.name = "In Progress"
                 * */

                string defaultMEO = this.cmbDefautMEO.SelectedValue as string;
                if (defaultMEO == "Empty")
                {
                    defaultMEO = "";
                }

                List <SubTask> SubTaskList = new List <SubTask>();
                foreach (var issue in issues)
                {
                    SubTask subTask = new SubTask();
                    subTask.SubTaskKey            = issue.key;
                    subTask.SubTaskSummary        = issue.fields.summary;
                    subTask.SubTaskStatus         = issue.fields.status.name;
                    subTask.SubTaskAssignee       = issue.fields.assignee.displayName;
                    subTask.MEO                   = issue.fields.customfield_14101 != null ? issue.fields.customfield_14101.value : defaultMEO;
                    subTask.TimeSpent             = "" + Math.Round((double)issue.fields.timespent / 3600, 2) + "h";
                    subTask.AssociatedJirakey     = issue.fields.parent.key;
                    subTask.AssociatedJiraSummary = issue.fields.parent.fields.summary;

                    SubTaskList.Add(subTask);
                }

                DataTable table = new DataTable("M.E.O Report");
                table.Columns.Add("No", typeof(int));
                table.Columns.Add("SubTaskKey", typeof(string));
                table.Columns.Add("SubTaskSummary", typeof(string));
                table.Columns.Add("SubTaskStatus", typeof(string));
                table.Columns.Add("SubTaskAssignee", typeof(string));
                table.Columns.Add("MEO", typeof(string));
                table.Columns.Add("TimeSpent", typeof(string));
                table.Columns.Add("AssociatedJirakey", typeof(string));
                table.Columns.Add("AssociatedJiraSummary", typeof(string));

                int index = 1;
                foreach (var subTask in SubTaskList)
                {
                    DataRow row = table.NewRow();
                    row["No"]                    = index;
                    row["SubTaskKey"]            = subTask.SubTaskKey;
                    row["SubTaskSummary"]        = subTask.SubTaskSummary;
                    row["SubTaskStatus"]         = subTask.SubTaskStatus;
                    row["SubTaskAssignee"]       = subTask.SubTaskAssignee;
                    row["MEO"]                   = subTask.MEO;
                    row["TimeSpent"]             = subTask.TimeSpent;
                    row["AssociatedJirakey"]     = subTask.AssociatedJirakey;
                    row["AssociatedJiraSummary"] = subTask.AssociatedJiraSummary;

                    table.Rows.Add(row);
                    index++;
                }

                this.dgvSubTaskTable.AutoGenerateColumns = false;
                this.dgvSubTaskTable.DataSource          = table;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            this.btnSync.Enabled = true;
        }
コード例 #24
0
        private async void btnSyncWithJIRA_Click(object sender, EventArgs e)
        {
            this.btnSendNotificationEmail.Enabled = false;
            this.btnSyncWithJIRA.Enabled          = false;

            // 1, Construct one case list from the specified case list
            // 1.1 Check if the case list formate is valid or not
            // 1.2 Construct one case list
            string        caseIDs    = this.txtCaseIDList.Text;
            List <string> caseIdList = new List <string>();

            if (String.IsNullOrEmpty(caseIDs) || caseIDs.Trim().Length == 0)
            {
                // Show one error message "ERROR: Please enter case id"
                (this.MdiParent as MainForm).ShowStatusMessage("ERROR: Please enter case id");
                return;
            }
            else
            {
                (this.MdiParent as MainForm).ShowStatusMessage("");

                string[] caseIDArray = caseIDs.Split(',');
                Regex    reg         = new Regex(@"\d{2}ACC-\d{5}");
                foreach (string caseId in caseIDArray)
                {
                    if (reg.IsMatch(caseId))
                    {
                        caseIdList.Add(caseId.Trim());
                    }
                    else
                    {
                        // Show one error message "ERROR: Invalid Format for XXXX"
                        (this.MdiParent as MainForm).ShowStatusMessage("ERROR: Invalid Format for " + caseId);
                        return;
                    }
                }
            }

            var GetCaseList  = SalesforceProxy.GetCaseList(caseIdList);
            var GetIssueList = JiraProxy.GetIssueList(caseIdList);

            var caseList  = await GetCaseList;
            var issueList = await GetIssueList;

            Dictionary <string, AccelaIssueCaseMapper> JiraMapping = new Dictionary <string, AccelaIssueCaseMapper>();

            foreach (var issue in issueList)
            {
                if (!JiraMapping.ContainsKey(issue.fields.customfield_10600))
                {
                    AccelaIssueCaseMapper accelaIssueCaseMapper = new AccelaIssueCaseMapper();
                    accelaIssueCaseMapper.CaseNumber   = issue.fields.customfield_10600;
                    accelaIssueCaseMapper.Assignee     = (issue.fields.assignee == null ? "" : issue.fields.assignee.displayName);
                    accelaIssueCaseMapper.JiraId       = issue.id;
                    accelaIssueCaseMapper.JiraKey      = issue.key;
                    accelaIssueCaseMapper.LastModified = issue.fields.customfield_10903;
                    accelaIssueCaseMapper.Status       = issue.fields.status.name;
                    accelaIssueCaseMapper.HotCase      = issue.fields.labels.Contains("HotCase");
                    accelaIssueCaseMapper.JiraLabels   = issue.fields.labels;

                    JiraMapping.Add(accelaIssueCaseMapper.CaseNumber, accelaIssueCaseMapper);
                }
            }

            DataTable table = new DataTable("Daily Report");

            table.Columns.Add("ID", typeof(string));
            table.Columns.Add("No", typeof(int));
            table.Columns.Add("HotCase", typeof(bool));
            table.Columns.Add("JiraLabels", typeof(List <string>));
            table.Columns.Add("ProductForUI", typeof(string));
            table.Columns.Add("Product", typeof(string));
            table.Columns.Add("Solution", typeof(string));
            table.Columns.Add("Orgin", typeof(string));
            table.Columns.Add("OpenDate", typeof(string));
            table.Columns.Add("Severity", typeof(string));
            table.Columns.Add("SalesforceID", typeof(string));
            table.Columns.Add("JiraID", typeof(string));
            table.Columns.Add("JiraKey", typeof(string));
            table.Columns.Add("Type", typeof(string));
            table.Columns.Add("Version", typeof(string));
            table.Columns.Add("Customer", typeof(string));
            table.Columns.Add("Summary", typeof(string));
            table.Columns.Add("Description", typeof(string));
            table.Columns.Add("Reviewer", typeof(string));
            table.Columns.Add("Comments", typeof(string));
            table.Columns.Add("ReopenedCount", typeof(string));
            table.Columns.Add("JiraStatus", typeof(string));
            table.Columns.Add("NextJiraStatus", typeof(string));
            table.Columns.Add("SFQueue", typeof(string));
            table.Columns.Add("SFStatus", typeof(string));
            table.Columns.Add("SFLastModified", typeof(string));
            table.Columns.Add("CaseComment", typeof(CaseComment));

            Dictionary <string, string> Reviewers = new Dictionary <string, string>();

            Reviewers.Add("Alvin", "Alvin.Li");
            Reviewers.Add("Rick", "Rick.Liu");
            Reviewers.Add("Weber", "Weber.Yan");
            Reviewers.Add("John", "John.Huang");
            Reviewers.Add("Hyman", "Hyman.Zhang");
            Reviewers.Add("Star", "Star.Li");
            Reviewers.Add("Lex", "Lex.Wu");
            Reviewers.Add("Bass", "Bass.Yang");
            Reviewers.Add("Mandy", "Mandy.Zhou");
            Reviewers.Add("Linda", "Linda.Xiao");
            Reviewers.Add("Abel", "Abel.Yu");
            Reviewers.Add("Matt", "Matt.Ao");
            Reviewers.Add("Peter", "Peter.Peng");
            Reviewers.Add("Sandy", "Sandy.Zheng");
            Reviewers.Add("Likko", "Likko.Zhang");
            Reviewers.Add("Mina", "Mina.Xiong");
            Reviewers.Add("Jessy", "Jessy.Zhang");
            Reviewers.Add("Louis", "Louis.He");
            Reviewers.Add("Leo", "Leo.Liu");
            Reviewers.Add("Adger", "Adger.Chen");
            Reviewers.Add("Tim", "Tim.Liu");
            Reviewers.Add("Mia", "Mia.Huang");
            Reviewers.Add("Jessie", "Jessie.Zhang");
            Reviewers.Add("William", "William.Wang");
            Reviewers.Add("Cheng", "Cheng.Xu");
            Reviewers.Add("Gordon", "Gordon.Chen");
            Reviewers.Add("Tracy", "Tracy.Xiang");

            int index = 1;
            AccelaIssueCaseMapper tempIssue = null;
            string openDate    = "";
            string jiraKey     = "";
            string jiraId      = "";
            string customer    = "";
            string assignee    = "";
            int    reopenCount = 0;
            string jiaStstus   = "";

            string[] Severity   = null;
            string   temComment = "";

            foreach (var caseinfo in caseList)
            {
                tempIssue = null;
                if (JiraMapping.ContainsKey(caseinfo.CaseNumber))
                {
                    tempIssue = JiraMapping[caseinfo.CaseNumber];
                }

                DataRow row = table.NewRow();
                row["ID"]         = caseinfo.Id;
                row["No"]         = index;
                row["HotCase"]    = (tempIssue != null && tempIssue.HotCase);
                row["JiraLabels"] = (tempIssue != null ? tempIssue.JiraLabels : null);
                //row["HotCase"] = true;
                row["ProductForUI"] = AccelaCaseUtil.AdjustProductName(caseinfo.Product, caseinfo.Solution, caseinfo.Subject, caseinfo.Description);
                row["Product"]      = caseinfo.Product;
                row["Solution"]     = caseinfo.Solution;
                row["Orgin"]        = caseinfo.Origin;
                //openDate = caseinfo.CreatedDate.ToShortDateString();
                openDate = (caseinfo.CreatedDate.Month < 10 ? "0" + caseinfo.CreatedDate.Month : "" + caseinfo.CreatedDate.Month)
                           + "/" + (caseinfo.CreatedDate.Day < 10 ? "0" + caseinfo.CreatedDate.Day : "" + caseinfo.CreatedDate.Day)
                           + "/" + ("" + caseinfo.CreatedDate.Year);

                row["OpenDate"]     = openDate;
                Severity            = caseinfo.Priority.Split(' ');
                row["Severity"]     = Severity[1];
                row["SalesforceID"] = caseinfo.CaseNumber;
                jiraKey             = (tempIssue != null ? tempIssue.JiraKey : "");
                jiraId             = (tempIssue != null ? tempIssue.JiraId : "");
                row["JiraKey"]     = jiraKey;
                row["JiraID"]      = jiraId;
                row["Type"]        = caseinfo.Type;
                row["Version"]     = caseinfo.CurrentVersion;
                customer           = (caseinfo.Customer != null && !String.IsNullOrEmpty(caseinfo.Customer.Name) ? caseinfo.Customer.Name : caseinfo.Account.Name);
                row["Customer"]    = customer;
                row["Summary"]     = caseinfo.Subject;
                row["Description"] = caseinfo.Description;
                assignee           = (tempIssue != null ? tempIssue.Assignee : "");

                temComment = "";

                if (caseinfo.CaseComments != null && caseinfo.CaseComments.Records != null)
                {
                    CaseComment comment = caseinfo.CaseComments.Records[0];
                    row["CaseComment"] = comment;

                    if (!String.IsNullOrEmpty(comment.CommentBody))
                    {
                        if (comment.CommentBody.ToUpper().IndexOf("BUB") > 0)
                        {
                            temComment += "This is a bug.<br>";
                        }

                        if (comment.CommentBody.ToUpper().IndexOf("DEFECT") > 0)
                        {
                            temComment += "This is a defect.<br>";
                        }
                    }

                    if (!String.IsNullOrEmpty(assignee) && comment.CommentBody.ToUpper().Contains(assignee.ToUpper()))
                    {
                    }
                    else
                    {
                        foreach (var key in Reviewers.Keys)
                        {
                            string value  = Reviewers[key];
                            string value1 = value.Replace('.', ' ');
                            if (comment.CommentBody.ToUpper().EndsWith(key.ToUpper()) ||
                                comment.CommentBody.ToUpper().EndsWith(value.ToUpper()) ||
                                comment.CommentBody.ToUpper().EndsWith(value1.ToUpper()))
                            {
                                assignee = Reviewers[key];
                                break;
                            }
                        }
                    }
                }

                row["Reviewer"]      = assignee;
                row["Comments"]      = temComment;
                reopenCount          = (caseinfo.CaseComments != null && caseinfo.CaseComments.Records != null ? caseinfo.CaseComments.Records.Count - 1 : 0);
                row["ReopenedCount"] = reopenCount;
                jiaStstus            = (tempIssue != null ? tempIssue.Status : "");
                row["JiraStatus"]    = jiaStstus;
                row["SFQueue"]       = caseinfo.Owner.Name;
                row["SFStatus"]      = caseinfo.Status;

                bool isCommentedToday = false;
                if (caseinfo.CaseComments != null && caseinfo.CaseComments.Records != null)
                {
                    CaseComment comment = caseinfo.CaseComments.Records[0];

                    isCommentedToday = (comment.CreatedDate.Year == DateTime.Now.Year && comment.CreatedDate.Month == DateTime.Now.Month && comment.CreatedDate.Day == DateTime.Now.Day ? true : false);
                }

                row["NextJiraStatus"] = AccelaCaseUtil.GetNextJIRAStatus(caseinfo.Owner.Name, caseinfo.Status, jiaStstus, isCommentedToday);
                row["SFLastModified"] = (tempIssue != null ? tempIssue.LastModified : "");

                table.Rows.Add(row);
                index++;
            }

            grdCaseList.AutoGenerateColumns = false;
            grdCaseList.DataSource          = table;

            this.btnSendNotificationEmail.Enabled = true;
            this.btnSyncWithJIRA.Enabled          = true;
        }
コード例 #25
0
        private async void btnSync_Click(object sender, EventArgs e)
        {
            this.btnSync.Enabled = false;
            this.btnSend.Enabled = false;

            // 1, Construct one case list from the specified case list
            // 1.1 Check if the case list formate is valid or not
            // 1.2 Construct one case list
            string        caseIDs    = this.txtInputCaseList.Text;
            List <string> caseIdList = new List <string>();

            if (String.IsNullOrEmpty(caseIDs) || caseIDs.Trim().Length == 0)
            {
                // Show one error message "ERROR: Please enter case id"
                (this.MdiParent as MainForm).ShowStatusMessage("ERROR: Please enter case id");

                this.btnSync.Enabled = true;
                this.btnSend.Enabled = true;

                return;
            }
            else
            {
                (this.MdiParent as MainForm).ShowStatusMessage("");

                string[] caseIDArray = caseIDs.Split(',');
                Regex    reg         = new Regex(@"\d{2}ACC-\d{5}");
                foreach (string caseId in caseIDArray)
                {
                    if (reg.IsMatch(caseId))
                    {
                        if (!caseIdList.Contains(caseId.Trim()))
                        {
                            caseIdList.Add(caseId.Trim());
                        }
                    }
                    else
                    {
                        // Show one error message "ERROR: Invalid Format for XXXX"
                        (this.MdiParent as MainForm).ShowStatusMessage("ERROR: Invalid Format for " + caseId);

                        this.btnSync.Enabled = true;
                        this.btnSend.Enabled = true;

                        return;
                    }
                }
            }

            List <string> DevNameList = null;
            List <string> QANameList  = SalesforceProxy.GetQAReviewerNamesList();

            QANameList  = SalesforceProxy.GetSupportQAList(this.chkExcludeAccela.Checked);
            DevNameList = SalesforceProxy.GetSupportDevList(this.chkExcludeAccela.Checked);
            Dictionary <string, string> Reviewers = SalesforceProxy.GetReviewerNamesList(this.chkExcludeAccela.Checked);

            var caseList  = new List <CaseAnalysisInfo>();
            var issueList = new List <Issue>();

            int N      = 1;
            int index1 = 1;

            for (int i = 0; i < caseIdList.Count;)
            {
                List <string> caseIdListTemp = new List <string>();
                for (; i < N * 100 && i < caseIdList.Count; i++)
                {
                    caseIdListTemp.Add(caseIdList[i]);
                }

                N = N + 1;

                var GetCaseList  = SalesforceProxy.GetCaseList(caseIdListTemp, true);
                var GetIssueList = JiraProxy.GetIssueList(caseIdListTemp);

                var caseListTmp  = await GetCaseList;
                var issueListTmp = await GetIssueList;

                Dictionary <string, CaseAnalysisInfo> JIRAMapper = new Dictionary <string, CaseAnalysisInfo>();
                foreach (var issue in issueListTmp)
                {
                    CaseAnalysisInfo caseAnalysisInfo = new CaseAnalysisInfo();
                    caseAnalysisInfo.SFID          = issue.fields.customfield_10600;
                    caseAnalysisInfo.JiraKey       = issue.key;
                    caseAnalysisInfo.IssueCategory = (issue.fields.customfield_11502 != null && issue.fields.customfield_11502.Count > 0 ? issue.fields.customfield_11502[0].value : "NONE");
                    if (!JIRAMapper.ContainsKey(issue.fields.customfield_10600))
                    {
                        JIRAMapper.Add(issue.fields.customfield_10600, caseAnalysisInfo);
                    }
                }

                foreach (var caseInfo in caseListTmp)
                {
                    Dictionary <DateTime, string> CommentHistories = new Dictionary <DateTime, string>();
                    bool isFound           = false;
                    int  sfCommentCount    = 0;
                    int  sfDevCommentCount = 0;
                    int  sfQACommentCount  = 0;

                    System.Console.WriteLine("[" + (index1++) + "] " + caseInfo.CaseNumber);

                    if (caseInfo.CaseComments != null && caseInfo.CaseComments.Records != null && caseInfo.CaseComments.Records.Count > 0)
                    {
                        foreach (CaseComment comment in caseInfo.CaseComments.Records)
                        {
                            if (comment == null ||
                                comment.CommentBody == null ||
                                comment.CreatedDate.Year != this.dtpSpecifyDate.Value.Year ||
                                comment.CreatedDate.Month != this.dtpSpecifyDate.Value.Month)
                            {
                                continue;
                            }

                            if (this.chkSpecifyDate.Checked)
                            {
                                DateTime date = this.dtpSpecifyDate.Value;

                                if (comment == null ||
                                    comment.CommentBody == null ||
                                    comment.CreatedDate.Year != date.Year ||
                                    comment.CreatedDate.Month != date.Month ||
                                    comment.CreatedDate.Day != date.Day)
                                {
                                    continue;
                                }
                            }

                            string assignee = "";

                            foreach (var key in Reviewers.Keys)
                            {
                                string value  = Reviewers[key];
                                string value1 = value.Replace('.', ' ');
                                if (comment.CommentBody.ToUpper().EndsWith(key.ToUpper()) ||
                                    comment.CommentBody.ToUpper().EndsWith(value.ToUpper()) ||
                                    comment.CommentBody.ToUpper().EndsWith(value1.ToUpper()) ||
                                    comment.LastModifiedBy.Name.ToUpper().StartsWith(value.ToUpper()) ||
                                    comment.LastModifiedBy.Name.ToUpper().StartsWith(value1.ToUpper()))
                                {
                                    isFound = true;
                                    sfCommentCount++;
                                    assignee = Reviewers[key];
                                    if (QANameList.Contains(assignee))
                                    {
                                        sfQACommentCount++;
                                    }

                                    if (DevNameList.Contains(assignee))
                                    {
                                        sfDevCommentCount++;
                                    }

                                    CommentHistories.Add(comment.LastModifiedDate, assignee);
                                    break;
                                }
                            }
                        }
                    }

                    if (isFound)
                    {
                        CaseAnalysisInfo caseAnalysisInfo = ConstructCaseAnalysisInfoModel(caseInfo, sfCommentCount, sfDevCommentCount, sfQACommentCount, CommentHistories);

                        if (JIRAMapper.ContainsKey(caseAnalysisInfo.SFID))
                        {
                            CaseAnalysisInfo tempCaseAnalysisInfo = JIRAMapper[caseAnalysisInfo.SFID];
                            caseAnalysisInfo.JiraKey       = tempCaseAnalysisInfo.JiraKey;
                            caseAnalysisInfo.IssueCategory = tempCaseAnalysisInfo.IssueCategory;
                        }

                        System.Console.WriteLine("Add " + caseInfo.CaseNumber);
                        caseList.Add(caseAnalysisInfo);
                    }
                    else
                    {
                        System.Console.WriteLine("Skip " + caseInfo.CaseNumber);
                    }
                }

                //issueList.AddRange(issueListTmp);
            }

            DataTable table = new DataTable("Case Analysis Report");

            table.Columns.Add("No", typeof(int));
            table.Columns.Add("Product", typeof(string));
            table.Columns.Add("SalesforceID", typeof(string));
            table.Columns.Add("JiraKey", typeof(string));
            table.Columns.Add("SFCaseCommentCount", typeof(int));
            table.Columns.Add("SFDevCaseCommentCount", typeof(int));
            table.Columns.Add("SFQACaseCommentCount", typeof(int));
            table.Columns.Add("Customer", typeof(string));
            table.Columns.Add("Severity", typeof(string));
            table.Columns.Add("Version", typeof(string));
            table.Columns.Add("OpenDate", typeof(string));
            table.Columns.Add("Summary", typeof(string));
            table.Columns.Add("CommentHistories", typeof(Dictionary <DateTime, string>));
            table.Columns.Add("IssueCategory", typeof(string));
            table.Columns.Add("SFQueue", typeof(string));
            table.Columns.Add("SFStatus", typeof(string));

            int index = 1;

            foreach (CaseAnalysisInfo caseAnalysisInfo in caseList)
            {
                DataRow row = table.NewRow();
                row["No"]                    = index;
                row["Product"]               = caseAnalysisInfo.Product;
                row["SalesforceID"]          = caseAnalysisInfo.SFID;
                row["JiraKey"]               = caseAnalysisInfo.JiraKey;
                row["SFCaseCommentCount"]    = caseAnalysisInfo.SFCaseCommentCount;
                row["SFDevCaseCommentCount"] = caseAnalysisInfo.SFDevCaseCommentCount;
                row["SFQACaseCommentCount"]  = caseAnalysisInfo.SFQACaseCommentCount;
                row["Customer"]              = caseAnalysisInfo.Customer;
                row["Severity"]              = caseAnalysisInfo.Severity;
                row["Version"]               = caseAnalysisInfo.Version;
                row["OpenDate"]              = caseAnalysisInfo.OpenDate;
                row["Summary"]               = caseAnalysisInfo.Summary;
                row["CommentHistories"]      = caseAnalysisInfo.CommentHistories;
                row["IssueCategory"]         = caseAnalysisInfo.IssueCategory;
                row["SFQueue"]               = caseAnalysisInfo.SFQueue;
                row["SFStatus"]              = caseAnalysisInfo.SFStatus;

                table.Rows.Add(row);
                index++;
            }

            DataView dataTableView = table.DefaultView;

            dataTableView.Sort = "SalesforceID ASC";
            table = dataTableView.ToTable();

            grdCaseList.AutoGenerateColumns = false;
            grdCaseList.DataSource          = table;


            this.btnSync.Enabled = true;
            this.btnSend.Enabled = true;
        }
コード例 #26
0
 public IssueController(JiraProxy jiraProxy, IHttpContextAccessor httpContextAccessor) : base(jiraProxy, httpContextAccessor)
 {
 }
コード例 #27
0
        private async void btnRequest_Click(object sender, EventArgs e)
        {
            //
            this.btnRequest.Enabled = false;

            string sfid           = this.txtSFID.Text;
            string engsuppKey     = this.txtEngsuppID.Text;
            string currentVersion = this.txtVersion.Text;
            string product        = this.txtProduct.Text;
            string contact        = this.txtCaseOwner.Text;
            string priority       = this.txtPriority.Text;
            string siteUr         = this.txtSiteUrl.Text;

            string issueSubject   = this.txtIssueSubject.Text;
            string customerInfo   = this.txtCustomerInfo.Text;
            string dbType         = this.txtDBType.Text;
            string dbIP           = this.txtDBServerIP.Text;
            string dbPort         = this.txtDBServerPort.Text;
            string dbInstance     = this.txtDBInstance.Text;
            string dbUserName     = this.txtDBUser.Text;
            string dbUserPassword = this.txtDBPassword.Text;
            string dbVersion      = this.txtDBVersion.Text;
            string dbRelatedCase  = this.txtRelatedCase.Text;
            string enviroment     = "";
            string reviewer       = this.txtReviewer.Text;

            if (this.txtSiteUrl.Text.Trim().IndexOf(".accela.com") == -1)
            {
                MessageBox.Show("Please specify the client's site url where this case could be recreated.\n For example: https://av.supp3.accela.com/ ");
                this.btnRequest.Enabled = true;
                return;
            }

            if (chbAccelaHostedFlag.Checked)
            {
                if (this.chbProductionFlag.Checked)
                {
                    enviroment += "<<Production>>";
                }

                if (this.chbSupportFlag.Checked)
                {
                    enviroment += "<<Support>>";
                }

                if (this.chbTestFlag.Checked)
                {
                    enviroment += "<<Test>>";
                }

                if (this.chbJetspeed.Checked)
                {
                    enviroment += "<<Jetspeed>>";
                }

                if (String.IsNullOrEmpty(enviroment))
                {
                    MessageBox.Show("Please specify which database enviroment you would request. For example, production, support or test or jetspped");
                    this.btnRequest.Enabled = true;
                    return;
                }
            }
            else
            {
                MessageBox.Show("Please double check if this customer is Accela hosted. If yes, please tick the checkbox beside Accela Hosted field.");
                this.btnRequest.Enabled = true;
                return;
            }



            string summary      = "Request one fresh database dump for [" + customerInfo + "] - " + sfid;
            string description1 = @"
Hi [[email protected]],
                              
Please kindly help to get one fresh database dump pings to {0} for <<{1}>> which is Accela hosted, because we could not reproduce the problem on our local site. The problem might exists on their latest {2} enviroment.


Custom Info:
---------------------------------------------------------
Salesforce ID: {3}
ENGSUPP Key: {4}
Customer: {5}
Current Version: {6}
Product: {7}
Contact:{8}
Priority: {9}
Issue Subject: {10}
---------------------------------------------------------

After the fresh database dump is ready, please put it under Accela ftp server. The path should like ftp://ftp.accela.com/BIN/MISSIONSKY/XXXXX-XXXXX, and then re-assign this jira ticket to [~{11}] who will download it in Missionsky. Any further question, please let us know.

Thanks you very much!

CC [[email protected]] [[email protected]] [[email protected]] [~{11}]";

            description1 = String.Format(description1,
                                         siteUr,
                                         customerInfo,
                                         enviroment,
                                         sfid,
                                         engsuppKey,
                                         customerInfo,
                                         currentVersion,
                                         product,
                                         contact,
                                         priority,
                                         issueSubject,
                                         reviewer
                                         );

            IssueFields fields = new IssueFields();

            fields.summary     = summary;
            fields.description = description1;

            var GetDBTaskBySFID             = JiraProxy.GetDatabaseTaskByCaseID("DATABASE", "Task", sfid);
            var GetDatabaseTaskByCustomerID = JiraProxy.GetDatabaseTaskByCustomerID("DATABASE", "Task", customerInfo);
            var taskInfoByCaseId            = await GetDBTaskBySFID;
            var taskInfoByCustomerId        = await GetDatabaseTaskByCustomerID;

            if (taskInfoByCaseId != null || taskInfoByCustomerId != null)
            {
                var taskInfo = taskInfoByCaseId;
                if (taskInfo == null)
                {
                    taskInfo = taskInfoByCustomerId;
                }

                taskInfo.fields = fields;
                JiraProxy.UpdateDatabaseTask(taskInfo);

                this.txtDatabaseID.Text = taskInfo.key;
                MessageBox.Show("The database request ticket already exists, please refer to " + taskInfo.key);
                showCaseComment(engsuppKey, taskInfo.key);
            }
            else
            {
                var issue = await JiraProxy.CreateDatabaseTask(fields);

                this.txtDatabaseID.Text = issue.key;

                // 2 - Critical
                // 7 - High
                // 6 - Medium
                // 8 - Low
                issue.fields.Priority      = new IssuePriority();
                issue.fields.Priority.name = priority;

                JiraProxy.UpdateDatabaseTask(issue);
                showCaseComment(engsuppKey, issue.key);

                IssueRef engIssue = new IssueRef();
                engIssue.key = engsuppKey;
                engIssue.id  = engsuppKey;

                JiraProxy.CreateComment(engIssue, String.Format("One jira ticket is already submitted to Accela DBA for the most recent database dump, because the reported issue might be data-related based on the research. The ticket key is {0}.  Thank you for your patience", issue.key));
            }

            this.btnRequest.Enabled = true;
        }
コード例 #28
0
        private async void btnSync_Click(object sender, EventArgs e)
        {
            this.btnSync.Enabled = false;

            var jiraLabels = this.txtLabelList.Text;

            if (jiraLabels.Trim().Length == 0)
            {
                MessageBox.Show("Please enter some jira labels related release version like 9.0.4");
                this.btnSync.Enabled = true;
                return;
            }

            dicDeliveryCaseMapper.Clear();

            string[] jiraLabelList = jiraLabels.Split(',');

            foreach (string label in jiraLabelList)
            {
                if (String.IsNullOrEmpty(label) || String.IsNullOrWhiteSpace(label))
                {
                    continue;
                }

                var GetIssueList = JiraProxy.GetIssueListByLabel(label);
                var issueList    = await GetIssueList;

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

                List <AccelaIssueCaseMapper> jiraIssues = dicDeliveryCaseMapper.ContainsKey(label) ? dicDeliveryCaseMapper[label] : new List <AccelaIssueCaseMapper>();

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

                    AccelaIssueCaseMapper issueMapper = new AccelaIssueCaseMapper();

                    // Product
                    issueMapper.SFProduct = issue.fields.customfield_10904;
                    // Jira Key
                    issueMapper.JiraKey = issue.key;
                    // Salesforce ID
                    issueMapper.CaseNumber = issue.fields.customfield_10600;
                    // Customer
                    issueMapper.SFCustomer = issue.fields.customfield_10900;
                    // Summary
                    issueMapper.Description = issue.fields.summary;
                    // Type
                    issueMapper.IssueType = (issue.fields.issueType == null ? "" : issue.fields.issueType.name);
                    // Severity
                    issueMapper.Priority = (issue.fields.Priority == null ? "" : issue.fields.Priority.name);
                    // Fix Version
                    issueMapper.FixVersions = new List <string>();
                    if (issue.fields.fixVersions != null)
                    {
                        foreach (var fixVersion in issue.fields.fixVersions)
                        {
                            if (fixVersion == null)
                            {
                                continue;
                            }

                            issueMapper.FixVersions.Add(fixVersion.name);
                        }

                        issueMapper.FixVersions.Sort();
                    }
                    // Jira Status
                    issueMapper.Status = (issue.fields.status == null ? "" : issue.fields.status.name);
                    // Assignee(Dev)
                    issueMapper.Assignee = (issue.fields.assignee == null ? "" : issue.fields.assignee.displayName);
                    // Assignee(QA)
                    issueMapper.AssigneeQA = (issue.fields.customfield_11702 == null ? "" : issue.fields.customfield_11702.displayName);

                    List <Comment> comments = new List <Comment>();

                    if (this.chkRootCause.Checked ||
                        this.chkSolution.Checked ||
                        this.chkImpactArea.Checked)
                    {
                        if ("ENGSUPP-12597".Equals(issue.key))
                        {
                            System.Console.WriteLine("" + issue.key);
                        }

                        var Comments = await JiraProxy.GetComments(issue);

                        foreach (var comment in Comments)
                        {
                            if (this.chkRootCause.Checked &&
                                comment.body.Contains("Root Cause"))
                            {
                                comments.Add(comment);
                                continue;
                            }

                            if (this.chkSolution.Checked &&
                                comment.body.Contains("Solution"))
                            {
                                comments.Add(comment);
                                continue;
                            }

                            if (this.chkImpactArea.Checked &&
                                comment.body.Contains("Impact Area"))
                            {
                                comments.Add(comment);
                                continue;
                            }
                        }
                    }

                    issueMapper.Comments    = comments;
                    issueMapper.ReleaseNote = issue.fields.customfield_11500;

                    jiraIssues.Add(issueMapper);
                }

                dicDeliveryCaseMapper[label] = jiraIssues;
            }

            DataTable table = new DataTable("Delivery Progress Report");

            table.Columns.Add("No", typeof(int));
            table.Columns.Add("Product", typeof(string));
            table.Columns.Add("JiraKey", typeof(string));
            table.Columns.Add("SalesforceID", typeof(string));
            table.Columns.Add("Customer", typeof(string));
            table.Columns.Add("Description", typeof(string));
            table.Columns.Add("IssueType", typeof(string));
            table.Columns.Add("Severity", typeof(string));
            table.Columns.Add("FixVersions", typeof(List <string>));
            table.Columns.Add("FixVersionsForUI", typeof(string));
            table.Columns.Add("JiraStatus", typeof(string));
            table.Columns.Add("AssigneeDev", typeof(string));
            table.Columns.Add("AssigneeQA", typeof(string));
            table.Columns.Add("Comments", typeof(List <Comment>));
            table.Columns.Add("CemmentCount", typeof(int));
            table.Columns.Add("ReleaseNote", typeof(string));

            int index      = 1;
            int labelIndex = 1;

            foreach (string versionLabel in jiraLabelList)
            {
                if (String.IsNullOrEmpty(versionLabel) || String.IsNullOrWhiteSpace(versionLabel))
                {
                    continue;
                }

                List <AccelaIssueCaseMapper> jiraIssueList = dicDeliveryCaseMapper.ContainsKey(versionLabel) ? dicDeliveryCaseMapper[versionLabel] : new List <AccelaIssueCaseMapper>();
                if (jiraIssueList.Count == 0)
                {
                    continue;
                }

                foreach (AccelaIssueCaseMapper jiraIssue in jiraIssueList)
                {
                    DataRow row = table.NewRow();
                    row["No"]           = index++;
                    row["Product"]      = jiraIssue.SFProduct;
                    row["JiraKey"]      = jiraIssue.JiraKey;
                    row["SalesforceID"] = jiraIssue.CaseNumber;
                    row["Customer"]     = jiraIssue.SFCustomer;
                    row["Description"]  = jiraIssue.Description;
                    row["IssueType"]    = jiraIssue.IssueType;
                    row["Severity"]     = jiraIssue.Priority;
                    row["FixVersions"]  = jiraIssue.FixVersions;

                    string fixVersionsForUI = String.Empty;
                    foreach (string versionUI in jiraIssue.FixVersions)
                    {
                        if (String.IsNullOrEmpty(fixVersionsForUI))
                        {
                            fixVersionsForUI = versionUI;
                        }
                        else
                        {
                            fixVersionsForUI += "," + versionUI;
                        }
                    }
                    row["FixVersionsForUI"] = fixVersionsForUI;

                    row["JiraStatus"]   = jiraIssue.Status;
                    row["AssigneeDev"]  = jiraIssue.Assignee;
                    row["AssigneeQA"]   = jiraIssue.AssigneeQA;
                    row["Comments"]     = jiraIssue.Comments;
                    row["CemmentCount"] = jiraIssue.Comments.Count;
                    row["ReleaseNote"]  = jiraIssue.ReleaseNote;

                    table.Rows.Add(row);
                }

                if (labelIndex < jiraLabelList.Length)
                {
                    labelIndex++;
                    table.Rows.Add(table.NewRow());
                }
            }

            //DataView dataTableView = table.DefaultView;
            //dataTableView.Sort = "Severity ASC";
            //table = dataTableView.ToTable();

            grdCaseList.AutoGenerateColumns = false;
            grdCaseList.DataSource          = table;

            this.btnSync.Enabled = true;
        }
コード例 #29
0
 private async void btnCheckDBRequest_Click(object sender, EventArgs e)
 {
     var GetIssueByID = JiraProxy.GetDatabaseTaskByID("DATABASE", "Task", this.txtDatabaseID.Text);
     var issueInfo    = await GetIssueByID;
 }
コード例 #30
0
ファイル: JiraPlugin.cs プロジェクト: adrianoc/binboo
        private JiraProxy JiraProxy()
        {
            if (_jira == null)
            {
                _jira = new JiraProxy(
                                JiraConfig.Instance.EndPoint,
                                JiraConfig.Instance.User,
                                new JiraHttpProxy(new SystemNetHttpFactory(), JiraConfig.Instance.HttpInterfaceConfiguration));
            }

            return _jira;
        }
コード例 #31
0
 public JiraOAuthController(IHostingEnvironment hostingEnvironment,
                            JiraProxy jiraProxy, IOptions <JiraSettings> options)
 {
     _hostingEnvironment = hostingEnvironment;
     _options            = options;
 }