private void CreateWayBill(Car car, Actions action, Fields fields) { CreateDocument excelWayBill = new CreateDocument(car); try { excelWayBill.createWaybill(dtpDate.Value, null); excelWayBill.AddRouteInWayBill(dtpDate.Value, fields); if (action == Actions.Print) excelWayBill.Print(); else excelWayBill.Show(); } catch (NullReferenceException ex) { MessageBox.Show(ex.Message, "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Information); excelWayBill.Exit(); } if (car == list[index]) LoadWayBillCurrent(); }
private ToolStripMenuItem CreatePrint() { ToolStripMenuItem item = CreateItem("Печать"); item.ShortcutKeys = Keys.Control | Keys.P; item.Click += delegate { CreateDocument doc = new CreateDocument(); doc.CreateExcelFromDGV(_dgvMain.GetDGV()); doc.Print(); }; return item; }