コード例 #1
0
        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())
                    {
                        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 == "Administrador")
                        {
                            con.Close();
                            return(rut);
                        }
                    }
                }
                con.Close();

                return(0);
            }
            catch (Exception ex)
            {
                Console.WriteLine("" + ex);
                return(0);
            }
        }
コード例 #2
0
ファイル: OrdenDAL.cs プロジェクト: WOWmatias3/MesaSigloXXI
        public bool test(int num_boleta)
        {
            using (OracleConnection con = new Conexion().conexion())
            {
                OracleCommand cm = new OracleCommand("get_seq", con);
                cm.BindByName  = true;
                cm.CommandType = System.Data.CommandType.StoredProcedure;
                OracleParameter output = cm.Parameters.Add("my_cursor", OracleDbType.Int32);
                output.Direction = System.Data.ParameterDirection.ReturnValue;
                con.Open();
                cm.ExecuteNonQuery();

                con.Close();
                Console.Write("" + output.Value);
                return(true);
            }
        }
コード例 #3
0
        public bool verificaAsignacion(int num_mesa)
        {
            try
            {
                using (OracleConnection con = new Conexion().conexion())
                {
                    OracleCommand cm = new OracleCommand("Get_asignacion", con);
                    cm.BindByName  = true;
                    cm.CommandType = System.Data.CommandType.StoredProcedure;

                    cm.Parameters.Add("num_mesa", OracleDbType.Int32).Value = num_mesa;

                    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);

                        foreach (DataRow dr in dt.Rows)
                        {
                            string count = dr["COUNT(MESA_ID_MESA)"].ToString();
                            if (count == "1")
                            {
                                return(true);
                            }
                            else
                            {
                                return(false);
                            }
                        }
                    }
                }
                return(false);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
コード例 #4
0
        public bool Getplatobyid(int idpla)
        {
            using (OracleConnection con = new Conexion().conexion())
            {
                try
                {
                    OracleCommand cm = new OracleCommand("Getplatobyid", con);
                    cm.BindByName  = true;
                    cm.CommandType = System.Data.CommandType.StoredProcedure;
                    cm.Parameters.Add("id_pl", OracleDbType.Int32).Value = idpla;
                    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);
                        int num = dt.Rows.Count;
                        if (num > 0)
                        {
                            return(true);
                        }
                        else
                        {
                            return(false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine("" + ex);
                    return(false);
                }
            }
        }
コード例 #5
0
        public bool Getnume(int rut)
        {
            using (OracleConnection con = new Conexion().conexion())
            {
                OracleCommand cm = new OracleCommand("Getnume", con);
                cm.BindByName  = true;
                cm.CommandType = System.Data.CommandType.StoredProcedure;

                cm.Parameters.Add("ID_", OracleDbType.Int32).Value = rut;

                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);
                    int  contador = dt.Rows.Count;
                    bool existe   = true;
                    if (contador > 0)
                    {
                        DataRow row = dt.Rows[0];
                        string  num = row[0].ToString();
                        if (num != "")
                        {
                            existe = true;
                        }
                        return(existe);
                    }
                    else
                    {
                        existe = false;
                        return(existe);
                    }
                }
            }
        }
