Beispiel #1
0
        internal bool MtdAgregarDetalleBoleta(Cls_E_DetalleBoleta objEDetalleBoelta)
        {
            try
            {
                ClsConexionSQL objConexion = new ClsConexionSQL();
                SqlCommand     objComando  = new SqlCommand();
                objComando.Connection  = objConexion.conectar();
                objComando.CommandText = "USP_I_AgregarDetalleCompra";
                objComando.CommandType = CommandType.StoredProcedure;
                objComando.Parameters.Add(new SqlParameter("importe", SqlDbType.Decimal));
                objComando.Parameters.Add(new SqlParameter("precio", SqlDbType.Decimal));
                objComando.Parameters.Add(new SqlParameter("ser", SqlDbType.VarChar));
                objComando.Parameters.Add(new SqlParameter("num", SqlDbType.VarChar));
                objComando.Parameters.Add(new SqlParameter("id", SqlDbType.Int));
                objComando.Parameters.Add(new SqlParameter("cantidad", SqlDbType.Int));

                objComando.Parameters["cantidad"].Value = objEDetalleBoelta.Cantidad;
                objComando.Parameters["precio"].Value   = objEDetalleBoelta.Precio_unitario;
                objComando.Parameters["importe"].Value  = objEDetalleBoelta.Importe;
                objComando.Parameters["ser"].Value      = objEDetalleBoelta.Serie;
                objComando.Parameters["num"].Value      = objEDetalleBoelta.Numero;
                objComando.Parameters["id"].Value       = objEDetalleBoelta.Codigo;
                objComando.Connection = objConexion.conectar();
                objComando.ExecuteNonQuery();
                return(true);
            }
            catch (Exception ex)
            {
                return(false);

                throw ex;
            }
        }
Beispiel #2
0
        internal void MtdAgregarProducto(Cls_E_Producto objE)
        {
            ClsConexionSQL objConexion = new ClsConexionSQL();
            SqlCommand     objComando  = new SqlCommand();

            objComando.Connection  = objConexion.conectar();
            objComando.CommandText = "USP_I_AgregarProducto";
            objComando.CommandType = CommandType.StoredProcedure;
            objComando.Parameters.Add(new SqlParameter("id", SqlDbType.Int));
            objComando.Parameters.Add(new SqlParameter("descripcion", SqlDbType.VarChar));
            objComando.Parameters.Add(new SqlParameter("precios", SqlDbType.Decimal));
            objComando.Parameters.Add(new SqlParameter("precioc", SqlDbType.Decimal));
            objComando.Parameters.Add(new SqlParameter("stock", SqlDbType.Int));
            objComando.Parameters.Add(new SqlParameter("idt", SqlDbType.Int));
            objComando.Parameters.Add(new SqlParameter("estado", SqlDbType.VarChar));
            objComando.Parameters["id"].Value          = objE.Idproducto;
            objComando.Parameters["descripcion"].Value = objE.Descripcion.ToUpper();
            objComando.Parameters["precios"].Value     = objE.Precio_salida;
            objComando.Parameters["precioc"].Value     = objE.Precio_compra;
            objComando.Parameters["stock"].Value       = objE.Cantidad;
            objComando.Parameters["idt"].Value         = objE.Idtipo;
            objComando.Parameters["estado"].Value      = objE.Estado;
            objComando.Connection = objConexion.conectar();
            objComando.ExecuteNonQuery();
        }
