private void listView_Contract_SelectionChanged(object sender, SelectionChangedEventArgs e) { ct = (ContractNameT)listView_Contract.SelectedItem; if (ct == null) { listView_Contract.SelectedIndex = 0; ct = (ContractNameT)listView_Contract.SelectedItem; } ocd = SqlQuery.ContractDataQuery(ct.ID); ListViewSerices.ItemsSource = ocd; MClass mc = new MClass(); aac = SqlQuery.AccountantQuery(ct.ID); mc.ac = aac; mc.oac = SqlQuery.AccountantLogQuery(ct.ID); oac = mc.oac; wwh = SqlQuery.WarehouseQuery(ct.ID); mc.wh = wwh; ocw = SqlQuery.WarehouseLogQuery(ct.ID); mc.ocw = ocw; ppr = SqlQuery.ProductionerQuery(ct.ID); mc.pr = ppr; opr = SqlQuery.ProductionerLogQuery(ct.ID); mc.opr = opr; ppt = SqlQuery.Project_dataQuery(ct.ID); mc.pt = ppt; opt = mc.opt = SqlQuery.ProjectLogQuery(ct.ID); ssl = SqlQuery.SalesQuery(ct.ID); mc.sl = ssl; osl = mc.osl = SqlQuery.SalesLogQuery(ct.ID); mc.ct = SqlQuery.ContractVQuery(ct.ID)[0]; MGrid.DataContext = mc; }
public MainWindow() { InitializeComponent(); ObservableCollection <ContractNameT> oct_beforeSort = SqlQuery.ContractQuery(); oct = new ObservableCollection <ContractNameT> (oct_beforeSort.OrderByDescending(x => DateTime.Parse(x.Contract_Date)).ToList()); listView_Contract.ItemsSource = oct; MClass mc = new MClass(); // grid_Main.DataContext ; }