public static TrainItem CreateTrainItem() { TrainItem newItem = ScheduleStore.Instance.CreateStoreItem <TrainItem>(ItemTypeID.Train); newItem.Title = "New Train"; newItem.StartDate = DateTime.Today; newItem.EndDate = DateTime.Today; return(newItem); }
//------------------------------------------------------------------------------------ /// <summary> /// Returns a string that represents the number of off days specified by the given /// collection of OffTimeItems, for the given train. /// </summary> //------------------------------------------------------------------------------------ public static string TrainOffDays(TrainItem trainItem, AsyncObservableCollection <OffTimeItem> offTimeItems) { if (trainItem != null && offTimeItems != null) { DateTime startDate = trainItem.StartDate; DateTime endDate = trainItem.EndDate; int netDaysOffThisTrain = WorkUtils.GetNetOffDays(startDate, endDate, offTimeItems); return(netDaysOffThisTrain.ToString() + " Days"); } return("0 Days"); }
public static List <BacklogItem> GetBacklogItemsByPillarAndTrain(PillarItem pillar, TrainItem train) { List <BacklogItem> backlogItems = new List <BacklogItem>(); foreach (BacklogItem backlogItem in BacklogItem.Items) { if (backlogItem.ParentPillarItem == pillar && backlogItem.ParentTrainItem == train) { backlogItems.Add(backlogItem); } } return(backlogItems); }