Beispiel #3
0
        internal bool MtdActualizarEmpleado(Cls_E_Producto objE)
        {
            try
            {
                ClsConexionSQL objConexion = new ClsConexionSQL();
                SqlCommand     objComando  = new SqlCommand();
                objComando.Connection  = objConexion.conectar();
                objComando.CommandText = "USP_U_ActualizarProducto";
                objComando.CommandType = CommandType.StoredProcedure;
                objComando.Parameters.Add(new SqlParameter("id", SqlDbType.Int));
                objComando.Parameters.Add(new SqlParameter("des", SqlDbType.VarChar));
                objComando.Parameters.Add(new SqlParameter("pres", SqlDbType.Decimal));
                objComando.Parameters.Add(new SqlParameter("prec", SqlDbType.Decimal));
                objComando.Parameters.Add(new SqlParameter("sto", SqlDbType.Int));
                objComando.Parameters.Add(new SqlParameter("idt", SqlDbType.Int));
                objComando.Parameters.Add(new SqlParameter("est", SqlDbType.VarChar));
                objComando.Parameters["id"].Value   = objE.Idproducto;
                objComando.Parameters["des"].Value  = objE.Descripcion.ToUpper();
                objComando.Parameters["pres"].Value = objE.Precio_salida;
                objComando.Parameters["prec"].Value = objE.Precio_compra;
                objComando.Parameters["sto"].Value  = objE.Cantidad;
                objComando.Parameters["idt"].Value  = objE.Idtipo;
                objComando.Parameters["est"].Value  = objE.Estado;
                objComando.Connection = objConexion.conectar();
                objComando.ExecuteNonQuery();
                return(true);
            }
            catch (Exception ex)
            {
                return(false);

                throw ex;
            }
        }
        internal bool MtdAgregarEmpleado(Cls_E_Proveedor objE)
        {
            try
            {
                ClsConexionSQL objConexion = new ClsConexionSQL();
                SqlCommand     objComando  = new SqlCommand();
                objComando.Connection  = objConexion.conectar();
                objComando.CommandText = "USP_I_AgregarProveedor";
                objComando.CommandType = CommandType.StoredProcedure;
                objComando.Parameters.Add(new SqlParameter("ruc", SqlDbType.VarChar));
                objComando.Parameters.Add(new SqlParameter("des", SqlDbType.VarChar));
                objComando.Parameters.Add(new SqlParameter("est", SqlDbType.VarChar));
                objComando.Parameters["ruc"].Value = objE.Ruc;
                objComando.Parameters["des"].Value = objE.Descripcion.ToUpper();
                objComando.Parameters["est"].Value = objE.Estado;
                objComando.Connection = objConexion.conectar();
                objComando.ExecuteNonQuery();
                return(true);
            }
            catch (Exception ex)
            {
                return(false);

                throw ex;
            }
        }
        internal bool MtdAgregarEmpleado(Cls_E_Empleado objE)
        {
            try
            {
                ClsConexionSQL objConexion = new ClsConexionSQL();
                SqlCommand     objComando  = new SqlCommand();
                objComando.Connection  = objConexion.conectar();
                objComando.CommandText = "USP_I_AgregarEmpleado";
                objComando.CommandType = CommandType.StoredProcedure;
                objComando.Parameters.Add(new SqlParameter("d", SqlDbType.VarChar));
                objComando.Parameters.Add(new SqlParameter("nom", SqlDbType.VarChar));
                objComando.Parameters.Add(new SqlParameter("cla", SqlDbType.Int));
                objComando.Parameters.Add(new SqlParameter("idc", SqlDbType.VarChar));
                objComando.Parameters.Add(new SqlParameter("est", SqlDbType.VarChar));
                objComando.Parameters["d"].Value   = objE.Dni;
                objComando.Parameters["nom"].Value = objE.Nombre.ToUpper();
                objComando.Parameters["cla"].Value = objE.Clave;
                objComando.Parameters["idc"].Value = objE.Idcargo;
                objComando.Parameters["est"].Value = objE.Estado;
                objComando.Connection = objConexion.conectar();
                objComando.ExecuteNonQuery();
                return(true);
            }
            catch (Exception ex)
            {
                return(false);

                throw ex;
            }
        }
Beispiel #6
0
        internal bool MtdActualizarCliente(Cls_E_Clientes objE)
        {
            try
            {
                ClsConexionSQL objConexion = new ClsConexionSQL();
                SqlCommand     objComando  = new SqlCommand();
                objComando.Connection  = objConexion.conectar();
                objComando.CommandText = "USP_U_ActualizarClientes";
                objComando.CommandType = CommandType.StoredProcedure;
                objComando.Parameters.Add(new SqlParameter("d", SqlDbType.VarChar));
                objComando.Parameters.Add(new SqlParameter("nom", SqlDbType.VarChar));
                objComando.Parameters.Add(new SqlParameter("est", SqlDbType.VarChar));
                objComando.Parameters["d"].Value   = objE.Dni;
                objComando.Parameters["nom"].Value = objE.Nombres;
                objComando.Parameters["est"].Value = objE.Estado;
                objComando.Connection = objConexion.conectar();
                objComando.ExecuteNonQuery();
                return(true);
            }
            catch (Exception ex)
            {
                return(false);

                throw ex;
            }
        }
