private void btnSave_Click(object sender, EventArgs e) { string strMessage = string.Empty; strMessage = validate(); if (strMessage != "") { MessageBox.Show(strMessage, "Charlotte", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { try { double dAuxTotal = 0; int idProv = 0; long idInvoiceInserted = 0; int.TryParse(cbProv.SelectedValue.ToString(), out idProv); double.TryParse(tbTotal.Text.Replace(".", ","), out dAuxTotal); idInvoiceInserted = Global.common.insertInvoiceProvSQL(idProv, dtpDateInv.Value.ToShortDateString(), Math.Round(dAuxTotal, 2)); MessageBox.Show("Datos guardados correctamente", "Charlotte", MessageBoxButtons.OK, MessageBoxIcon.Information); UserControl content = new ucListInvoiceProv(); Global.mainForm.pContent.Controls.Clear(); Global.mainForm.pContent.Controls.Add(content); } catch (Exception ex) { Mail.gestionaError(ex.Message); Global.error = true; MessageBox.Show("ERROR", "Charlotte", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void btnBack_Click(object sender, EventArgs e) { UserControl content = new ucListInvoiceProv(); Global.mainForm.pContent.Controls.Clear(); Global.mainForm.pContent.Controls.Add(content); }
private void btnBack_Click(object sender, EventArgs e) { try { Cursor.Current = Cursors.WaitCursor; UserControl content = new ucListInvoiceProv(); Global.mainForm.pContent.Controls.Clear(); Global.mainForm.pContent.Controls.Add(content); Cursor.Current = Cursors.Default; } catch (Exception ex) { Mail.gestionaError(ex.Message); Global.error = true; MessageBox.Show("ERROR", "Charlotte", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnEdit_Click(object sender, EventArgs e) { string strMessage = string.Empty; try { strMessage = validate(); if (string.IsNullOrEmpty(strMessage)) { if (Global.common.updateProviderInvoiceTotalSQL(Global.idInvoice, tbTotal.Text.Replace(",", "."))) { //DataTable listaLineas = null; //listaLineas = Global.common.getAllLinesInvoiceSQL(Global.idInvoice); //double dTotal = 0; //foreach (DataRow row in listaLineas.Rows) //{ // double dAux = 0; // int dAuxInt = 0; // double.TryParse(row[3].ToString(), out dAux); // int.TryParse(row[4].ToString(), out dAuxInt); // dTotal += dAux * dAuxInt; //} MessageBox.Show("Total de factura actualizado", "Charlotte", MessageBoxButtons.OK, MessageBoxIcon.Information); Cursor.Current = Cursors.WaitCursor; UserControl content = new ucListInvoiceProv(); Global.mainForm.pContent.Controls.Clear(); Global.mainForm.pContent.Controls.Add(content); Cursor.Current = Cursors.Default; } } else { MessageBox.Show(strMessage, "Charlotte", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { Mail.gestionaError(ex.Message); Global.error = true; MessageBox.Show("ERROR", "Charlotte", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnRemove_Click(object sender, EventArgs e) { try { DialogResult result = MessageBox.Show("¿Quieres anular la factura?", "Charlotte", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { if (Global.common.deleteInvProvSQL(Global.idInvoice)) { Global.idTicket = 0; MessageBox.Show("Factura eliminada correctamente", "Charlotte", MessageBoxButtons.OK, MessageBoxIcon.Information); Cursor.Current = Cursors.WaitCursor; UserControl content = new ucListInvoiceProv(); Global.mainForm.pContent.Controls.Clear(); Global.mainForm.pContent.Controls.Add(content); Cursor.Current = Cursors.Default; } else { MessageBox.Show("ERROR", "Charlotte", MessageBoxButtons.OK, MessageBoxIcon.Information); Cursor.Current = Cursors.WaitCursor; UserControl content = new ucListInvoiceProv(); Global.mainForm.pContent.Controls.Clear(); Global.mainForm.pContent.Controls.Add(content); Cursor.Current = Cursors.Default; } } else if (result == DialogResult.No) { Cursor.Current = Cursors.WaitCursor; UserControl content = new ucListInvoiceProv(); Global.mainForm.pContent.Controls.Clear(); Global.mainForm.pContent.Controls.Add(content); Cursor.Current = Cursors.Default; } } catch (Exception ex) { Mail.gestionaError(ex.Message); Global.error = true; MessageBox.Show("ERROR", "Charlotte", MessageBoxButtons.OK, MessageBoxIcon.Error); } }