Exemplo n.º 1
0
        public static void CreateMOMCache(List <IssueItem> issuesInRedmineProject, List <IssueItem> problematicIssuesInRedmineProject, int project_id, IOutputable output)
        {
            output.Write("Cache creation...");

            List <Issue> issuesListFromRemine = CommonTools.GetIssuesFromRedmine(project_id);

            if (output.GetIsRedisUse())
            {
                cache = RedisConnectorHelper.Connection.GetDatabase();
            }

            foreach (var issue in issuesListFromRemine.Where(issue => issue.Project.Id == project_id))
            {
                string subject = issue.Subject;

                //split subject to get env and problem id
                string[] subjectSplitted = subject.Split('-');

                //get env
                string env = subjectSplitted[0].Trim();

                IssueItem item = new IssueItem();
                item.Id     = issue.Id;
                item.Status = issue.Status.Name;
                item.Desc   = subject;
                item.Env    = env;

                if (subjectSplitted.Length >= 4)
                {
                    //get MOM problem is from subject
                    item.ProblemId = subjectSplitted[1].Trim();

                    //look for sender code
                    if (subjectSplitted.Length >= 5)
                    {
                        item.SenderCode = subjectSplitted[4].Trim();
                    }
                    issuesInRedmineProject.Add(item);

                    //cache.HashSetAsync("dd", "ddd", "ddd");
                }
                else
                {
                    problematicIssuesInRedmineProject.Add(item);
                }
            }

            output.WriteLine("done!");
        }
        public static void CreateTMSCache(IOutputable output)
        {
            output.Write("Cache creation...");
            //NameValueCollection parameters = new NameValueCollection { { "status_id", "*" } };

//            Task<List<Issue>> issuesListFromRemineTask = CommonTools.GetIssuesFromRedmine(Consts.PROJECT_NAMES.TMS.MACBI.PROBLEMS);
            List <Issue> issuesListFromRemine = CommonTools.GetIssuesFromRedmine(Consts.PROJECT_NAMES.TMS.MACBI.PROBLEMS);

            foreach (var issue in issuesListFromRemine)
            {
                string subject = issue.Subject;

                TMSItem itemFromRM = new TMSItem();
                itemFromRM.Source      = Consts.SRC_RM;
                itemFromRM.AssignedTo  = issue.AssignedTo.TryGetName();
                itemFromRM.Desctiption = issue.Description;

                string[] subjectSplitted = issue.Subject.Split('-');
                itemFromRM.TMS    = issue.Subject.Split('-')[0].Trim() + "-" + issue.Subject.Split('-')[1].Trim();
                itemFromRM.Status = issue.Status.TryGetName();
            }

            output.WriteLine("Cache creation...done!");
        }