public bool Run() { InvoiceWindow sw = new InvoiceWindow(); sw.DataContext = this; if (sw.ShowDialog() == true) { return(true); } return(false); }
public MainWindow(DatabaseContext context) { _context = context; InitializeComponent(); _context.Database.EnsureDeleted(); _context.Database.EnsureCreated(); companyWindow = new CompanyWindow(_context); customerWindow = new CustomerWindow(_context); invoiceWindow = new InvoiceWindow(_context); productWindow = new ProductWindow(_context); taxWindow = new TaxWindow(_context); }
public NewInvoiceWindow(Invoice selectedItem, InvoiceWindow invoiceWindow, DatabaseContext context) : this(context) { numberTextField.Text = selectedItem.Number; datePicker.SelectedDate = selectedItem.Date; deadlinePicker.SelectedDate = selectedItem.Deadline; addCustomerButton.Content = selectedItem.Customer.Name; listProductsButton.Content = selectedItem.InvoiceProducts.Count + " Item(s)"; commentTextField.Text = selectedItem.Comment; customer = selectedItem.Customer; invoice = selectedItem; isUpdateFlag = true; this.invoiceWindow = invoiceWindow; }
private void PrintInvoice(InvoiceWindow para) { try { para.btnPrint.IsEnabled = false; PrintDialog printDialog = new PrintDialog(); if (printDialog.ShowDialog() == true) { printDialog.PrintVisual(para, "Invoice"); } } finally { para.btnPrint.IsEnabled = true; } }
/// <summary> /// Открыть накладную /// </summary> private void Open() { Mouse.OverrideCursor = Cursors.Wait; Invoice invoice = dgInvoices.SelectedItem as Invoice; InvoiceWindow view = new InvoiceWindow(invoice.IsPurchase, invoice.ID); view.Owner = this; Mouse.OverrideCursor = null; view.ShowDialog(); view.Close(); GetData(); }
public NewInvoiceWindow(InvoiceWindow invoiceWindow, DatabaseContext context) : this(context) { this.invoiceWindow = invoiceWindow; }
private void PayBusiness(HomeWindow para) { if (para.txbIDAgencyPayment.Text == "-1") { MessageBox.Show("Vui lòng chọn đại lý"); return; } if (ListProductChosen.Count == 0) { MessageBox.Show("Vui lòng chọn sản phẩm"); return; } MessageBoxResult mes = MessageBox.Show("Are you sure?", "Confirm", MessageBoxButton.YesNo); if (mes != MessageBoxResult.Yes) { return; } InvoiceWindow wdInvoice = new InvoiceWindow(); wdInvoice.stkListProductChosenInvoice.Children.Add(new InvoiceBusinessUC()); foreach (BusinessProductChosenUC item in this.HomeWindow.stkListProductChosenBusiness.Children) { InvoiceBusinessUC uc = new InvoiceBusinessUC(); uc.txbName.Text = item.txbName.Text; uc.txbPrice.Text = item.txbPrice.Text; uc.txbAmount.Text = item.txbAmount.Text; uc.txbUnit.Text = item.txbUnit.Text; uc.txbTotal.Text = item.txbTotal.Text; uc.txbID.Text = item.txbID.Text; wdInvoice.stkListProductChosenInvoice.Children.Add(uc); } wdInvoice.txbTotal.Text = this.HomeWindow.TotalFeeofProductChosenPayment.Text; wdInvoice.txbRetainer.Text = this.HomeWindow.txtRetainerPaymment.Text; wdInvoice.txbChange.Text = this.HomeWindow.txbChangePayment.Text; wdInvoice.txbName.Text = this.HomeWindow.txbAgencyinPayment.Text; wdInvoice.txbPhone.Text = this.HomeWindow.txbPhoneNumberinPayment.Text; wdInvoice.txbAddress.Text = this.HomeWindow.txbAddressinPayment.Text; try { string query = "SELECT * FROM Invoice"; Invoice invoice = DataProvider.Instance.DB.Invoices.SqlQuery(query).Last(); wdInvoice.txbIDinvoice.Text = (invoice.ID + 1).ToString(); } catch { wdInvoice.txbIDinvoice.Text = "1"; } wdInvoice.txbDate.Text = DateTime.Now.ToShortDateString(); Invoice inv = new Invoice(); inv.ID = int.Parse(wdInvoice.txbIDinvoice.Text); inv.AgencyID = int.Parse(this.HomeWindow.txbIDAgencyPayment.Text); inv.Checkout = DateTime.Parse(wdInvoice.txbDate.Text); inv.Debt = ConvertToNumber(wdInvoice.txbChange.Text); //inv.Total = ConvertToNumber(wdInvoice.txbTotal.Text); DataProvider.Instance.DB.Invoices.Add(inv); for (int i = 1; i < wdInvoice.stkListProductChosenInvoice.Children.Count; i++) { InvoiceInfo invInfo = new InvoiceInfo(); InvoiceBusinessUC item = (InvoiceBusinessUC)(wdInvoice.stkListProductChosenInvoice.Children[i]); invInfo.InvoiceID = inv.ID; invInfo.ProductID = int.Parse(item.txbID.Text); invInfo.Amount = int.Parse(item.txbAmount.Text); invInfo.Total = ConvertToNumber(item.txbTotal.Text); DataProvider.Instance.DB.InvoiceInfoes.Add(invInfo); } DataProvider.Instance.DB.SaveChanges(); wdInvoice.ShowDialog(); ReloadBusiness(); }