public bool InsertarProductos(int cod_prove, string nom_prove, string fecha_venci, string descrip, int precio_compra, int precio_vent, int stock, int stock_cri, string catego)
        {
            try
            {
                string     sql = "sp_registro_productos";
                SqlCommand cmd = new SqlCommand(sql, cn.getConection());
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@cod_proveedor", cod_prove);
                cmd.Parameters.AddWithValue("@nombre_proveedor", nom_prove);
                cmd.Parameters.AddWithValue("@fecha_vencimiento", fecha_venci);
                cmd.Parameters.AddWithValue("@descripcio", descrip);
                cmd.Parameters.AddWithValue("@precio_com", precio_compra);
                cmd.Parameters.AddWithValue("@precio_venta", precio_vent);
                cmd.Parameters.AddWithValue("@stock", stock);
                cmd.Parameters.AddWithValue("@stock_critico", stock_cri);
                cmd.Parameters.AddWithValue("@categoria", catego);

                cmd.ExecuteNonQuery();
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Esempio n. 2
0
        public bool InsertarProductoTemp(int cod_producto, string descripcion_producto,
                                         int precio_venta, int stock, int cantidad, string fecha_venta)
        {
            //resivimos los datos que insertaremos por parametro


            try
            {
                string     sql = "sp_Detalle_venta_Tem";                 //declaramos una variable para llamar al procedimiento almacenado
                SqlCommand cmd = new SqlCommand(sql, cn.getConection()); //enviamos la variable que creamos y la coneccion que la traera la intancia
                cmd.CommandType = CommandType.StoredProcedure;           //mensionamos que utilisaremos un storeprocedure

                //llamamos  los valores del procedimiento al macenado y le damos las variables que llegaran por parametro
                cmd.Parameters.AddWithValue("@cod_producto", cod_producto);
                cmd.Parameters.AddWithValue("@descripcion_producto", descripcion_producto);
                cmd.Parameters.AddWithValue("@precio_venta", precio_venta);
                cmd.Parameters.AddWithValue("@stock", stock);
                cmd.Parameters.AddWithValue("@cantidad", cantidad);
                cmd.Parameters.AddWithValue("@fecha_venta", fecha_venta);


                //ejecutamos la operacion
                cmd.ExecuteNonQuery();
                return(true);//en el caso que todo salga bien este retornara true
            }
            catch (Exception)
            {
                return(false);//caso contrario retornara false
            }
        }
Esempio n. 3
0
        Coneccion cn = new Coneccion();//instanciamos la clase coneccion para poder insertar

        //este metodo realisara la funcion de registrar lso datos del proveedor mediante un storeprocedure
        public bool InsertarProveedor(string nombre, string telefono, string email, string comuna, string direccion, string rubro)
        {
            //resivimos los datos que insertaremos por parametro

            try
            {
                string     sql = "sp_insertar_proveedor";                //declaramos una variable para llamar al procedimiento almacenado
                SqlCommand cmd = new SqlCommand(sql, cn.getConection()); //enviamos la variable que creamos y la coneccion que la traera la intancia
                cmd.CommandType = CommandType.StoredProcedure;           //mensionamos que utilisaremos un storeprocedure

                //llamamos  los valores del procedimiento al macenado y le damos las variables que llegaran por parametro
                cmd.Parameters.AddWithValue("@nombre", nombre);
                cmd.Parameters.AddWithValue("@telefono", telefono);
                cmd.Parameters.AddWithValue("@email", email);
                cmd.Parameters.AddWithValue("@comuna", comuna);
                cmd.Parameters.AddWithValue("@direccion", direccion);
                cmd.Parameters.AddWithValue("@rubro", rubro);

                //ejecutamos la operacion
                cmd.ExecuteNonQuery();
                return(true);//en el caso que todo salga bien este retornara true
            }
            catch (Exception)
            {
                return(false);//caso contrario retornara false
            }
        }
Esempio n. 4
0
 public bool EliminarBoleta(string n_boleta)
 {
     try
     {
         string     sql = "delete from registro_ventas where numero_boleta=@nboleta";
         SqlCommand cmd = new SqlCommand(sql, cn.getConection());
         cmd.CommandType = CommandType.Text;
         cmd.Parameters.AddWithValue("@nboleta", n_boleta);
         cmd.ExecuteNonQuery();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Esempio n. 5
0
        public bool InsertarCliente(string nombre, string apellido,
                                    string rut, string genero, string telefono, string estado)
        {
            Coneccion cn = new Coneccion();

            try
            {
                string     sql = "sp_insertar_cliente";
                SqlCommand cmd = new SqlCommand(sql, cn.getConection());
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("@nombre", nombre);
                cmd.Parameters.AddWithValue("@apellido", apellido);
                cmd.Parameters.AddWithValue("@rut", rut);
                cmd.Parameters.AddWithValue("@genero", genero);
                cmd.Parameters.AddWithValue("@telefono", telefono);
                cmd.Parameters.AddWithValue("@estado", estado);

                cmd.ExecuteNonQuery();
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Esempio n. 6
0
        public bool insertarPago(int id_cliente, string nom_cliente, string apellido, string rut, int deuda_pagada, string estado)
        {
            try {
                string     sql = "sp_registrar_pago_fiado";
                SqlCommand cmd = new SqlCommand(sql, cn.getConection());
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@id_cliente", id_cliente);
                cmd.Parameters.AddWithValue("@nombre_cliente", nom_cliente);
                cmd.Parameters.AddWithValue("@apellido_cliente", apellido);
                cmd.Parameters.AddWithValue("@rut", rut);
                cmd.Parameters.AddWithValue("@deuda_pagada", deuda_pagada);
                cmd.Parameters.AddWithValue("@estado", estado);

                cmd.ExecuteNonQuery();
                return(true);
            }
            catch (Exception) {
                return(false);
            }
        }
 public bool Insertar(int numOrden, string nombre_prove, string rubro, string descripcion, int cantidad, string estado)
 {
     try
     {
         Coneccion  cn  = new Coneccion();
         string     sql = "INSERT INTO recepcion_productos(nro_orden,nom_proveedor,rubro_proveedor,descripcion,cantidad,estado) VALUES('" + numOrden + "','" + nombre_prove + "','" + rubro + "','" + descripcion + "','" + cantidad + "','" + estado + "')";
         SqlCommand cmd = new SqlCommand(sql, cn.getConection());
         cmd.ExecuteNonQuery();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Esempio n. 8
0
 public bool InsertarPedido(int cod_prove, string nom, string rubro, string fecha, string descrip, int cant)
 {
     try
     {
         string     sql = "sp_registro_pedidos";
         SqlCommand cmd = new SqlCommand(sql, cn.getConection());
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.AddWithValue("@cod_prove", cod_prove);
         cmd.Parameters.AddWithValue("@nom_prove", nom);
         cmd.Parameters.AddWithValue("@rubro_prove", rubro);
         cmd.Parameters.AddWithValue("@fecha", fecha);
         cmd.Parameters.AddWithValue("@descripcion", descrip);
         cmd.Parameters.AddWithValue("@cantidad", cant);
         cmd.ExecuteNonQuery();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Esempio n. 9
0
        public bool ExisteCliente(string rutCliente)
        {
            Coneccion cn = new Coneccion();
            //trae la cantidad de registros que esten en la base de datos
            //cuando el nombre del proveedor sea igual al que llega por parametro
            string     sql = "SELECT COUNT(*) FROM clientes WHERE rut=@rut";
            SqlCommand cmd = new SqlCommand(sql, cn.getConection()); //traemos la consulta y la coneccion

            cmd.Parameters.AddWithValue("@rut", rutCliente);         //agregamos el campo que vendra por parametro

            int count = Convert.ToInt32(cmd.ExecuteScalar());        //traemos la cantidad de registros

            //si la cantidad es 0 esto quiere desir que no hay ningun dato con el mismo nombre
            if (count == 0)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Esempio n. 10
0
        public bool ActualizarCliente(int id_cli, string nom, string ape, string ru, string gen, string tel, string est)
        {
            Coneccion cn = new Coneccion();

            try
            {
                string     sql = "sp_Actualizar_cliente";
                SqlCommand cmd = new SqlCommand(sql, cn.getConection());
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@id_cliente", id_cli);
                cmd.Parameters.AddWithValue("@nombre", nom);
                cmd.Parameters.AddWithValue("@apellido", ape);
                cmd.Parameters.AddWithValue("@rut", ru);
                cmd.Parameters.AddWithValue("@genero", gen);
                cmd.Parameters.AddWithValue("@telefono", tel);
                cmd.Parameters.AddWithValue("@estado", est);
                cmd.ExecuteNonQuery();
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }