static void getBuildDetails(SITSDEVEntities sde, String tkt_code) { //begin output file text addToOuput("digraph {label=\"" + sde.men_tkt.Where(a => a.tkt_code == tkt_code).First().tkt_name + " - " + tkt_code + "\""); addToOuput("node [fontname = \"Calibri\", fontsize = 16];"); addToOuput("graph[fontname = \"Calibri\", fontsize = 12];"); addToOuput("edge[fontname = \"Calibri\", fontsize = 12];"); //dictionary to translate tte_seq3 -> tte_name - also provides info on conditional steps and hidden steps var TTENameSeqDictionary = SitsRepo.getTTENameToSeq3Dictionary(sde, tkt_code); //cross reference TEC to make affected TTEs 'conditional' foreach (var TEC in sde.men_tec.Where(a => a.tec_tktc == tkt_code)) { TTENameSeqDictionary.Where(a => a.Key == TEC.tec_ttes).First().Value.cond = true; } //draw out some styling info for each node foreach (KeyValuePair <decimal, TTE> T in TTENameSeqDictionary) { addToOuput(T.Value.TTE_NAME + "[shape=\"" + (T.Value.cond ? "diamond" : "box") + "\", style=\"" + T.Value.TTE_DISP + "\", color=\"" + T.Value.TTE_IUSE + "\"]"); } //print out list of relationships for TTEs AND TECs addToOuput(SitsRepo.getTTEsForTask(sde, tkt_code)); addToOuput(SitsRepo.getTECsForTask(sde, tkt_code, TTENameSeqDictionary)); //Close off Output addToOuput("}"); }
static void Main(string[] args) { SITSDEVEntities sde = new SITSDEVEntities(); Console.WriteLine("Please insert the task code"); promptForInput(sde); }
public static string getTTEsForTask(SITSDEVEntities sde, string tkt_code) { return (sde.men_tte.Where(a => a.tte_tktc == tkt_code && a.tte_nxts.Length >= 1) .Select(a => a.tte_step + " -> " + a.tte_nxts) .StringJoin(Environment.NewLine)); }
public static string getTECsForTask(SITSDEVEntities sde, string tkt_code, Dictionary <Decimal, TTE> TTENameSeqDictionary) { return (sde.men_tec .Where(a => a.tec_iuse == "Y" && a.tec_tktc == tkt_code) .AsEnumerable() .Select(a => TTENameSeqDictionary[a.tec_ttes].TTE_NAME + " -> " + a.tec_step + "[label=\"" + a.tec_desc + "\"]" + ";") .StringJoin(Environment.NewLine)); }
static void promptForInput(SITSDEVEntities sde) { var input = Console.ReadLine(); if (sde.men_tkt.Where(a => a.tkt_code == input).Count() != 1) { Console.WriteLine("No Tasks found for code: " + input + ". Please try again"); promptForInput(sde); } else { getBuildDetails(sde, input); System.IO.File.WriteAllText("output.txt", output); System.Diagnostics.Process.Start(@"output.txt"); } }
public static Dictionary <decimal, TTE> getTTENameToSeq3Dictionary(SITSDEVEntities sde, string tkt_code) { return(sde.men_tte.Where(a => a.tte_tktc == tkt_code) .AsEnumerable() .Select(a => new { key = a.tte_seq3, value = new TTE() { TTE_NAME = a.tte_step, TTE_DISP = ParseYN(a.tte_disp) ? "" : "dotted", TTE_IUSE = ParseYN(a.tte_iuse) ? "" : "RED" } }) .GroupBy(a => a.key) .Select(b => b.First()) .ToDictionary(a => a.key, a => a.value)); }