private void ButtonDocAdd_Click(object sender, RoutedEventArgs e) { ComboBoxItem selectedDoc = comboBoxDocTypeToAdd.SelectedItem as ComboBoxItem; if (selectedDoc.Content is "Квитанция") { RecieptWindow RecConst = new RecieptWindow(); RecConst.docList = docCollection; RecConst.serviceToUse = serviceToUse; RecConst.mainWinGrid = dataGridDocumentsList; RecConst.Show(); } else if (selectedDoc.Content is "Счет") { BillWindow BillConst = new BillWindow(); BillConst.docList = docCollection; BillConst.serviceToUse = serviceToUse; BillConst.mainWinGrid = dataGridDocumentsList; BillConst.Show(); } else if (selectedDoc.Content is "Накладная") { InvoiceWindow InvConst = new InvoiceWindow(); InvConst.docList = docCollection; InvConst.serviceToUse = serviceToUse; InvConst.mainWinGrid = dataGridDocumentsList; InvConst.Show(); } }
private void DataGridRow_MouseDoubleClick(object sender, MouseButtonEventArgs e) { Document currentDoc = ((DataGridRow)sender).DataContext as Document; if (currentDoc != null) { if (currentDoc is Reciept) { RecieptWindow RecConst = new RecieptWindow(); RecConst.reciept = (Reciept)currentDoc; RecConst.docList = docCollection; RecConst.toEdit = true; RecConst.serviceToUse = serviceToUse; RecConst.mainWinGrid = dataGridDocumentsList; RecConst.Show(); } else if (currentDoc is Bill) { BillWindow BillConst = new BillWindow(); BillConst.bill = (Bill)currentDoc; BillConst.docList = docCollection; BillConst.toEdit = true; BillConst.serviceToUse = serviceToUse; BillConst.mainWinGrid = dataGridDocumentsList; BillConst.Show(); } else if (currentDoc is Invoice) { InvoiceWindow InvConst = new InvoiceWindow(); InvConst.invoice = (Invoice)currentDoc; InvConst.docList = docCollection; InvConst.toEdit = true; InvConst.serviceToUse = serviceToUse; InvConst.mainWinGrid = dataGridDocumentsList; InvConst.Show(); } } }