private void btnGrabar_Click(object sender, EventArgs e) { // int i; /*Conn.InsertOrUpdate("delete from pago_cheque where idfactura = " + idfactura); * Conn.InsertOrUpdate("delete from pago_contado where idfactura = " + idfactura); */ if (txtSaldo.Text == "0") { Conn.InsertOrUpdate("update pago_factura set ibb = " + txtIBB.Text + ",ganancias = " + txtGanancias.Text + ",suss = " + txtSUSS.Text + ",saldo = " + txtSaldo.Text + ",pagado = true where idfactura = " + idfactura); } else { Conn.InsertOrUpdate("update pago_factura set ibb = " + txtIBB.Text + ",ganancias = " + txtGanancias.Text + ",suss = " + txtSUSS.Text + ",saldo = " + txtSaldo.Text + ",pagado = false where idfactura = " + idfactura); } Salir(); }
public Boolean liquidarCuentaCorriente(clsConexion C, String fechaDesde, String fechaHasta, String fechaLiquidacion, DataGridView dataGridRemitos, String descripcion, String tipoFact, String iduser, String numFact) { bool succes = true; try { C.InsertOrUpdate("truncate table remitosaLiquidar"); //create procedure crear_factura(in facturaA boolean,in nro_factura varchar(8), in fecha varchar(10)) if (hayRemitos(C, dataGridRemitos)) { InsertarRemitosALiquidar(C, dataGridRemitos); String stringStoreProc = "call crear_factura(" + "'" + fechaLiquidacion + "'" + "," + "'" + fechaDesde + "'" + "," + "'" + fechaHasta + "'" + "," + "'" + descripcion + "'" + "," + "'" + tipoFact + "'" + "," + "'" + iduser + "'" + "," + numFact + ")"; C.InsertOrUpdate(stringStoreProc); } else { succes = false; } } catch { } return(succes); }
private void btnAgregar_Click(object sender, EventArgs e) { if (txtCiudad.Text != "") { if (!YaExiste(txtCiudad.Text)) { Conn.InsertOrUpdate("insert into city (ciudad) values ('" + txtCiudad.Text.ToUpper() + "')"); cargarCiudad(); txtCiudad.Text = ""; } else { MessageBox.Show("La ciudad ya esta cargada en el sistema.", "Gestión - Ciudades", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
private void InsertarProductosRemito(clsConexion C, DataGridView productos) { DataGridViewCell dgc; String cantidad; String descripcion; String kg; String pu; String codigo; for (int i = 0; i < productos.Rows.Count; i++) { dgc = productos.Rows[i].Cells[0]; cantidad = (dgc.Value).ToString(); dgc = productos.Rows[i].Cells[1]; descripcion = (dgc.Value).ToString(); dgc = productos.Rows[i].Cells[2]; kg = (dgc.Value).ToString().Replace(",", "."); dgc = productos.Rows[i].Cells[3]; pu = (dgc.Value).ToString().Replace(",", "."); dgc = productos.Rows[i].Cells[4]; codigo = (dgc.Value).ToString(); String insertProd = "insert into productos_vender(codprod,cant,descr,kgs,prec) values (" + codigo + "," + cantidad + "," + "'" + descripcion + "'" + "," + kg + "," + pu + ")"; C.InsertOrUpdate(insertProd); } }
public bool Insertar(clsConexion C, List <String> datos, DataGridView productos) { bool success = true; try { C.InsertOrUpdate("truncate table productos_vender"); stringStoreProc = "call crear_remito(" + "'" + reempIfNula(datos[0]) + "'" + "," + "'" + reempIfNula(datos[1]) + "'" + "," + "'" + reempIfNula(datos[2]) + "'" + "," + "'" + reempIfNula(datos[3]) + "'" + "," + "'" + reempIfNula(datos[4]) + "'" + "," + "'" + reempIfNula(datos[5]) + "'" + "," + "'" + reempIfNula(datos[6]) + "'" + "," + "'" + reempIfNula(datos[7]) + "'" + "," + "'" + reempIfNula(datos[8]) + "'" + "," + "'" + reempIfNula(datos[9]) + "'" + "," + "'" + reempIfNula(datos[10]) + "'" + "," + reempIfNula(datos[11]) + "," + reempIfNula(datos[12]) + "," + reempIfNula(datos[13]) + "," + reempIfNula(datos[14]) + "," + "'" + reempIfNula(datos[15]) + "'" + "," + reempIfNula(datos[16]) + "," + "'" + reempIfNula(datos[17]) + "'" + "," + reempIfNula(datos[18]) + ")"; InsertarProductosRemito(C, productos); Console.WriteLine(stringStoreProc); C.InsertOrUpdate(stringStoreProc); if (productos.Rows.Count == 0) { MessageBox.Show("No hay productos"); success = false; } } catch { success = false; } return(success); }
public bool Insertar(clsConexion C, List<String> datos, DataGridView productos) { bool success = true; try { C.InsertOrUpdate("truncate table productos_vender"); stringStoreProc= "call crear_remito(" +"'"+reempIfNula(datos[0])+"'"+","+ "'"+reempIfNula(datos[1])+"'"+","+ "'"+reempIfNula(datos[2])+"'"+","+ "'"+reempIfNula(datos[3])+"'"+","+ "'"+reempIfNula(datos[4])+"'"+","+ "'"+reempIfNula(datos[5])+"'"+","+ "'"+reempIfNula(datos[6])+"'"+","+ "'"+reempIfNula(datos[7])+"'"+","+ "'"+reempIfNula(datos[8])+"'"+","+ "'"+reempIfNula(datos[9])+"'"+","+ "'" + reempIfNula(datos[10]) + "'" + "," + reempIfNula(datos[11])+","+ reempIfNula(datos[12])+ "," + reempIfNula(datos[13])+ "," + reempIfNula(datos[14])+ "," + "'"+reempIfNula(datos[15])+"'"+","+ reempIfNula(datos[16])+ "," + "'"+reempIfNula(datos[17])+"'"+","+ reempIfNula(datos[18])+")"; InsertarProductosRemito(C, productos); Console.WriteLine(stringStoreProc); C.InsertOrUpdate(stringStoreProc); if (productos.Rows.Count == 0) { MessageBox.Show("No hay productos"); success = false; } } catch { success = false; } return success; }
public void Eliminar(clsConexion C,String idcliente) { try { C.InsertOrUpdate("delete from clientes where idcliente = " + idcliente); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void Insertar(clsConexion C, List<String> datos) { try { C.InsertOrUpdate("insert into producto(nombre, precio,idcliente,descripcion) values ('" + datos[0] + "'," + datos[1] + "," + datos[2] + ",'" + datos[3] + "')"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public Boolean liquidarContado(clsConexion C, String fechaDesde, String fechaHasta, String numRemito, String descripcion, String tipoFact, String iduser, String numFact) { bool succes = true;; try { String fechaAct = DateTime.Now.ToString("yyyy-MM-dd"); C.InsertOrUpdate("truncate remitosaLiquidar"); C.InsertOrUpdate("insert into remitosaLiquidar values(" + numRemito + ");"); String stringStoreProc = "call crear_factura(" + "'" + fechaAct + "'" + "," + "'" + fechaDesde + "'" + "," + "'" + fechaHasta + "'" + "," + "'" + descripcion + "'" + "," + "'" + tipoFact + "'" + "," + "'" + iduser + "'" + "," + numFact + ");"; C.InsertOrUpdate(stringStoreProc); System.Console.WriteLine(stringStoreProc); } catch { succes = false; } return(succes); }
public void Eliminar(clsConexion C, String nombre) { try { C.InsertOrUpdate("delete from usuario where nombre = '" + nombre + "'"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void Insertar(clsConexion C, List <String> datos) { try { C.InsertOrUpdate("insert into producto(nombre, precio,idcliente,descripcion) values ('" + datos[0] + "'," + datos[1] + "," + datos[2] + ",'" + datos[3] + "')"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void Eliminar(clsConexion C, String idcliente) { try { C.InsertOrUpdate("delete from clientes where idcliente = " + idcliente); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void Eliminar(clsConexion C, String codigo) { try { C.InsertOrUpdate("delete from producto where codigo = " + codigo); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnGrabar_Click(object sender, EventArgs e) { String stringUpdate = "update empresa set nombre=" + "'" + txtNombre.Text + "'" + "," + "direccion=" + "'" + txtDireccion.Text + "'" + "," + "telefono=" + "'" + txtTelefono.Text + "'" + "," + "ciudad=" + "'" + txtCiudad.Text + "'" + "where idempresa=" + idEmp.ToString(); C.InsertOrUpdate(stringUpdate); frmEmpresa_FormClosing(null, null); }
public void Insertar(clsConexion C, List <String> datos) { try { C.InsertOrUpdate("insert into clientes(cuil, nombre, apellido, direccion, ciudad, codigo_postal, telefono,celular,email,porcentaje_vd,porcentaje_cr,credito) values ('" + datos[0] + "','" + datos[1] + "','" + datos[2] + "','" + datos[3] + "','" + datos[4] + "','" + datos[5] + "','" + datos[6] + "','" + datos[7] + "','" + datos[8] + "'," + datos[9] + "," + datos[10] + "," + datos[11] + ")"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void Insertar(clsConexion C, List<String> datos) { try { C.InsertOrUpdate("insert into clientes(cuil, nombre, apellido, direccion, ciudad, codigo_postal, telefono,celular,email,porcentaje_vd,porcentaje_cr,credito) values ('" + datos[0] + "','" + datos[1] + "','" + datos[2] + "','" + datos[3] + "','" + datos[4] + "','" + datos[5] + "','" + datos[6] + "','" + datos[7] + "','" + datos[8] + "'," + datos[9] + "," + datos[10] + "," + datos[11] + ")"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnGrabar_Click(object sender, EventArgs e) { try { Conn.InsertOrUpdate("insert into pago_contado (fecha,nro_recibo,monto,idfactura) values ('" + datePagoContado.Value.ToString("yyyy-MM-dd") + "'," + txtNroRecibo.Text + "," + txtImporte.Text + "," + idfactura + ")"); Principal.CargarPagos(); Salir(); } catch (Exception ex) { MessageBox.Show("Error insercion contado: " + ex.Message); } }
public void Actualizar(clsConexion C, List <String> datos) { try { C.InsertOrUpdate("update producto set " + " nombre = '" + datos[1] + "'" + ", precio = " + datos[2].Replace(",", ".") + ", idcliente = " + datos[3] + ", descripcion = '" + datos[4] + "' WHERE codigo = " + datos[0]); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void Actualizar(clsConexion C, List<String> datos) { try { C.InsertOrUpdate("update producto set " + " nombre = '" + datos[1] + "'" + ", precio = " + datos[2].Replace(",", ".") + ", idcliente = " + datos[3] + ", descripcion = '" + datos[4] + "' WHERE codigo = " + datos[0]); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnActualizarFacturaAceptar_Click(object sender, EventArgs e) { String numFact = textBoxNumFactura.Text.ToString(); try{ if (!prc.facturaValida(numFact)) { MessageBox.Show("El número de factura ya existe o es incorrecto"); } else { C.InsertOrUpdate("update factura set idfactura=" + numFact + " where idfactura=" + oldNumFact); C.InsertOrUpdate("update pago_factura set idfactura=" + numFact + " where idfactura=" + oldNumFact); C.InsertOrUpdate("update pago_cheque set idfactura=" + numFact + " where idfactura=" + oldNumFact); C.InsertOrUpdate("update pago_contado set idfactura=" + numFact + " where idfactura=" + oldNumFact); C.InsertOrUpdate("update remito set idfactura=" + numFact + " where idfactura=" + oldNumFact); prc.ActualizarFacturas(); this.Dispose(); } } catch { } }
private void InsertarRemitosALiquidar(clsConexion C, DataGridView remitos) { DataGridViewCell dgc; String remitoSeleccionado; String idremito; for (int i = 0; i < remitos.Rows.Count; i++) { dgc = remitos.Rows[i].Cells[6]; remitoSeleccionado = (remitos.Rows[i].Cells[0]).Value.ToString(); if (remitoSeleccionado == "True") { idremito = (dgc.Value).ToString(); C.InsertOrUpdate("insert into remitosaLiquidar(idremito) values (" + idremito + ");"); } } }
public void Insertar(clsConexion C, String nombre, String password) { try { C.CargarDatos(dsUsuario, "dsUsuario", "select iduser from usuario where nombre = '" + nombre + "'"); if (dsUsuario.Tables[0].Rows.Count == 0) { C.InsertOrUpdate("insert into usuario (nombre,password) values ('" + nombre + "','" + password + "')"); } else { MessageBox.Show("El nombre de usuario ya existe en el sistema", "Gestión - Administración de Usuarios", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void Actualizar(clsConexion C, String old_name, String nombre, String password) { try { C.CargarDatos(dsUsuario,"dsUsuario","select iduser from usuario where nombre = '" + nombre + "'"); if (dsUsuario.Tables[0].Rows.Count != 0) { C.InsertOrUpdate("update usuario set nombre = '" + nombre + "', password = '******' WHERE nombre = '" + old_name + "'"); } else { MessageBox.Show("El nombre de usuario ya existe en el sistema","Gestión - Administración de Usuarios",MessageBoxButtons.OK,MessageBoxIcon.Warning); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void Actualizar(clsConexion C, String old_name, String nombre, String password) { try { C.CargarDatos(dsUsuario, "dsUsuario", "select iduser from usuario where nombre = '" + nombre + "'"); if (dsUsuario.Tables[0].Rows.Count != 0) { C.InsertOrUpdate("update usuario set nombre = '" + nombre + "', password = '******' WHERE nombre = '" + old_name + "'"); } else { MessageBox.Show("El nombre de usuario ya existe en el sistema", "Gestión - Administración de Usuarios", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void Insertar(clsConexion C, String nombre,String password) { try { C.CargarDatos(dsUsuario,"dsUsuario","select iduser from usuario where nombre = '" + nombre + "'"); if (dsUsuario.Tables[0].Rows.Count == 0) { C.InsertOrUpdate("insert into usuario (nombre,password) values ('" + nombre + "','" + password + "')"); } else { MessageBox.Show("El nombre de usuario ya existe en el sistema","Gestión - Administración de Usuarios",MessageBoxButtons.OK,MessageBoxIcon.Warning); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void Actualizar(clsConexion C,List<String> datos) { try { C.InsertOrUpdate("update clientes set cuil = '" + datos[0] + "'" + ", nombre = '" + datos[1] + "'" + ", apellido = '" + datos[2] + "'" + ", direccion = '" + datos[3] + "'" + ", ciudad = '" + datos[4] + "'" + ", codigo_postal = '" + datos[5] + "'" + ", telefono = '" + datos[6] + "'" + ", celular = '" + datos[7] + "'" + ", email = '" + datos[8] + "'" + ", porcentaje_vd = " + datos[9] + ", porcentaje_cr = " + datos[10] + ", credito = " + datos[11] + " WHERE idcliente = " + datos[12]); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void Actualizar(clsConexion C, List <String> datos) { try { C.InsertOrUpdate("update clientes set cuil = '" + datos[0] + "'" + ", nombre = '" + datos[1] + "'" + ", apellido = '" + datos[2] + "'" + ", direccion = '" + datos[3] + "'" + ", ciudad = '" + datos[4] + "'" + ", codigo_postal = '" + datos[5] + "'" + ", telefono = '" + datos[6] + "'" + ", celular = '" + datos[7] + "'" + ", email = '" + datos[8] + "'" + ", porcentaje_vd = " + datos[9] + ", porcentaje_cr = " + datos[10] + ", credito = " + datos[11] + " WHERE idcliente = " + datos[12]); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void updateFact() { String nonQuery = ""; DataSet dataSet = new DataSet(); try { C.CargarDatos(dataSet, "DataSet", "select idfactura,total from factura"); for (int i = 0; i < dataSet.Tables[0].Rows.Count; i++) { String numFact = dataSet.Tables[0].Rows[i][0].ToString(); String total = dataSet.Tables[0].Rows[i][1].ToString(); if (!existePago(numFact)) { nonQuery = "insert into pago_factura(idfactura,pagado,ibb,ganancias,suss,saldo) values(" + numFact + ",false,null,null,null," + total + ")"; C.InsertOrUpdate(nonQuery); } } } catch { } }
public Boolean liquidarCuentaCorriente(clsConexion C, String fechaDesde, String fechaHasta,String fechaLiquidacion, DataGridView dataGridRemitos, String descripcion, String tipoFact, String iduser, String numFact) { bool succes = true; try { C.InsertOrUpdate("truncate table remitosaLiquidar"); //create procedure crear_factura(in facturaA boolean,in nro_factura varchar(8), in fecha varchar(10)) if (hayRemitos(C, dataGridRemitos)) { InsertarRemitosALiquidar(C, dataGridRemitos); String stringStoreProc = "call crear_factura(" + "'" + fechaLiquidacion + "'" + "," + "'" + fechaDesde + "'" + "," + "'" + fechaHasta + "'" + "," + "'" + descripcion + "'" + "," + "'" + tipoFact + "'" + "," + "'" + iduser + "'" + "," + numFact + ")"; C.InsertOrUpdate(stringStoreProc); } else succes = false; } catch { } return succes; }
public Boolean liquidarContado(clsConexion C, String fechaDesde,String fechaHasta, String numRemito, String descripcion, String tipoFact,String iduser,String numFact) { bool succes = true; ; try { String fechaAct = DateTime.Now.ToString("yyyy-MM-dd"); C.InsertOrUpdate("truncate remitosaLiquidar"); C.InsertOrUpdate("insert into remitosaLiquidar values(" + numRemito + ");"); String stringStoreProc = "call crear_factura(" + "'" + fechaAct + "'" + "," + "'" + fechaDesde + "'" + "," + "'" + fechaHasta + "'" + "," + "'" + descripcion + "'" + "," + "'" + tipoFact + "'" + "," + "'" + iduser + "'" + "," + numFact + ");"; C.InsertOrUpdate(stringStoreProc); System.Console.WriteLine(stringStoreProc); } catch { succes = false; } return (succes); }
public void borrarItem(clsConexion C, String consulta) { C.InsertOrUpdate(consulta); }
private void InsertarProductosRemito(clsConexion C, DataGridView productos) { DataGridViewCell dgc; String cantidad; String descripcion; String kg; String pu; String codigo; for (int i = 0; i < productos.Rows.Count; i++) { dgc = productos.Rows[i].Cells[0]; cantidad=(dgc.Value).ToString(); dgc = productos.Rows[i].Cells[1]; descripcion = (dgc.Value).ToString(); dgc = productos.Rows[i].Cells[2]; kg = (dgc.Value).ToString().Replace(",", "."); dgc = productos.Rows[i].Cells[3]; pu = (dgc.Value).ToString().Replace(",","."); dgc = productos.Rows[i].Cells[4]; codigo = (dgc.Value).ToString(); String insertProd = "insert into productos_vender(codprod,cant,descr,kgs,prec) values (" + codigo + "," + cantidad + "," + "'" + descripcion + "'" + "," + kg + "," + pu + ")"; C.InsertOrUpdate(insertProd); } }
private void EliminarRemito() { Conn.InsertOrUpdate("delete from productos_vendidos where idremito = " + idRemito); Conn.InsertOrUpdate("delete from remito where idremito = " + idRemito); }