Beispiel #7
0
        internal void MtdIncrementarProductos(Cls_E_Producto objE)
        {
            ClsConexionSQL objConexion = new ClsConexionSQL();
            SqlCommand     objComando  = new SqlCommand();

            objComando.Connection  = objConexion.conectar();
            objComando.CommandText = "USP_U_DecrementarProducto";
            objComando.CommandType = CommandType.StoredProcedure;
            objComando.Parameters.Add(new SqlParameter("cant", SqlDbType.Int));
            objComando.Parameters.Add(new SqlParameter("cod", SqlDbType.Int));
            objComando.Parameters["cod"].Value  = objE.Idproducto;
            objComando.Parameters["cant"].Value = objE.Cantidad;
            objComando.Connection = objConexion.conectar();
            objComando.ExecuteNonQuery();
        }
Beispiel #8
0
        public Boolean MtdAgregarABoleta(Cls_E_Boleta objEBoleta)
        {
            try
            {
                ClsConexionSQL objConexion = new ClsConexionSQL();
                SqlCommand     objComando  = new SqlCommand();
                objComando.Connection  = objConexion.conectar();
                objComando.CommandText = "USP_I_AgregarCompra";
                objComando.CommandType = CommandType.StoredProcedure;
                objComando.Parameters.Add(new SqlParameter("ser", SqlDbType.VarChar));
                objComando.Parameters.Add(new SqlParameter("num", SqlDbType.VarChar));
                objComando.Parameters.Add(new SqlParameter("dnie", SqlDbType.VarChar));
                objComando.Parameters.Add(new SqlParameter("fecha", SqlDbType.Date));
                objComando.Parameters.Add(new SqlParameter("dnic", SqlDbType.VarChar));
                objComando.Parameters.Add(new SqlParameter("sub", SqlDbType.Decimal));
                objComando.Parameters.Add(new SqlParameter("igv", SqlDbType.Decimal));
                objComando.Parameters.Add(new SqlParameter("total", SqlDbType.Decimal));
                objComando.Parameters.Add(new SqlParameter("estado", SqlDbType.VarChar));
                objComando.Parameters.Add(new SqlParameter("tipopago", SqlDbType.VarChar));
                objComando.Parameters["ser"].Value      = objEBoleta.Serie;
                objComando.Parameters["num"].Value      = objEBoleta.Numero;
                objComando.Parameters["dnie"].Value     = objEBoleta.Empleado;
                objComando.Parameters["fecha"].Value    = objEBoleta.Fecha;
                objComando.Parameters["dnic"].Value     = objEBoleta.Cliente;
                objComando.Parameters["sub"].Value      = objEBoleta.Total;
                objComando.Parameters["igv"].Value      = objEBoleta.Total;
                objComando.Parameters["total"].Value    = objEBoleta.Total;
                objComando.Parameters["estado"].Value   = objEBoleta.Estado;
                objComando.Parameters["tipopago"].Value = objEBoleta.Empleado;
                objComando.Connection = objConexion.conectar();
                objComando.ExecuteNonQuery();
                return(true);
            }
            catch (Exception ex)
            {
                return(false);

                throw ex;
            }
        }
Beispiel #9
0
        internal DataTable MtdListarProductos()
        {
            ClsConexionSQL conn    = new ClsConexionSQL();
            DataTable      result  = new DataTable();
            SqlDataAdapter adapter = new SqlDataAdapter();
            SqlCommand     command = new SqlCommand();

            command.Connection  = conn.conectar();
            command.CommandType = CommandType.StoredProcedure;
            command.CommandText = "USP_S_ListarProductos";
            command.ExecuteNonQuery();
            adapter.SelectCommand = command;
            adapter.Fill(result);
            return(result);
        }
