示例#1
0
        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();
        }
示例#2
0
        private CreateDocument CreateWayBill(Car car, DateTime date, int idInvoice = 0)
        {
            CreateDocument waybill = new CreateDocument(car);

            Driver driver = null;
            if (idInvoice != 0)
            {
                InvoiceList invoiceList = InvoiceList.getInstance();
                Invoice invoice = invoiceList.getItem(idInvoice);
                DriverList driverList = DriverList.getInstance();
                driver = driverList.getItem(Convert.ToInt32(invoice.DriverToID));
            }

            waybill.createWaybill(date, driver);

            try
            {
                if (_type == WayBillType.Day)
                    waybill.AddRouteInWayBill(date, Fields.All);
            }
            catch (NullReferenceException ex)
            {
                MessageBox.Show(ex.Message, "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Information);
                waybill.Exit();
                throw;
            }

            return waybill;
        }