public void Agregar() { Clases.Conexion conexion = new Clases.Conexion(); SqlCommand cmd = new SqlCommand("SP_AgregarInsumo", conexion.conexion); cmd.CommandType = CommandType.StoredProcedure; try { conexion.Abrir(); cmd.Parameters.Add(new SqlParameter("nombre", SqlDbType.NVarChar, 100)); cmd.Parameters["nombre"].Value = Nombre; cmd.Parameters.Add(new SqlParameter("costo", SqlDbType.Decimal)); cmd.Parameters["costo"].Value = Costo; cmd.Parameters.Add(new SqlParameter("cantidad", SqlDbType.Decimal)); cmd.Parameters["cantidad"].Value = Cantidad; cmd.Parameters.Add(new SqlParameter("cantidadMinima", SqlDbType.Decimal)); cmd.Parameters["cantidadMinima"].Value = CantidadMinima; cmd.Parameters.Add(new SqlParameter("idTipoUnidad", SqlDbType.Int)); cmd.Parameters["idTipoUnidad"].Value = IdTipoUnidad; cmd.Parameters.Add(new SqlParameter("descripcion", SqlDbType.NVarChar, 200)); cmd.Parameters["descripcion"].Value = Descripcion; cmd.Parameters.Add(new SqlParameter("idProveedor", SqlDbType.Int)); cmd.Parameters["idProveedor"].Value = IdProveedor; cmd.ExecuteNonQuery(); } catch (SqlException ex) { throw new Clases.Exepcion(ex.Message, ex, "Clase_Insumo"); } finally { conexion.Cerrar(); } }
public static DataView GetDataView() { Clases.Conexion conexion = new Clases.Conexion(); //colocar el nombre del area a la cual pertenece el usuario en el strin de conexion string sql = @"SELECT Acceso.Usuarios.id as Código, Acceso.Usuarios.nombre as Nombre, Acceso.Usuarios.apellido as Apellido, Acceso.Usuarios.usuario as Usuario FROM Acceso.Usuarios;"; try { SqlDataAdapter data = new SqlDataAdapter(); data.SelectCommand = new SqlCommand(sql, conexion.conexion); DataSet ds = new DataSet(); data.Fill(ds, "Acceso.Usuarios"); DataTable dt = ds.Tables["Acceso.Usuarios"]; DataView dv = new DataView(dt, "", "Código", DataViewRowState.Unchanged); return(dv); } catch (SqlException ex) { throw ex; } finally { conexion.Cerrar(); } }
public static DataView GetDataView() { Clases.Conexion conexion = new Clases.Conexion(); //colocar el nombre del area a la cual pertenece el usuario en el string de conexion string sql = @"SELECT Restaurante.Areas.id as Código, Restaurante.Areas.nombre as Areas, Restaurante.Areas.numeroMesas as [Número Mesas] FROM Restaurante.Areas"; try { SqlDataAdapter data = new SqlDataAdapter(); data.SelectCommand = new SqlCommand(sql, conexion.conexion); DataSet ds = new DataSet(); data.Fill(ds, "Restaurante.Areas"); DataTable dt = ds.Tables["Restaurante.Areas"]; DataView dv = new DataView(dt, "", "Código", DataViewRowState.Unchanged); return(dv); } catch (SqlException ex) { throw ex; } finally { conexion.Cerrar(); } }
public void Modificar() { Clases.Conexion conexion = new Clases.Conexion(); SqlCommand cmd = new SqlCommand("SP_ModificarInsumosProductos", conexion.conexion); cmd.CommandType = CommandType.StoredProcedure; try { conexion.Abrir(); cmd.Parameters.Add(new SqlParameter("idInsumoProducto", SqlDbType.Int)); cmd.Parameters["idInsumoProducto"].Value = IdInsumoProducto; cmd.Parameters.Add(new SqlParameter("idInsumo", SqlDbType.Int)); cmd.Parameters["idInsumo"].Value = IdInsumo; cmd.Parameters.Add(new SqlParameter("idInventario", SqlDbType.Int)); cmd.Parameters["idInventario"].Value = IdInventario; cmd.Parameters.Add(new SqlParameter("cantidad", SqlDbType.Decimal)); cmd.Parameters["cantidad"].Value = Cantidad; cmd.ExecuteNonQuery(); } catch (SqlException ex) { throw new Clases.Exepcion(ex.Message, ex, "Clase_InsumosProductos"); } finally { conexion.Cerrar(); } }
public void Modificar() { Clases.Conexion conexion = new Clases.Conexion(); SqlCommand cmd = new SqlCommand("SP_ModificarMesero", conexion.conexion); cmd.CommandType = CommandType.StoredProcedure; try { conexion.Abrir(); cmd.Parameters.Add(new SqlParameter("id", SqlDbType.Int)); cmd.Parameters["id"].Value = Id; cmd.Parameters.Add(new SqlParameter("identidad", SqlDbType.NVarChar, 15)); cmd.Parameters["identidad"].Value = Identidad; cmd.Parameters.Add(new SqlParameter("nombre", SqlDbType.NVarChar, 25)); cmd.Parameters["nombre"].Value = Nombre; cmd.Parameters.Add(new SqlParameter("apellido", SqlDbType.NVarChar, 25)); cmd.Parameters["apellido"].Value = Apellido; cmd.ExecuteNonQuery(); } catch (SqlException ex) { throw ex; } finally { conexion.Cerrar(); } }
public static DataView GetDataView() { Clases.Conexion conexion = new Clases.Conexion(); string sql = @"SELECT Restaurante.CategoriaProducto.idCategoria as Código, Restaurante.CategoriaProducto.descripcion as Descripción FROM Restaurante.CategoriaProducto"; try { SqlDataAdapter data = new SqlDataAdapter(); data.SelectCommand = new SqlCommand(sql, conexion.conexion); DataSet ds = new DataSet(); data.Fill(ds, "Restaurante.CategoriaProducto"); DataTable dt = ds.Tables["Restaurante.CategoriaProducto"]; DataView dv = new DataView(dt, "", "Código", DataViewRowState.Unchanged); return(dv); } catch (SqlException ex) { throw ex; } finally { conexion.Cerrar(); } }
public void Modificar() { Clases.Conexion conexion = new Clases.Conexion(); SqlCommand cmd = new SqlCommand("SP_ModificarProveedor", conexion.conexion); cmd.CommandType = CommandType.StoredProcedure; try { conexion.Abrir(); cmd.Parameters.Add(new SqlParameter("idProveedor", SqlDbType.Int)); cmd.Parameters["idProveedor"].Value = Id; cmd.Parameters.Add(new SqlParameter("nombre", SqlDbType.NVarChar, 100)); cmd.Parameters["nombre"].Value = Nombre; cmd.Parameters.Add(new SqlParameter("telefono", SqlDbType.NVarChar, 9)); cmd.Parameters["telefono"].Value = this.Telefono; cmd.Parameters.Add(new SqlParameter("direccion", SqlDbType.NVarChar, 300)); cmd.Parameters["direccion"].Value = this.Direccion; cmd.ExecuteNonQuery(); } catch (SqlException ex) { throw ex; } finally { conexion.Cerrar(); } }
public void Modificar() { Clases.Conexion conexion = new Clases.Conexion(); SqlCommand cmd = new SqlCommand("SP_ModificarArea", conexion.conexion); cmd.CommandType = CommandType.StoredProcedure; try { conexion.Abrir(); cmd.Parameters.Add(new SqlParameter("id", SqlDbType.Int)); cmd.Parameters["id"].Value = Id; cmd.Parameters.Add(new SqlParameter("nombre", SqlDbType.NVarChar, 50)); cmd.Parameters["nombre"].Value = Nombre; cmd.Parameters.Add(new SqlParameter("numeroMesas", SqlDbType.TinyInt)); cmd.Parameters["numeroMesas"].Value = NumeroMesas; cmd.ExecuteNonQuery(); } catch (SqlException ex) { throw ex; } finally { conexion.Cerrar(); } }
public void Agregar() { Clases.Conexion conexion = new Clases.Conexion(); SqlCommand cmd = new SqlCommand("SP_InsertarUsuario", conexion.conexion); cmd.CommandType = CommandType.StoredProcedure; try { conexion.Abrir(); cmd.Parameters.Add(new SqlParameter("Nombre", SqlDbType.NVarChar, 25)); cmd.Parameters["nombre"].Value = this.nombre; cmd.Parameters.Add(new SqlParameter("Apellido", SqlDbType.NVarChar, 25)); cmd.Parameters["apellido"].Value = this.apellido; cmd.Parameters.Add(new SqlParameter("Clave", SqlDbType.NVarChar, 20)); cmd.Parameters["clave"].Value = this.clave; cmd.Parameters.Add(new SqlParameter("idRol", SqlDbType.Int)); cmd.Parameters["idRol"].Value = this.rol; cmd.ExecuteNonQuery(); } catch (SqlException ex) { throw ex; } finally { conexion.Cerrar(); } }
public static DataView GetDataViewInsumo(string descripcion) { Clases.Conexion conexion = new Clases.Conexion(); string sql = @"SELECT Restaurante.Insumos.idInsumo as Código, Restaurante.Insumos.nombre as Insumo, Restaurante.Insumos.costo as Costo, Restaurante.Insumos.cantidad as Cantidad, Restaurante.TipoUnidad.descripcion as Unidad FROM Restaurante.TipoUnidad INNER JOIN Restaurante.Insumos ON Restaurante.TipoUnidad.idTipoUnidad = Restaurante.Insumos.idTipoUnidad WHERE nombre = '" + descripcion + "'; "; try { SqlDataAdapter data = new SqlDataAdapter(); data.SelectCommand = new SqlCommand(sql, conexion.conexion); DataSet ds = new DataSet(); data.Fill(ds, "Restaurante.Insumos"); DataTable dt = ds.Tables["Restaurante.Insumos"]; DataView dv = new DataView(dt, "", "Código", DataViewRowState.Unchanged); return(dv); } catch (SqlException ex) { throw ex; } finally { conexion.Cerrar(); } }
public static DataView GetDataView(int IdInventario) { Clases.Conexion conexion = new Clases.Conexion(); //string sql = @"SELECT Restaurante.InsumosProductos.idInsumoProducto as Código, // Restaurante.InsumosProductos.idInsumo as Insumo, // Restaurante.InsumosProductos.idInventario as Producto, // Restaurante.InsumosProductos.cantidad as Cantidad // FROM Restaurante.InsumosProductos // WHERE idInventario = '" + IdInventario + "'; "; string sql = @"SELECT Restaurante.InsumosProductos.idInsumoProducto as Código, Restaurante.Insumos.nombre as Insumo, Restaurante.Inventario.descripcion as Producto, Restaurante.InsumosProductos.cantidad as Cantidad FROM Restaurante.Inventario INNER JOIN Restaurante.InsumosProductos ON Restaurante.Inventario.idInventario = Restaurante.InsumosProductos.idInventario INNER JOIN Restaurante.Insumos ON Restaurante.Insumos.idInsumo = Restaurante.InsumosProductos.idInsumo WHERE Restaurante.InsumosProductos.idInventario = '" + IdInventario + "'; "; try { SqlDataAdapter data = new SqlDataAdapter(); data.SelectCommand = new SqlCommand(sql, conexion.conexion); DataSet ds = new DataSet(); data.Fill(ds, "Restaurante.InsumosProductos"); DataTable dt = ds.Tables["Restaurante.InsumosProductos"]; DataView dv = new DataView(dt, "", "Código", DataViewRowState.Unchanged); return(dv); } catch (SqlException ex) { throw ex; } finally { conexion.Cerrar(); } }
public static DataView GetDataView() { Clases.Conexion conexion = new Clases.Conexion(); string sql = @"SELECT Restaurante.Inventario.idInventario as Código, Restaurante.Inventario.descripcion as Nombre, Restaurante.Inventario.costo as Costo, Restaurante.Inventario.precioVenta as PrecioVenta, Restaurante.Inventario.cantidad as Cantidad, Restaurante.Inventario.cantidadMinima as CantidadMin, Restaurante.CategoriaProducto.descripcion as Categoría, Restaurante.TipoProducto.nombre as TipoProducto, Restaurante.Proveedores.nombre as Proveedor FROM Restaurante.Proveedores INNER JOIN Restaurante.Inventario ON Restaurante.Proveedores.idProveedor = Restaurante.Inventario.idProveedor INNER JOIN Restaurante.TipoProducto ON Restaurante.TipoProducto.idTipoProducto = Restaurante.Inventario.idTipoProducto INNER JOIN Restaurante.CategoriaProducto ON Restaurante.CategoriaProducto.idCategoria = Restaurante.Inventario.idCategoria"; try { SqlDataAdapter data = new SqlDataAdapter(); data.SelectCommand = new SqlCommand(sql, conexion.conexion); DataSet ds = new DataSet(); data.Fill(ds, "Restaurante.Inventario"); DataTable dt = ds.Tables["Restaurante.Inventario"]; DataView dv = new DataView(dt, "", "Código", DataViewRowState.Unchanged); return(dv); } catch (SqlException ex) { throw ex; } finally { conexion.Cerrar(); } }
public void Eliminar() { Clases.Conexion conexion = new Clases.Conexion(); SqlCommand cmd = new SqlCommand("SP_EliminarInventario", conexion.conexion); cmd.CommandType = CommandType.StoredProcedure; try { conexion.Abrir(); cmd.Parameters.Add(new SqlParameter("idInventario", SqlDbType.Int)); cmd.Parameters["idInventario"].Value = IdInventario; cmd.ExecuteNonQuery(); } catch (SqlException ex) { throw new Clases.Exepcion(ex.Message, ex, "Clase_Inventario"); } finally { conexion.Cerrar(); } }
public void Eliminar() { Clases.Conexion conexion = new Clases.Conexion(); SqlCommand cmd = new SqlCommand("SP_EliminarUsuario", conexion.conexion); cmd.CommandType = CommandType.StoredProcedure; try { conexion.Abrir(); cmd.Parameters.Add(new SqlParameter("Usuario", SqlDbType.VarChar, 26)); cmd.Parameters["usuario"].Value = this.usuario; cmd.ExecuteNonQuery(); } catch (SqlException ex) { throw ex; } finally { conexion.Cerrar(); } }
public void Eliminar() { Clases.Conexion conexion = new Clases.Conexion(); SqlCommand cmd = new SqlCommand("SP_EliminarArea", conexion.conexion); cmd.CommandType = CommandType.StoredProcedure; try { conexion.Abrir(); cmd.Parameters.Add(new SqlParameter("id", SqlDbType.Int)); cmd.Parameters["id"].Value = Id; cmd.ExecuteNonQuery(); } catch (SqlException ex) { throw ex; } finally { conexion.Cerrar(); } }
public void Agregar() { Clases.Conexion conexion = new Clases.Conexion(); SqlCommand cmd = new SqlCommand("SP_InsertarCategoriaProducto", conexion.conexion); cmd.CommandType = CommandType.StoredProcedure; try { conexion.Abrir(); cmd.Parameters.Add(new SqlParameter("descripcion", SqlDbType.NVarChar, 100)); cmd.Parameters["descripcion"].Value = Descripcion; cmd.ExecuteNonQuery(); } catch (SqlException ex) { throw new Clases.Exepcion(ex.Message, ex, "Clase_CategoriaProducto"); } finally { conexion.Cerrar(); } }
public void Modificar() { Clases.Conexion conexion = new Clases.Conexion(); SqlCommand cmd = new SqlCommand("SP_ModificarInventario", conexion.conexion); cmd.CommandType = CommandType.StoredProcedure; try { conexion.Abrir(); cmd.Parameters.Add(new SqlParameter("idInventario", SqlDbType.Int)); cmd.Parameters["idInventario"].Value = IdInventario; cmd.Parameters.Add(new SqlParameter("descripcion", SqlDbType.NVarChar, 100)); cmd.Parameters["descripcion"].Value = Descripcion; cmd.Parameters.Add(new SqlParameter("costo", SqlDbType.Decimal)); cmd.Parameters["costo"].Value = Costo; cmd.Parameters.Add(new SqlParameter("precioVenta", SqlDbType.Decimal)); cmd.Parameters["precioVenta"].Value = PrecioVenta; cmd.Parameters.Add(new SqlParameter("cantidad", SqlDbType.Decimal)); cmd.Parameters["cantidad"].Value = Cantidad; cmd.Parameters.Add(new SqlParameter("cantidadMinima", SqlDbType.Decimal)); cmd.Parameters["cantidadMinima"].Value = CantidadMinima; cmd.Parameters.Add(new SqlParameter("idCategoria", SqlDbType.Int)); cmd.Parameters["idCategoria"].Value = IdCategoria; cmd.Parameters.Add(new SqlParameter("idTipoProducto", SqlDbType.Int)); cmd.Parameters["idTipoProducto"].Value = IdTipoProducto; cmd.Parameters.Add(new SqlParameter("idProveedor", SqlDbType.Int)); cmd.Parameters["idProveedor"].Value = IdProveedor; cmd.ExecuteNonQuery(); } catch (SqlException ex) { throw new Clases.Exepcion(ex.Message, ex, "Clase_Inventario"); } finally { conexion.Cerrar(); } }
public void Modificar() { Clases.Conexion conexion = new Clases.Conexion(); SqlCommand cmd = new SqlCommand("SP_ModificarTipoProducto", conexion.conexion); cmd.CommandType = CommandType.StoredProcedure; try { conexion.Abrir(); cmd.Parameters.Add(new SqlParameter("idTipoProducto", SqlDbType.Int)); cmd.Parameters["idTipoProducto"].Value = Id; cmd.Parameters.Add(new SqlParameter("nombre", SqlDbType.NVarChar, 100)); cmd.Parameters["nombre"].Value = Nombre; cmd.ExecuteNonQuery(); } catch (SqlException ex) { throw new Clases.Exepcion(ex.Message, ex, "Clase_TipoProducto"); } finally { conexion.Cerrar(); } }
public void Agregar() { Clases.Conexion conexion = new Clases.Conexion(); SqlCommand cmd = new SqlCommand("SP_InsertarArea", conexion.conexion); cmd.CommandType = CommandType.StoredProcedure; try { conexion.Abrir(); cmd.Parameters.Add(new SqlParameter("nombre", SqlDbType.NVarChar, 50)); cmd.Parameters["nombre"].Value = Nombre; cmd.Parameters.Add(new SqlParameter("numeroMesas", SqlDbType.TinyInt)); cmd.Parameters["numeroMesas"].Value = NumeroMesas; cmd.ExecuteNonQuery(); } catch (SqlException ex) { throw new Clases.Exepcion(ex.Message, ex, "Clase_Areas"); } finally { conexion.Cerrar(); } }