private void setDependencies(List <NetworkDiagramItem> listItem, NetworkDiagramItem itemStart, NetworkDiagramItem lastItem) { for (int i = 0; i < PERTTaskResult.Count(); i++) { List <PERTTask> poprzednicy = PERTTaskResult[i].PreTask; if (poprzednicy.Count() == 0) { NetworkDiagramItem initItem = listItem.Where(x => x.DisplayedText == PERTTaskResult[i].Name).FirstOrDefault(); initItem.Predecessors.Add(new NetworkPredecessorItem { Item = itemStart }); } if (PERTTaskResult[i].PostTask.Count() == 0) { NetworkDiagramItem endItem = listItem.Where(x => x.DisplayedText == PERTTaskResult[i].Name).FirstOrDefault(); lastItem.Predecessors.Add(new NetworkPredecessorItem { Item = endItem }); } NetworkDiagramItem itemCoMaPoprzednika = listItem.Where(x => x.DisplayedText == PERTTaskResult[i].Name).FirstOrDefault(); for (int j = 0; j < poprzednicy.Count(); j++) { NetworkDiagramItem poprzednik = listItem.Where(x => x.DisplayedText == poprzednicy[j].Name).FirstOrDefault(); itemCoMaPoprzednika.Predecessors.Add(new NetworkPredecessorItem { Item = poprzednik }); } } }
private NetworkDiagramItem setLastNetworkDiagramItem(List <NetworkDiagramItem> listItem) { int maxCS = PERTTaskResult.Max(x => x.CS); PERTTask tmpPertTask = PERTTaskResult.Where(x => x.CS == maxCS).FirstOrDefault(); NetworkDiagramItem lastItem = new NetworkDiagramItem { DisplayedText = "End", Content = "End" }; lastItem.Effort = TimeSpan.Zero; lastItem.EarlyStart = StartProject.AddDays(maxCS); lastItem.EarlyFinish = StartProject.AddDays(maxCS); lastItem.LateStart = StartProject.AddDays(maxCS); lastItem.LateFinish = StartProject.AddDays(maxCS); lastItem.Slack = TimeSpan.Zero; listItem.Add(lastItem); return(lastItem); }
private void setNetworkDiagramItems(List <NetworkDiagramItem> listItem) { for (int i = 0; i < PERTTaskResult.Count(); i++) { NetworkDiagramItem item = new NetworkDiagramItem { DisplayedText = PERTTaskResult[i].Name, Content = PERTTaskResult[i].Name }; item.Effort = TimeSpan.Parse(PERTTaskResult[i].Expected_t + ":00:00:00"); item.EarlyStart = StartProject.AddDays(PERTTaskResult[i].ES); item.EarlyFinish = StartProject.AddDays(PERTTaskResult[i].EF); item.LateStart = StartProject.AddDays(PERTTaskResult[i].LS); item.LateFinish = StartProject.AddDays(PERTTaskResult[i].LF); item.Slack = item.LateStart - item.EarlyStart; listItem.Add(item); } }