//NUEVO PRODUCTO public bool AgregarBolson(string nombre, string unidad, string tipo, long cantidad, float precioCompra) { ConexionGeneral CG = new ConexionGeneral(); return(CG.Ejecutor("INSERT INTO Bolson (bolsonNombre, bolsonUnidad, bolsonTipo, bolsonCantidad, bolsonPrecioCompra) VALUES ('" + nombre + "', '" + unidad + "', '" + tipo + "', " + cantidad + ", '" + precioCompra + "')")); //return consulta; }
public int CrearPedido(int mesa) { ConexionGeneral CG = new ConexionGeneral(); CG.Ejecutor("INSERT INTO Pedido (idCliente, tipo, mesa, idEmpleado) VALUES (0, 0," + mesa + ", 0)"); string pedidoString = CG.ValorUnico("SELECT idPedido FROM Pedido ORDER BY idPedido DESC LIMIT 1 "); int pedidoNum = int.Parse(pedidoString); return(pedidoNum); }
/// /////////////////////////////////////////////////////////////////////////////// //ELIMINAR FACTURA //Eliminar factura public bool FacturaEliminar(int idFactura) { ConexionGeneral CG = new ConexionGeneral(); bool exito = false; if (CG.Ejecutor("DELETE FROM FacturaProducto WHERE facturaID = " + idFactura + "")) { if (CG.Ejecutor("DELETE FROM Factura WHERE facturaID = " + idFactura + "")) { exito = true; MessageBox.Show("Factura eliminada"); } else { MessageBox.Show("Hubo un error al eliminar la factura"); } } return(exito); }
//Edita los datos de una factura public void FacturaEditar(int id, string nombre, string fecha, string descuento, string total) { int descuentoEntero = int.Parse(descuento); int totalEntero = int.Parse(total); DataSet DDSS = new DataSet(); ConexionGeneral CG = new ConexionGeneral(); if (CG.Ejecutor("UPDATE Factura SET 'facturaNombre' = '" + nombre + "', 'facturaFecha' = '" + fecha + "', 'facturaDescuento' = " + descuentoEntero + ", 'facturaTotal' = " + totalEntero + " WHERE facturaID = " + id + "")) { } }
// ////////////////////////////////////////////////////////////////////////////////////// //VALIDADORES //Validar producto a agregar a la factura public void ProductoAgregar(int facturaID, string productoID, string productoCantidad, string precioUnitario) { ConexionGeneral CG = new ConexionGeneral(); //int factID = int.Parse(facturaID); int prodID = int.Parse(productoID); int prodCant = int.Parse(productoCantidad); int precioUni = int.Parse(precioUnitario); if (CG.Ejecutor("INSERT INTO FacturaProducto (facturaID, productoID, productoCantidad, productoPrecioUnitario) VALUES (" + facturaID + ", " + prodID + ", " + prodCant + ", " + precioUni + ")")) { //MessageBox.Show("Factura Creada"); } }
// ///////////////////////////////////////////////////////////// // FACTURA CREAR public void FacturaCrear(string nombre, string fecha, string descuento, string facturaTotal) { int descuentoEntero = 0; ConexionGeneral CG = new ConexionGeneral(); if (descuento == "") { descuentoEntero = 0; } else { descuentoEntero = int.Parse(descuento); } int total = Int32.Parse(facturaTotal); if (CG.Ejecutor("INSERT INTO Factura (facturaNombre, facturaFecha, facturaDescuento, facturaTotal) VALUES ('" + nombre + "', '" + fecha + "', " + descuentoEntero + ", " + total + ")")) { //MessageBox.Show("Factura Creada"); } }
public bool AgregarItem(string nombre, string descripcion, float precio, int cantidad) { ConexionGeneral CG = new ConexionGeneral(); return(CG.Ejecutor("INSERT INTO ItemStock ( nombre,descripcion,cantidad,precio ) VALUES ( '" + nombre + "', '" + descripcion + "','" + cantidad + "','" + precio + "')")); }
//MODIFICAR PRODUCTO public bool ModificarBolson(int bolsonId, string nombre, string unidad, string tipo, long cantidad, float precioCompra) { ConexionGeneral CG = new ConexionGeneral(); return(CG.Ejecutor("UPDATE Bolson SET bolsonNombre = '" + nombre + "', bolsonUnidad = '" + unidad + "', bolsonTipo = '" + tipo + "', bolsonCantidad = " + cantidad + ", bolsonPrecioCompra = " + precioCompra + " where bolsonId = " + bolsonId + "")); }
public bool ModificarItem(int codItem, string nombre, string descripcion, float precio, int cantidad) { ConexionGeneral CG = new ConexionGeneral(); return(CG.Ejecutor("UPDATE ItemStock SET nombre = '" + nombre + "',descripcion = '" + descripcion + "', precio = " + precio + " ,cantidad = " + cantidad + " where codItem = " + codItem)); }
//Se ejecuta al editar los productos de una factura. Elimina todos los productos de la factura para que se carguen los nuevos public void EditarEliminarProductosFactura(int idFactura) { ConexionGeneral CG = new ConexionGeneral(); CG.Ejecutor("DELETE FROM FacturaProducto WHERE facturaID = " + idFactura + ""); }
public void MesaVaciar(int numMesa) { ConexionGeneral CG = new ConexionGeneral(); CG.Ejecutor("UPDATE Mesa SET estadoMesa = 0, pedidoMesa = 0 WHERE idMesa = " + numMesa + ""); }
public bool AgregarFactura(int codPedido, int totalFact, string fecha) { ConexionGeneral CG = new ConexionGeneral(); return(CG.Ejecutor("INSERT INTO Factura ( codPedido, totalFact, fecha) VALUES (" + codPedido + "," + totalFact + ", '" + fecha + "')")); }
public bool ModificarItem(int StockId, string codigo, string producto, string categoria, float precioCompra, int cantidad) { ConexionGeneral CG = new ConexionGeneral(); return(CG.Ejecutor("UPDATE Stock SET codigo = '" + codigo + "',producto = '" + producto + "',categoria = '" + categoria + "', precioCompra = " + precioCompra + " ,cantidad = " + cantidad + " where StockId = " + StockId)); }
public bool ModificarEmpleado(int idEmpleado, int dni, string nombre, string direccion, int horas, int vHs, int sueldo) { ConexionGeneral CG = new ConexionGeneral(); return(CG.Ejecutor("UPDATE Empleado SET dni = " + dni + ",nombre = '" + nombre + "',direccion = '" + direccion + "', horas = " + horas + ", Xhs = " + vHs + ",sueldo = " + sueldo + " where idEmpleado = " + idEmpleado)); }
public bool EliminarItem(int codItem) { ConexionGeneral CG = new ConexionGeneral(); return(CG.Ejecutor("DELETE from ItemStock where codItem = " + codItem)); }
//ELIMINAR PRODUCTO public bool EliminarBolson(int bolsonId) { ConexionGeneral CG = new ConexionGeneral(); return(CG.Ejecutor("DELETE from Bolson where bolsonId = " + bolsonId + "")); }
public void PedidoItemCrear(int Itemcod, int cantidad, int precio, int idPedido) { ConexionGeneral CG = new ConexionGeneral(); CG.Ejecutor("INSERT INTO PedidoItem (codItem, cantidad, precio, idPedido) VALUES (" + Itemcod + ", " + cantidad + ", " + precio + "," + idPedido + ")"); }
public bool NuevoEmpleado(int dni, string nombre, string direccion, int horas, int vHs, int sueldo) { ConexionGeneral CG = new ConexionGeneral(); return(CG.Ejecutor("INSERT INTO Empleado ( dni, nombre, direccion, horas, Xhs, sueldo) VALUES ( " + dni + ", '" + nombre + "','" + direccion + "', " + horas + ", " + vHs + ", " + sueldo + ")")); }
public void MesaOcupar(int numMesa, int numPedido) { ConexionGeneral CG = new ConexionGeneral(); CG.Ejecutor("UPDATE Mesa SET estadoMesa = 1, pedidoMesa = " + numPedido + " WHERE idMesa = " + numMesa + ""); }
public bool EliminarEmpleado(int idEmpleado) { ConexionGeneral CG = new ConexionGeneral(); return(CG.Ejecutor("DELETE from Empleado where idEmpleado = " + idEmpleado)); }
public bool AgregarItem(string producto, string codigo, string categoria, string descripcion, string comentario, float precioCompra, int cantidad) { ConexionGeneral CG = new ConexionGeneral(); return(CG.Ejecutor("INSERT INTO Stock ( producto, codigo, categoria, descripcion, comentario, precioCompra, cantidad) VALUES ( '" + producto + "', '" + codigo + "','" + categoria + "','" + descripcion + "', '" + comentario + "'," + precioCompra + "," + cantidad + ")")); }