Example #1
0
 static void Main(string[] args)
 {
     Console.WriteLine("Do you have the latest deploy_doc.csv and hotfix_doc.csv in the folder than this exe is in? Press enter when you do");
     Console.Read();
     var deploys = doDeployDoc();
     var hotfixes = doHotfixDoc();
     var finalDeploys = new List<Deploy>();
     foreach (var deploy in deploys)
     {
         var desArray = cleanName(deploy.DES).Split('/');
         var devArray = cleanName(deploy.DEV).Split('/');
         var crArray = cleanName(deploy.DEVCR).Split('/');
         var pmArray = cleanName(deploy.PM).Split('/');
         var qaArray = cleanName(deploy.QA).Split('/');
         int index = 0;
         foreach (string name in desArray)
         {
             insertIntoNameArray(name, desArray, index);
             index++;
         }
         index = 0;
         foreach (string name in devArray)
         {
             insertIntoNameArray(name, devArray, index);
             index++;
         }
         index = 0;
         foreach (string name in crArray)
         {
             insertIntoNameArray(name, crArray, index);
             index++;
         }
         index = 0;
         foreach (string name in pmArray)
         {
             insertIntoNameArray(name, pmArray, index);
             index++;
         }
         index = 0;
         foreach (string name in qaArray)
         {
             insertIntoNameArray(name, qaArray, index);
             index++;
         }
         finalDeploys.Add(new Deploy
         {
             Action = deploy.ACTION.Trim(),
             Branch = deploy.BRANCH.Trim(),
             Component = deploy.COMPONENT.Trim(),
             DeployTime = deploy.DATE_TIME.Trim().TryParseDateTime(),
             LineNumber = deploy.ID,
             Notes = deploy.NOTES,
             Project = deploy.PROJECT.Trim(),
             PullRequestId = deploy.PR.Trim().TryParseInt(),
             Type = deploy.TYPE.Trim(),
             People = new People
                 {
                     Designers = desArray.ToList(),
                     Developers = devArray.ToList(),
                     CodeReviewers = crArray.ToList(),
                     ProjectManagers = pmArray.ToList(),
                     Quails = qaArray.ToList(),
                 },
         });
     }
     var i = 0;
     foreach (var hotfix in hotfixes)
     {
         Deploy deploy = null;
         if (hotfix.BRANCH.ToLower().Contains("(2nd pr)"))
         {
             hotfix.BRANCH = hotfix.BRANCH.ToLower().Replace("(2nd pr)", "").Trim();
             deploy = finalDeploys.Where(d => d.Branch.ToLower().Trim().Equals(hotfix.BRANCH.ToLower().Trim())).LastOrDefault();
         }
         else
         {
             deploy = finalDeploys.Where(d => d.Branch.ToLower().Trim().Equals(hotfix.BRANCH.ToLower().Trim())).FirstOrDefault();
         }
         if (deploy == null)
         {
             Console.WriteLine("NO MATCH!! -- Line: " + (Int32.Parse(hotfix.ID) + 17) + " - HF Branch: " + hotfix.BRANCH);
             i++;
         }
         else
         {
             deploy.Hotfixes.Add(new Hotfix
                 {
                     BranchThatBrokeIt = hotfix.Breaker_Branch.Trim(),
                     Notes = hotfix.Notes,
                     ProdTicket = hotfix.PROD_Ticket_Num.Trim().TryParseInt(),
                     Special = hotfix.SPECIAL,
                     Ticket = hotfix.TICKET,
                     Assessments = new Assessments
                         {
                             Developers = new Assessment
                                 {
                                     Culpability = hotfix.DEV_Team_Culpability.Trim().TryParseDecimal(),
                                     HudlWideImpact = hotfix.DEV_Hudl_Wide_Impact.Trim().TryParseDecimal(),
                                     AffectedUserImpact = hotfix.DEV_Affected_User_Impact.Trim().TryParseDecimal(),
                                     Initials = hotfix.DEV_Initials.Trim(),
                                 },
                             Quails = new Assessment
                                 {
                                     Culpability = hotfix.QA_Team_Culpability.Trim().TryParseDecimal(),
                                     HudlWideImpact = hotfix.QA_Hudl_Wide_Impact.Trim().TryParseDecimal(),
                                     AffectedUserImpact = hotfix.QA_Affected_User_Impact.Trim().TryParseDecimal(),
                                     Initials = hotfix.QA_Initials.Trim(),
                                 }
                         }
                 });
         }
     }
     Console.WriteLine(i + " unmatched hotfixes");
     var repo = new DeployRepository();
     i = 0;
     foreach (Deploy d in finalDeploys)
     {
         Console.WriteLine("Updating Entry " + ++i +" of " + finalDeploys.Count);
         repo.Upsert(d);
     }
 }