Beispiel #10
0
        public DataTable MtdListarEmpleado(Cls_E_Ingreso objE)
        {
            DataTable      empleado    = new DataTable();
            ClsConexionSQL objConexion = new ClsConexionSQL();
            SqlCommand     objComando  = new SqlCommand();
            SqlDataAdapter adapter     = new SqlDataAdapter();

            objComando.Connection  = objConexion.conectar();
            objComando.CommandText = "USP_S_VALIDARLOGIN";
            objComando.CommandType = CommandType.StoredProcedure;
            objComando.Parameters.Add(new SqlParameter("documento", SqlDbType.VarChar));
            objComando.Parameters.Add(new SqlParameter("cla", SqlDbType.VarChar));
            objComando.Parameters["documento"].Value = objE.Dni;
            objComando.Parameters["cla"].Value       = objE.Clave;
            objComando.Connection = objConexion.conectar();
            objComando.ExecuteNonQuery();
            adapter.SelectCommand = objComando;
            adapter.Fill(empleado);
            foreach (DataRow fila in empleado.Rows)
            {
                acceso = fila[5].ToString();
            }
            return(empleado);
        }
Beispiel #11
0
        public Boolean MtdActualizarCargo(ClsECargo objE)
        {
            try
            {
                ClsConexionSQL objConexion = new ClsConexionSQL();
                SqlCommand     objComando  = new SqlCommand();
                objComando.Connection  = objConexion.conectar();
                objComando.CommandText = "USP_U_ActualizarCargo";
                objComando.CommandType = CommandType.StoredProcedure;
                objComando.Parameters.Add(new SqlParameter("cod", SqlDbType.Int));
                objComando.Parameters.Add(new SqlParameter("des", SqlDbType.VarChar));
                objComando.Parameters["cod"].Value = objE.Codigo;
                objComando.Parameters["des"].Value = objE.Descripcion;
                objComando.Connection = objConexion.conectar();
                objComando.ExecuteNonQuery();
                return(true);
            }
            catch (Exception ex)
            {
                return(false);

                throw ex;
            }
        }
Beispiel #12
0
        internal DataTable MtdGastosAnual()
        {
            ClsConexionSQL conn    = new ClsConexionSQL();
            DataTable      result  = new DataTable();
            SqlDataAdapter adapter = new SqlDataAdapter();
            SqlCommand     command = new SqlCommand();

            command.Connection  = conn.conectar();
            command.CommandType = CommandType.StoredProcedure;
            command.CommandText = "USP_S_CONSULTASANUALGASTO";
            command.ExecuteNonQuery();
            adapter.SelectCommand = command;
            adapter.Fill(result);
            return(result);
        }
Beispiel #13
0
        internal DataTable MtdIngresosTriMensuales()
        {
            ClsConexionSQL conn    = new ClsConexionSQL();
            DataTable      result  = new DataTable();
            SqlDataAdapter adapter = new SqlDataAdapter();
            SqlCommand     command = new SqlCommand();

            command.Connection  = conn.conectar();
            command.CommandType = CommandType.StoredProcedure;
            command.CommandText = "USP_S_INGRESOTRIMESTRAL";
            command.ExecuteNonQuery();
            adapter.SelectCommand = command;
            adapter.Fill(result);
            return(result);
        }
Beispiel #14
0
        internal DataTable MtdBuscarEmpleadoPorDNI(string text)
        {
            ClsConexionSQL conn    = new ClsConexionSQL();
            DataTable      result  = new DataTable();
            SqlDataAdapter adapter = new SqlDataAdapter();
            SqlCommand     command = new SqlCommand();

            command.Connection  = conn.conectar();
            command.CommandType = CommandType.StoredProcedure;
            command.CommandText = "USP_S_BUSCARIDPRODUCTO";
            command.Parameters.Add(new SqlParameter("idt", SqlDbType.VarChar));
            command.Parameters["idt"].Value = text;
            command.ExecuteNonQuery();
            adapter.SelectCommand = command;
            adapter.Fill(result);
            return(result);
        }
Beispiel #15
0
        internal int MtdGenerarIdProveedor()
        {
            DataTable      temp = new DataTable();
            ClsConexionSQL conn = new ClsConexionSQL();

            SqlDataAdapter adapter = new SqlDataAdapter();
            SqlCommand     command = new SqlCommand();

            command.Connection  = conn.conectar();
            command.CommandType = CommandType.StoredProcedure;
            command.CommandText = "USP_S_ListarProductos";
            command.ExecuteNonQuery();
            adapter.SelectCommand = command;
            adapter.Fill(temp);

            int idproducto = temp.Rows.Count + 1;


            return(idproducto);
        }