private void BtnBack_Click(object sender, EventArgs e) { string message = "Apasa DA daca doresti sa salvezi toate modificarile facute. Apasa Nu daca doresti sa nu salvezi nimic"; string title = "Atentie"; MessageBoxButtons buttons = MessageBoxButtons.YesNo; InvoiceModel invoice = new InvoiceModel() { invoiceId = invoiceIdSelected, invoiceNumber = txtNrInvoice.Text, invoiceDate = dateTimePickerInvoiceDate.Value, clientId = 0, clientName = comboBoxClientName.Text, clientAddressId = 0, clientAddress = comboBoxClientAddress.Text, userId = LoginForm.id, observations = txtObs.Text, status = this.statusInv }; if (!IsModify()) { DialogResult result = MessageBox.Show(message, title, buttons, MessageBoxIcon.Information); if (result == DialogResult.No) { iform.Show(); this.Hide(); } else { if (BasicValidation() == false) { return; } SaveInvoice(); iform.UpdateDataGridView(invoice); iform.Show(); this.Hide(); } } else { iform.UpdateDataGridView(invoice); iform.Show(); this.Hide(); } }
private void BtnInvoice_Click(object sender, EventArgs e) { InvoiceListForm invoice = new InvoiceListForm(); invoice.Show(); this.Hide(); invoice.FormClosed += Invoice_FormClosed; }