/* * public DataTable GetAllIng() * { * using (OracleConnection con = new conexion().Conexion()) * { * OracleCommand cm = new OracleCommand("Get_alling", con); * cm.BindByName = true; * cm.CommandType = System.Data.CommandType.StoredProcedure; * OracleParameter output = cm.Parameters.Add("my_cursor", OracleDbType.RefCursor); * output.Direction = System.Data.ParameterDirection.ReturnValue; * con.Open(); * cm.ExecuteNonQuery(); * * OracleDataReader reader = ((OracleRefCursor)output.Value).GetDataReader(); * con.Close(); * using (DataTable dt = new DataTable()) * { * OracleDataAdapter adapter = new OracleDataAdapter(cm); * adapter.Fill(dt); * return dt; * * } * } * } */ public bool SolicitarBebestible(bebestibleDAL objingDAL) { try { using (OracleConnection con = new conexion().Conexion()) { OracleDataAdapter da = new OracleDataAdapter(); OracleCommand objCmd = new OracleCommand("SolicitarInsumoBebestible", con); objCmd.CommandType = CommandType.StoredProcedure; objCmd.BindByName = true; objCmd.Parameters.Add("p_nomb", OracleDbType.Varchar2).Value = nombre_ins; objCmd.Parameters.Add("p_stock", OracleDbType.Double).Value = stock; con.Open(); objCmd.ExecuteNonQuery(); con.Close(); return(true); } } catch (Exception ex) { System.Console.WriteLine("Exception: {0}", ex.ToString()); return(false); } }
/* public void Insert_DetallePedido(PedidoDAL objpedido) * { * try * { * using (OracleConnection con = new conexion().Conexion()) * { * OracleDataAdapter da = new OracleDataAdapter(); * OracleCommand cm = new OracleCommand("Insert_detalle_pedido", con); * cm.BindByName = true; * cm.CommandType = System.Data.CommandType.StoredProcedure; * cm.Parameters.Add("pd_id", OracleDbType.Int32).Value = id_pedido; * cm.Parameters.Add("monto", OracleDbType.Int32).Value = monto_total; * cm.Parameters.Add("estado", OracleDbType.Varchar2).Value = estado; * cm.Parameters.Add("id_insumo", OracleDbType.Int32).Value = id_insumo; * cm.Parameters.Add("p_id_prov", OracleDbType.Int32).Value = id_proveedor; * cm.Parameters.Add("tipo", OracleDbType.Varchar2).Value = tipo; * cm.Parameters.Add("cant", OracleDbType.Int32).Value = cantidad; * con.Open(); * cm.ExecuteNonQuery(); * con.Close(); * } * * } * catch (Exception ex) * { * Console.WriteLine("" + ex); * } * }*/ public void Insert_DetallePedido(int id, int monto, string estado_, int id_insumo_, int p_id_prov, string tipo_, int cant) { try { using (OracleConnection con = new conexion().Conexion()) { OracleCommand cm = new OracleCommand("restaurant.Insert_detalle_pedido", con); cm.BindByName = true; cm.CommandType = System.Data.CommandType.StoredProcedure; cm.Parameters.Add("p_id", OracleDbType.Int32).Value = id; cm.Parameters.Add("monto", OracleDbType.Int32).Value = monto; cm.Parameters.Add("estado", OracleDbType.Varchar2).Value = estado_; cm.Parameters.Add("id_insumo", OracleDbType.Int32).Value = id_insumo_; cm.Parameters.Add("p_id_prov", OracleDbType.Int32).Value = p_id_prov; cm.Parameters.Add("tipo", OracleDbType.Varchar2).Value = tipo_; cm.Parameters.Add("cant", OracleDbType.Int32).Value = cant; con.Open(); cm.ExecuteNonQuery(); con.Close(); } } catch (Exception ex) { Console.WriteLine("" + ex); } }
public DataTable Get_allpedidos_mes() { using (OracleConnection con = new conexion().Conexion()) { OracleCommand cm = new OracleCommand("Get_all_pedidos_mes", con); cm.BindByName = true; cm.CommandType = System.Data.CommandType.StoredProcedure; OracleParameter output = cm.Parameters.Add("my_cursor", OracleDbType.RefCursor); output.Direction = System.Data.ParameterDirection.ReturnValue; con.Open(); try { cm.ExecuteNonQuery(); } catch (Exception ex) { Console.WriteLine("" + ex); } OracleDataReader reader = ((OracleRefCursor)output.Value).GetDataReader(); con.Close(); using (DataTable dt = new DataTable()) { OracleDataAdapter adapter = new OracleDataAdapter(cm); adapter.Fill(dt); return(dt); } } }
public bool UpdatePlatoStock(int id_pla, int cantidad_nueva) { try { using (OracleConnection con = new conexion().Conexion()) { OracleDataAdapter da = new OracleDataAdapter(); OracleCommand objCmd = new OracleCommand("SetStockPlato", con); objCmd.CommandType = CommandType.StoredProcedure; objCmd.BindByName = true; objCmd.Parameters.Add("idplato", OracleDbType.Int32).Value = id_pla; objCmd.Parameters.Add("cantidad", OracleDbType.Double).Value = cantidad_nueva; con.Open(); objCmd.ExecuteNonQuery(); con.Close(); return(true); } } catch (Exception ex) { System.Console.WriteLine("Exception: {0}", ex.ToString()); return(false); } }
public DataTable Get_bebestibleByName(string nombre_ins) { using (OracleConnection con = new conexion().Conexion()) { OracleCommand cm = new OracleCommand("Get_nomBebestible", con); cm.BindByName = true; cm.CommandType = System.Data.CommandType.StoredProcedure; cm.Parameters.Add("p_nom", OracleDbType.Varchar2).Value = nombre_ins; OracleParameter output = cm.Parameters.Add("my_cursor", OracleDbType.RefCursor); output.Direction = System.Data.ParameterDirection.ReturnValue; con.Open(); cm.ExecuteNonQuery(); OracleDataReader reader = ((OracleRefCursor)output.Value).GetDataReader(); con.Close(); using (DataTable dt = new DataTable()) { OracleDataAdapter adapter = new OracleDataAdapter(cm); adapter.Fill(dt); return(dt); } } }
//Update2 public bool AgregaIngredienteStock(int id_ing, double cantidad_agregar) { try { using (OracleConnection con = new conexion().Conexion()) { OracleDataAdapter da = new OracleDataAdapter(); OracleCommand objCmd = new OracleCommand("SetAddStockingrediente", con); objCmd.CommandType = CommandType.StoredProcedure; objCmd.BindByName = true; objCmd.Parameters.Add("iding", OracleDbType.Int32).Value = id_ing; objCmd.Parameters.Add("cantidad", OracleDbType.Double).Value = cantidad_agregar; con.Open(); objCmd.ExecuteNonQuery(); con.Close(); return(true); } } catch (Exception ex) { System.Console.WriteLine("Exception: {0}", ex.ToString()); return(false); } }
public double GetStockBebestible(int id) { using (OracleConnection con = new conexion().Conexion()) { OracleCommand cm = new OracleCommand("GetStockBebestible", con); cm.BindByName = true; cm.CommandType = System.Data.CommandType.StoredProcedure; cm.Parameters.Add("id_beb", OracleDbType.Int32).Value = id; OracleParameter output = cm.Parameters.Add("my_cursor", OracleDbType.Double); output.Direction = System.Data.ParameterDirection.ReturnValue; con.Open(); cm.ExecuteNonQuery(); double valor = double.Parse(output.Value.ToString()); return(valor); } }
public int Getrut(string nomuser, string pass) { try { OracleConnection con = new conexion().Conexion(); con.Open(); OracleCommand com = new OracleCommand("get_userpass", con); com.BindByName = true; com.CommandType = System.Data.CommandType.StoredProcedure; com.Parameters.Add("USERNAME", OracleDbType.Varchar2).Value = nomuser; OracleParameter output = com.Parameters.Add("my_cursor", OracleDbType.RefCursor); output.Direction = System.Data.ParameterDirection.ReturnValue; com.ExecuteNonQuery(); OracleDataReader reader = ((OracleRefCursor)output.Value).GetDataReader(); string shaword = encriptador(pass); if (reader.HasRows) { while (reader.Read()) { int rut = Int32.Parse(reader[0].ToString()); nom_usuario = reader[1].ToString(); clave = reader[2].ToString(); rol = reader[3].ToString(); if (nom_usuario == nomuser && clave == shaword && rol == "Bodeguero") { con.Close(); return(rut); } } } con.Close(); return(0); } catch (Exception ex) { Console.WriteLine("" + ex); return(0); } }
public DataTable getPlatosHabilitados() { using (OracleConnection con = new conexion().Conexion()) { OracleCommand cm = new OracleCommand("Get_allplatosHabilitados", con); cm.BindByName = true; cm.CommandType = System.Data.CommandType.StoredProcedure; OracleParameter output = cm.Parameters.Add("my_cursor", OracleDbType.RefCursor); output.Direction = System.Data.ParameterDirection.ReturnValue; con.Open(); cm.ExecuteNonQuery(); OracleDataReader reader = ((OracleRefCursor)output.Value).GetDataReader(); con.Close(); using (DataTable dt = new DataTable()) { OracleDataAdapter adapter = new OracleDataAdapter(cm); adapter.Fill(dt); return(dt); } } }
/*------------------------------------------------------------------------------------------------------------- * | | | | | | INSERTAR EN CLASE PROVEEDOR | | | | | | V V V V V | | --------------------------------------------------------------------------------------------------------------*/ public int Get_idprovbynom(string nombre_ins) { using (OracleConnection con = new conexion().Conexion()) { OracleCommand cm = new OracleCommand("Get_idprovbyName", con); cm.BindByName = true; cm.CommandType = System.Data.CommandType.StoredProcedure; cm.Parameters.Add("nomb", OracleDbType.Varchar2).Value = nombre_ins; OracleParameter output = cm.Parameters.Add("my_cursor", OracleDbType.Int32); output.Direction = System.Data.ParameterDirection.ReturnValue; con.Open(); try { cm.ExecuteNonQuery(); return(Int32.Parse(output.Value.ToString())); } catch (Exception ex) { Console.WriteLine("" + ex); return(0); } } }
public void Insert_Pedido(DateTime fecha, int monto) { try { using (OracleConnection con = new conexion().Conexion()) { OracleDataAdapter da = new OracleDataAdapter(); OracleCommand cm = new OracleCommand("InsertPedido", con); cm.BindByName = true; cm.CommandType = System.Data.CommandType.StoredProcedure; cm.Parameters.Add("fecha", OracleDbType.Date).Value = fecha; cm.Parameters.Add("monto", OracleDbType.Int32).Value = monto; con.Open(); cm.ExecuteNonQuery(); con.Close(); } } catch (Exception ex) { Console.WriteLine("" + ex); } }
public string Get_nombrecompleto(int rut) { try { using (OracleConnection con = new conexion().Conexion()) { OracleCommand cm = new OracleCommand("Get_nombre_usuarioby_Rut", con); cm.BindByName = true; cm.CommandType = System.Data.CommandType.StoredProcedure; cm.Parameters.Add("p_rut", OracleDbType.Int32).Value = rut; OracleParameter output = cm.Parameters.Add("my_cursor", OracleDbType.Varchar2, 40); output.Direction = System.Data.ParameterDirection.ReturnValue; con.Open(); cm.ExecuteNonQuery(); con.Close(); return(output.Value.ToString()); } } catch (Exception ex) { Console.WriteLine("" + ex); return(""); } }
public DataTable getIngredientesFromPlato(int id_plat) { using (OracleConnection con = new conexion().Conexion()) { OracleCommand cm = new OracleCommand("GetIngredientesFromPlato", con); cm.BindByName = true; cm.CommandType = CommandType.StoredProcedure; cm.Parameters.Add("id_plat", OracleDbType.Varchar2).Value = id_plat; OracleParameter output = cm.Parameters.Add("my_cursor", OracleDbType.RefCursor); output.Direction = System.Data.ParameterDirection.ReturnValue; con.Open(); cm.ExecuteNonQuery(); OracleDataReader reader = ((OracleRefCursor)output.Value).GetDataReader(); con.Close(); using (DataTable dt = new DataTable()) { OracleDataAdapter adapter = new OracleDataAdapter(cm); adapter.Fill(dt); return(dt); } } }