Ejemplo n.º 1
0
        private async Task <List <ALMDefect> > GetAlmDefectsForQueries(string almDomain, string almProject, List <string> almQueries, DateTime lastPostDate)
        {
            List <ALMDefect> almDefectsForQueries = new List <ALMDefect>();

            foreach (string almQuery in almQueries)
            {
                int indexOfSemicolon = almQuery.IndexOf(";");
                if (indexOfSemicolon != -1)
                {
                    string           almQueryModified = almQuery.Insert(indexOfSemicolon + 1, "last-modified[> \"" + lastPostDate.Year + "-" + lastPostDate.Month + "-" + lastPostDate.Day + " " + lastPostDate.Hour + ":" + lastPostDate.Minute + ":" + lastPostDate.Second + "\"" + "];");
                    List <ALMDefect> almDefects       = await almApiClient.GetDefectsAsync(almDomain, almProject, almQueryModified);

                    almDefectsForQueries.AddRange(almDefects);
                }
            }
            return(almDefectsForQueries);
        }
Ejemplo n.º 2
0
        private async void HandleDefCommand(string[] parameters, SLRuntimeEventArgs e)
        {
            if (almApiClient.Authenticate())
            {
                if (parameters.Length == 2)
                {
                    string defectId = parameters[1];

                    List <ALMDefect> defects = await almApiClient.GetDefectsAsync(almDomain, almProject, "&query={id[" + defectId + "];}");

                    StringBuilder text = new StringBuilder("");
                    if (defects.Count > 0)
                    {
                        text.Append("Title: " + defects[0].name + "\n");
                        text.Append("State: " + defects[0].status + "\n");
                        text.Append("Dev: " + defects[0].owner_dev + "\n");
                        text.Append("QA Lead: " + defects[0].user_40_qalead + "\n");
                        slRuntimeApiClient.SendWithMessageType(1, e.channel, text.ToString(), true, true);
                    }
                    else
                    {
                        text.Append("Either such defect doesn't exist, either connection to ALM server is broken");
                        slRuntimeApiClient.SendWithMessageType(1, e.channel, text.ToString(), true, true);
                    }
                }
                else if (parameters.Length == 3)
                {
                    string userType = parameters[1];
                    if (userType.Equals("-d"))
                    {
                        string           developerQcName = parameters[2];
                        List <ALMDefect> defects         = await almApiClient.GetDefectsAsync(almDomain, almProject, "&query={planned-closing-ver[Not \"Obsolete\"];owner[" + developerQcName + "];status[Not \"Closed\"];}");

                        StringBuilder text = new StringBuilder("");
                        if (defects.Count > 0)
                        {
                            foreach (ALMDefect defect in defects)
                            {
                                text.Append(defect.id + " - ");
                                text.Append(defect.name + "\n");
                                slRuntimeApiClient.SendWithMessageType(1, e.channel, text.ToString(), true, true);
                                text.Clear();
                            }
                        }
                        else
                        {
                            text.Append("There is no 'Not Closed' defect on this developer, or developer name specified incorrectly");
                            slRuntimeApiClient.SendWithMessageType(1, e.channel, text.ToString(), true, true);
                        }
                    }
                    else if (userType.Equals("-ql"))
                    {
                        string           qaLeadQcName = parameters[2];
                        List <ALMDefect> defects      = await almApiClient.GetDefectsAsync(almDomain, almProject, "&query={planned-closing-ver[Not \"Obsolete\"];user-40[" + qaLeadQcName + "];status[Not \"Closed\"];}");

                        StringBuilder text = new StringBuilder("");
                        if (defects.Count > 0)
                        {
                            foreach (ALMDefect defect in defects)
                            {
                                text.Append(defect.id + " - ");
                                text.Append(defect.name + "\n");
                                slRuntimeApiClient.SendWithMessageType(1, e.channel, text.ToString(), true, true);
                                text.Clear();
                            }
                        }
                        else
                        {
                            text.Append("There is no 'Not Closed' defect on this qalead, or qalead name specified incorrectly");
                            slRuntimeApiClient.SendWithMessageType(1, e.channel, text.ToString(), true, true);
                        }
                    }
                }
            }
            else
            {
                slRuntimeApiClient.SendWithMessageType(14235325, e.channel, "Connection to ALM server is broken", true, true);
            }
        }