private void DG5_SelectionChanged(object sender, SelectionChangedEventArgs e) { PlannerClass.ContractsPerTicket.Clear(); foreach (FC_TripTicket_WProgress c in DG5.SelectedItems) { PlannerClass.ContractsPerTicket = PlannerClass.ContractsPerTicket_Populate(c.instance); foreach (FC_LocalContract x in PlannerClass.ContractsPerTicket) { string query = "select * from FC_TripTicketLine where FC_TripTicketID = " + c.instance.FC_TripTicketID.ToString() + " and FC_LocalContractID = " + x.FC_LocalContractID.ToString() + " ;"; FC_TripTicketLine t = new FC_TripTicketLine(); List <FC_TripTicketLine> theTicketLine = t.ObjToTable(SQL.Select(t, query)); x.Quantity = theTicketLine[0].PalletsOnTicket; } PlannerClass.RoutSegsPerTicket_Populate(c.instance); } DG6.ItemsSource = null; DG6.ItemsSource = PlannerClass.ContractsPerTicket; DG7.ItemsSource = null; DG7.ItemsSource = PlannerClass.RouteSegsPerTicket; }
public void RefreshPossibleTickets() { string query = "Select * from FC_TripTicket where Is_Complete = 0 and CurrentLocation = \"" + PassedInContract.Origin + "\" and not Size_in_Palettes = 0;"; FC_TripTicket t = new FC_TripTicket(); List <FC_TripTicket> OtherTickets = t.ObjToTable(SQL.Select(t, query)); List <FC_TripTicket> ValidatedTickets = new List <FC_TripTicket>(); foreach (FC_TripTicket x in OtherTickets) { List <FC_LocalContract> ContractsForTicket = PlannerClass.ContractsPerTicket_Populate(x); bool matchfound = false; foreach (FC_LocalContract y in ContractsForTicket) { if (y.FC_LocalContractID == PassedInContract.FC_LocalContractID) { matchfound = true; } if (y.Van_type != PassedInContract.Van_type) { matchfound = true; } } if (!matchfound) { ValidatedTickets.Add(x); } } PossibleTickets.ItemsSource = ValidatedTickets; }