コード例 #1
0
        private void Save(bool print)
        {
            B_Print.Enabled = B_Save.Enabled = false;
            var notif = Notification.Create("Creating Invoices", "Gathering required information..", SlickControls.Enums.PromptIcons.Info, null).Show(Form);

            new Action(() =>
            {
                var invs = new List <int>();
                System.Threading.Thread.Sleep(1000);

                foreach (var cust in Customers.Where(x => x.NewCounter > x.CurrentCounter))
                {
                    notif.SetText(cust.ToString());
                    invs.Add(SqlHandler.SaveInvoice(new Invoice()
                    {
                        CustomerID      = cust.ID,
                        StartingCounter = cust.CurrentCounter,
                        EndingCounter   = cust.NewCounter,
                        Date            = new DateTime((int)DD_Year.SelectedItem, (int)DD_Month.SelectedItem, DateTime.Today.Day)
                    }));

                    System.Threading.Thread.Sleep(75);
                }

                notif.Close();
                this.TryInvoke(() =>
                {
                    B_Print.Enabled = B_Save.Enabled = true;

                    if (print)
                    {
                        InvoicePrint.Print(Form, SqlHandler.GetInvoicesPrint(invs.Select(x => new Invoice()
                        {
                            ID = x
                        })));
                    }
                });
            }).RunInBackground();
        }
コード例 #2
0
 private void B_Print_Click(object sender, EventArgs e)
 {
     InvoicePrint.Print(Form, SqlHandler.GetInvoicesPrint(GetInvoices()));
 }