コード例 #6
0
 public void Alter_montototalporboleta(int id_pe)
 {
     try
     {
         using (OracleConnection con = new Conexion().conexion())
         {
             OracleDataAdapter da = new OracleDataAdapter();
             OracleCommand     cm = new OracleCommand("Alter_monto_pedidobyid", con);
             cm.BindByName  = true;
             cm.CommandType = System.Data.CommandType.StoredProcedure;
             cm.Parameters.Add("id_pe", OracleDbType.Int32).Value = id_pe;
             con.Open();
             cm.ExecuteNonQuery();
             con.Close();
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine("" + ex);
     }
 }
コード例 #7
0
 public void DeleteUser(usuarioDAL objaux)
 {
     try
     {
         using (OracleConnection con = new Conexion().conexion())
         {
             OracleDataAdapter da = new OracleDataAdapter();
             OracleCommand     cm = new OracleCommand("EliminarUsuario", con);
             cm.BindByName  = true;
             cm.CommandType = System.Data.CommandType.StoredProcedure;
             cm.Parameters.Add("rut", OracleDbType.Varchar2).Value = rut;
             con.Open();
             cm.ExecuteNonQuery();
             con.Close();
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine("" + ex);
     }
 }
コード例 #8
0
 public void DesPlato(PlatoDAL objaux)
 {
     try
     {
         using (OracleConnection con = new Conexion().conexion())
         {
             OracleDataAdapter da = new OracleDataAdapter();
             OracleCommand     cm = new OracleCommand("DeshabilitarPlato", con);
             cm.BindByName  = true;
             cm.CommandType = System.Data.CommandType.StoredProcedure;
             cm.Parameters.Add("id_", OracleDbType.Varchar2).Value = Id_plato;
             con.Open();
             cm.ExecuteNonQuery();
             con.Close();
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine("" + ex);
     }
 }
コード例 #9
0
 public void Altereestado_espera(BebestibleDAL objaux)
 {
     try
     {
         using (OracleConnection con = new Conexion().conexion())
         {
             OracleDataAdapter da = new OracleDataAdapter();
             OracleCommand     cm = new OracleCommand("alter_beb_preparado", con);
             cm.BindByName  = true;
             cm.CommandType = System.Data.CommandType.StoredProcedure;
             cm.Parameters.Add("ide", OracleDbType.Varchar2).Value = numero_pedido;
             con.Open();
             cm.ExecuteNonQuery();
             con.Close();
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine("" + ex);
     }
 }
コード例 #10
0
 public void Altereliminaring(IngredienteDAL objaux)
 {
     try
     {
         using (OracleConnection con = new Conexion().conexion())
         {
             OracleDataAdapter da = new OracleDataAdapter();
             OracleCommand     cm = new OracleCommand("alter_estadoingrediente", con);
             cm.BindByName  = true;
             cm.CommandType = System.Data.CommandType.StoredProcedure;
             cm.Parameters.Add("ide", OracleDbType.Varchar2).Value = id_ingrediente;
             con.Open();
             cm.ExecuteNonQuery();
             con.Close();
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine("" + ex);
     }
 }
コード例 #11
0
 public void DeleteMesa(int id)
 {
     try
     {
         using (OracleConnection con = new Conexion().conexion())
         {
             OracleDataAdapter da = new OracleDataAdapter();
             OracleCommand     cm = new OracleCommand("deletemesa", con);
             cm.BindByName  = true;
             cm.CommandType = System.Data.CommandType.StoredProcedure;
             cm.Parameters.Add("ID_", OracleDbType.Varchar2).Value = id;
             con.Open();
             cm.ExecuteNonQuery();
             con.Close();
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine("" + ex);
     }
 }
コード例 #12
0
 public void alter_bebestible_Desp(int orden, int beb)
 {
     try
     {
         using (OracleConnection con = new Conexion().conexion())
         {
             OracleDataAdapter da = new OracleDataAdapter();
             OracleCommand     cm = new OracleCommand("alter_beb_Despachado", con);
             cm.BindByName  = true;
             cm.CommandType = System.Data.CommandType.StoredProcedure;
             cm.Parameters.Add("ide", OracleDbType.Varchar2).Value   = beb;
             cm.Parameters.Add("orden", OracleDbType.Varchar2).Value = orden;
             con.Open();
             cm.ExecuteNonQuery();
             con.Close();
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine("" + ex);
     }
 }
コード例 #13
0
 public void Anular_pedido(int id_pe, int id_ins)
 {
     try
     {
         using (OracleConnection con = new Conexion().conexion())
         {
             OracleCommand objCmd = new OracleCommand();
             objCmd.Connection  = con;
             objCmd.CommandText = "Anular_pedido";
             objCmd.CommandType = CommandType.StoredProcedure;
             objCmd.Parameters.Add("id_pe", OracleDbType.Int32).Value  = id_pe;
             objCmd.Parameters.Add("id_ins", OracleDbType.Int32).Value = id_ins;
             con.Open();
             objCmd.ExecuteNonQuery();
             con.Close();
         }
     }
     catch (Exception ex)
     {
         System.Console.WriteLine("Exception: {0}", ex.ToString());
     }
 }
コード例 #14
0
        public DataTable Get_beb_orden_listo()
        {
            using (OracleConnection con = new Conexion().conexion())
            {
                OracleCommand cm = new OracleCommand("Get_Orden_listo", 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);
                }
            }
        }
コード例 #15
0
ファイル: OrdenDAL.cs プロジェクト: WOWmatias3/MesaSigloXXI
        public DataTable GetAllOrdenesByBoleta(int numBoleta)
        {
            using (OracleConnection con = new Conexion().conexion())
            {
                OracleCommand cm = new OracleCommand("GetAllDetalleByBoleta", con);
                cm.BindByName  = true;
                cm.CommandType = System.Data.CommandType.StoredProcedure;
                OracleParameter output = cm.Parameters.Add("my_cursor", OracleDbType.RefCursor);
                cm.Parameters.Add("num_boleta", OracleDbType.Int32).Value = numBoleta;
                output.Direction = System.Data.ParameterDirection.ReturnValue;
                con.Open();
                cm.ExecuteNonQuery();

                OracleDataReader reader = ((OracleRefCursor)output.Value).GetDataReader();
                con.Close();

                DataTable dt = new DataTable();

                OracleDataAdapter adapter = new OracleDataAdapter(cm);
                adapter.Fill(dt);
                return(dt);
            }
        }
コード例 #16
0
ファイル: OrdenDAL.cs プロジェクト: WOWmatias3/MesaSigloXXI
        public bool CreaOrden(int num_boleta)
        {
            try
            {
                using (OracleConnection con = new Conexion().conexion())
                {
                    OracleCommand cm = new OracleCommand("add_orden", con);
                    cm.BindByName  = true;
                    cm.CommandType = System.Data.CommandType.StoredProcedure;

                    cm.Parameters.Add("id_boleta", OracleDbType.Int32).Value = num_boleta;

                    con.Open();
                    cm.ExecuteNonQuery();
                    con.Close();
                    return(true);
                }
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
コード例 #17
0
        public bool EliminarReserva(int id_res)
        {
            try
            {
                OracleConnection con = new Conexion().conexion();
                con.Open();

                OracleCommand com = new OracleCommand("Delete_reserva", con);
                com.BindByName  = true;
                com.CommandType = System.Data.CommandType.StoredProcedure;
                com.Parameters.Add("id_reserv", OracleDbType.Int32).Value = id_res;

                com.ExecuteNonQuery();

                con.Close();

                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
コード例 #18
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);
            }
        }
コード例 #19
0
ファイル: PlatoDAL.cs プロジェクト: WOWmatias3/MesaSigloXXI
        public bool ingresaRelacion(int id_plato, int cantidad)
        {
            try
            {
                OracleConnection con = new Conexion().conexion();

                OracleCommand cm = new OracleCommand("add_ordenPlato", con);
                cm.BindByName  = true;
                cm.CommandType = System.Data.CommandType.StoredProcedure;

                cm.Parameters.Add("id_pla", OracleDbType.Int32).Value   = id_plato;
                cm.Parameters.Add("cantidad", OracleDbType.Int32).Value = cantidad;

                con.Open();
                cm.ExecuteNonQuery();
                con.Close();
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
コード例 #20
0
 public bool CreaRelacion(double cantidad, int ing_id)
 {
     try
     {
         using (OracleConnection con = new Conexion().conexion())
         {
             OracleDataAdapter da = new OracleDataAdapter();
             OracleCommand     cm = new OracleCommand("crea_relacion_plato_ing", con);
             cm.BindByName  = true;
             cm.CommandType = System.Data.CommandType.StoredProcedure;
             cm.Parameters.Add("cantidad", OracleDbType.Double).Value = cantidad;
             cm.Parameters.Add("ing_id", OracleDbType.Int32).Value    = ing_id;
             con.Open();
             cm.ExecuteNonQuery();
             con.Close();
             return(true);
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine("" + ex);
         return(false);
     }
 }
コード例 #21
0
        public bool PagaBoleta(int numbol, string status)
        {
            try
            {
                using (OracleConnection con = new Conexion().conexion())
                {
                    OracleCommand cm = new OracleCommand("UpdateEstadoBoleta", con);
                    cm.BindByName  = true;
                    cm.CommandType = System.Data.CommandType.StoredProcedure;

                    cm.Parameters.Add("numbol", OracleDbType.Int32).Value    = numbol;
                    cm.Parameters.Add("status", OracleDbType.Varchar2).Value = status;

                    con.Open();
                    cm.ExecuteNonQuery();
                    con.Close();
                    return(true);
                }
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
コード例 #22
0
        public bool AgregarReserva(int rut, DateTime fechahora, int id_mesa)
        {
            try
            {
                OracleConnection con = new Conexion().conexion();
                con.Open();

                OracleCommand com = new OracleCommand("Insert_reserva", con);
                com.BindByName  = true;
                com.CommandType = System.Data.CommandType.StoredProcedure;
                com.Parameters.Add("id_cliente", OracleDbType.Int32).Value = rut;
                com.Parameters.Add("fecha", OracleDbType.Date).Value       = fechahora;
                com.Parameters.Add("mesa_id", OracleDbType.Int32).Value    = id_mesa;
                com.ExecuteNonQuery();

                con.Close();

                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
コード例 #23
0
        public DataTable getGarzones()
        {
            try
            {
                OracleConnection con = new Conexion().conexion();
                con.Open();

                OracleCommand com = new OracleCommand("GetGarzones", con);
                com.BindByName  = true;
                com.CommandType = System.Data.CommandType.StoredProcedure;
                OracleParameter output = com.Parameters.Add("my_cursor", OracleDbType.RefCursor);
                output.Direction = System.Data.ParameterDirection.ReturnValue;
                com.ExecuteNonQuery();
                OracleDataReader reader = ((OracleRefCursor)output.Value).GetDataReader();
                DataTable        dt     = new DataTable();
                dt.Load(reader);
                con.Close();
                return(dt);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
コード例 #24
0
        public void AlterMesa(MesaDAL objaux)
        {
            try
            {
                using (OracleConnection con = new Conexion().conexion())
                {
                    OracleDataAdapter da = new OracleDataAdapter();
                    OracleCommand     cm = new OracleCommand("Altermesa", con);
                    cm.BindByName  = true;
                    cm.CommandType = System.Data.CommandType.StoredProcedure;
                    cm.Parameters.Add("sala", OracleDbType.Varchar2).Value = Nombre_sala;
                    cm.Parameters.Add("cap", OracleDbType.Int32).Value     = Capacidad;
                    cm.Parameters.Add("id_", OracleDbType.Int32).Value     = Id_mesa;

                    con.Open();
                    cm.ExecuteNonQuery();
                    con.Close();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("" + ex);
            }
        }
コード例 #25
0
        public bool reduceStock(int idbeb, int cantidad)
        {
            try
            {
                using (OracleConnection con = new Conexion().conexion())
                {
                    OracleCommand cm = new OracleCommand("reduce_stock_bebestible", con);
                    cm.BindByName  = true;
                    cm.CommandType = System.Data.CommandType.StoredProcedure;

                    cm.Parameters.Add("idbeb", OracleDbType.Int32).Value    = idbeb;
                    cm.Parameters.Add("cantidad", OracleDbType.Int32).Value = cantidad;

                    con.Open();
                    cm.ExecuteNonQuery();
                    con.Close();
                    return(true);
                }
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
コード例 #26
0
 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("");
     }
 }