Esempio n. 1
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if ((DbCommunication.Exists("Invoices", "InvNumber", InvoiceNumber.ToString()) == 1) && (InvoiceNumber == InvoiceCounter))
            {
                DbCommunication.Delete("Invoices", "InvNumber", InvoiceNumber.ToString());
                DbCommunication.Delete("InvoiceItems", "Invoice_ID", InvoiceNumber.ToString());

                dgvInvoices.DataSource = DbCommunication.DisplayData(SearchQuery);
                InvoiceNumber          = Invoice_DbCommunication.GetInvoiceNumber();
                InvoiceCounter         = InvoiceNumber;

                MessageBox.Show
                (
                    "Фактурата е успешно избришана!",
                    "Избриши",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Information
                );
            }
            else
            {
                MessageBox.Show
                (
                    "Таа фактура не може да се избрише!",
                    "Грешка",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error
                );
            }
        }
Esempio n. 2
0
        private void btnNew_Click(object sender, EventArgs e)
        {
            if (tbCustomer.Text != "")
            {
                InvoiceNumber = Invoice_DbCommunication.GetInvoiceNumber();
                InvoiceCounter++;

                Invoice_DbCommunication.AddInvoice(Customer_DbCommunication.GetCustomerDBID(CustomerPick.selectecCustomerInfo.Name), InvoiceCounter, mtbDate.Text, tbValuta.Text, cbDocType.SelectedItem.ToString(), tbDescription.Text);

                dgvInvoices.DataSource = DbCommunication.DisplayData(SearchQuery);

                ResetBoxes();
                SetInvoiceNumberTextBox();
            }
            else
            {
                MessageBox.Show
                (
                    "Одберете купувач (F1).",
                    "Грешка",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error
                );
            }
        }
Esempio n. 3
0
        private void OutgoingInvoices_Load(object sender, EventArgs e)
        {
            this.WindowState = FormWindowState.Maximized;
            selectedCustomer = new CustomerInfo();

            InitDefaultSettings();
            InvoiceNumber  = Invoice_DbCommunication.GetInvoiceNumber();
            InvoiceCounter = InvoiceNumber;
            SetInvoiceNumberTextBox();

            dgvInvoices.DataSource = DbCommunication.DisplayData(SearchQuery);
        }