Пример #1
0
 public static List<ArticuloN> ListarArticulos()
 {
     Datos.ArticuloD t_conexion = new Datos.ArticuloD();
     DataTable _DT = t_conexion.ListarArticulos();
     if (_DT != null)
     {
         List<ArticuloN> t_list = new List<ArticuloN>();
         for (int a = 0; a < _DT.Rows.Count; a++) 
         {
             int t_id = int.Parse(_DT.Rows[a]["Id"].ToString());
             string t_name = _DT.Rows[a]["Nombre"].ToString();
             decimal t_IVA = decimal.Parse(_DT.Rows[a]["IVA"].ToString());
             decimal t_PrecioCompra = decimal.Parse(_DT.Rows[a]["PrecioCompra"].ToString());
             decimal t_Porcentaje = decimal.Parse(_DT.Rows[a]["Porcentaje"].ToString());
             string t_CodigoBarra=_DT.Rows[a]["CodigoBarra"].ToString();
             decimal t_PrecioSugerido = decimal.Parse(_DT.Rows[a]["PrecioSugerido"].ToString());
             int t_Cuenta = int.Parse(_DT.Rows[a]["IdCuenta"].ToString());
             bool t_LlevaStock= bool.Parse(_DT.Rows[a]["LlevaStock"].ToString());
             int t_cantidad= int.Parse(_DT.Rows[a]["Cantidad"].ToString());
             bool t_BloquearPrecio = bool.Parse(_DT.Rows[a]["BloquearPrecio"].ToString());
             int t_IdCategoria = int.Parse(_DT.Rows[a]["IdCategoria"].ToString());
             t_list.Add(new ArticuloN(t_id, t_name, t_IVA, t_PrecioCompra, t_Porcentaje, t_CodigoBarra, t_PrecioSugerido, null, t_LlevaStock, t_cantidad, t_BloquearPrecio,t_IdCategoria));
         }
         return t_list;
     }
     else 
     {
         return null;
     }
 }
Пример #2
0
        public static List <ArticuloN> ListarArticulos()
        {
            Datos.ArticuloD t_conexion = new Datos.ArticuloD();
            DataTable       _DT        = t_conexion.ListarArticulos();

            if (_DT != null)
            {
                List <ArticuloN> t_list = new List <ArticuloN>();
                for (int a = 0; a < _DT.Rows.Count; a++)
                {
                    int     t_id             = int.Parse(_DT.Rows[a]["Id"].ToString());
                    string  t_name           = _DT.Rows[a]["Nombre"].ToString();
                    decimal t_IVA            = decimal.Parse(_DT.Rows[a]["IVA"].ToString());
                    decimal t_PrecioCompra   = decimal.Parse(_DT.Rows[a]["PrecioCompra"].ToString());
                    decimal t_Porcentaje     = decimal.Parse(_DT.Rows[a]["Porcentaje"].ToString());
                    string  t_CodigoBarra    = _DT.Rows[a]["CodigoBarra"].ToString();
                    decimal t_PrecioSugerido = decimal.Parse(_DT.Rows[a]["PrecioSugerido"].ToString());
                    int     t_Cuenta         = int.Parse(_DT.Rows[a]["IdCuenta"].ToString());
                    bool    t_LlevaStock     = bool.Parse(_DT.Rows[a]["LlevaStock"].ToString());
                    int     t_cantidad       = int.Parse(_DT.Rows[a]["Cantidad"].ToString());
                    bool    t_BloquearPrecio = bool.Parse(_DT.Rows[a]["BloquearPrecio"].ToString());
                    int     t_IdCategoria    = int.Parse(_DT.Rows[a]["IdCategoria"].ToString());
                    t_list.Add(new ArticuloN(t_id, t_name, t_IVA, t_PrecioCompra, t_Porcentaje, t_CodigoBarra, t_PrecioSugerido, null, t_LlevaStock, t_cantidad, t_BloquearPrecio, t_IdCategoria));
                }
                return(t_list);
            }
            else
            {
                return(null);
            }
        }
Пример #3
0
        /// <summary>
        /// Consulta un articulod e la base de datos
        /// </summary>
        /// <param name="p_Id"></param>
        public ArticuloN(int p_Id)
        {
            /*Id
             * Nombre
             * IVA
             * PrecioCompra
             * Porcentaje
             * CodigoBarra
             * PrecioSugerido
             * IdCuenta
             * LlevaStock
             * Cantidad*/

            _Datos = new Datos.ArticuloD();
            DataTable _DT = _Datos.ObtenerArticulo(p_Id);

            if (_DT != null)
            {
                DataRow _DR = _DT.Rows[0];
                Id             = int.Parse(_DR["Id"].ToString());
                Nombre         = _DR["Nombre"].ToString();
                IVA            = decimal.Parse(_DR["IVA"].ToString());
                PrecioCompra   = decimal.Parse(_DR["PrecioCompra"].ToString());
                Porcentaje     = decimal.Parse(_DR["Porcentaje"].ToString());
                CodigoBarra    = _DR["CodigoBarra"].ToString();
                PrecioSugerido = decimal.Parse(_DR["PrecioSugerido"].ToString());
                IdCuenta       = int.Parse(_DR["IdCuenta"].ToString());
                LlevaStock     = bool.Parse(_DR["LlevaStock"].ToString());
                Cantidad       = int.Parse(_DR["Cantidad"].ToString());
                BloqueaPrecio  = bool.Parse(_DR["BloquearPrecio"].ToString());
                IdCategoria    = int.Parse(_DR["IdCategoria"].ToString());
                Succed         = true;
            }
        }
Пример #4
0
        /// <summary>
        /// Guarda un articulo nuevo
        /// </summary>
        /// <returns></returns>
        public bool Guardar()
        {
            _Datos = new Datos.ArticuloD();
            try
            {
                DataTable _DT = _Datos.InsertarArticulo(Nombre, IVA, PrecioCompra, Porcentaje, CodigoBarra, PrecioSugerido, IdCuenta, LlevaStock, Cantidad, BloqueaPrecio, IdCategoria);
                if (_DT.Rows.Count > 0)
                {
                    Id     = Convert.ToInt32(_DT.Rows[0]["Id"].ToString());
                    Succed = true;
                    return(true);
                }
                else
                {
                    Succed = false;

                    return(false);
                }
            }
            catch (Exception EXC)
            {
                Entidades.Catcher.Catcher.Agregar_Error(this.ToString(), EXC.StackTrace);
                return(false);
            }
        }
Пример #5
0
        /// <summary>
        /// Actualiza el articulo
        /// </summary>
        /// <returns></returns>
        public bool Actualizar()
        {
            _Datos = new Datos.ArticuloD();
            bool _result = false;

            try {
                _result = _Datos.ModificarArticulo(
                    this.Id,
                    this.Nombre,
                    this.IVA,
                    this.PrecioCompra,
                    this.Porcentaje,
                    this.CodigoBarra,
                    this.PrecioSugerido,
                    this.IdCuenta,
                    this.LlevaStock,
                    this.Cantidad,
                    this.BloqueaPrecio,
                    this.IdCategoria
                    );
                Succed = true;
            } catch (Exception EXC)
            {
                Entidades.Catcher.Catcher.Agregar_Error(this.ToString(), EXC.StackTrace);
                Succed = false;
            }
            Succed = _result;

            return(_result);
        }
Пример #6
0
 public static bool ActualizarPrecioPorCuenta(decimal p_Porcentaje, int p_IdCuenta, int p_IdCategoria)
 {
     Datos.ArticuloD _Datos = new Datos.ArticuloD();
     bool Retorno = false;
     _Datos = new Datos.ArticuloD();
     Retorno = _Datos.ActualizarPrecioPorCuenta(p_Porcentaje, p_IdCuenta, p_IdCategoria);
     return Retorno;
 }
Пример #7
0
        public static bool ActualizarPrecioPorCuenta(decimal p_Porcentaje, int p_IdCuenta, int p_IdCategoria)
        {
            Datos.ArticuloD _Datos  = new Datos.ArticuloD();
            bool            Retorno = false;

            _Datos  = new Datos.ArticuloD();
            Retorno = _Datos.ActualizarPrecioPorCuenta(p_Porcentaje, p_IdCuenta, p_IdCategoria);
            return(Retorno);
        }
Пример #8
0
        public List <ArticuloN> ListarArticulos()
        {
            _Articulo = new Datos.ArticuloD();
            DataTable        _DT       = _Articulo.ListarArticulosPorCuenta(this.Id);
            List <ArticuloN> _listaART = new List <ArticuloN>();

            if (_DT != null)
            {
                for (int a = 0; a < _DT.Rows.Count; a++)
                {
                    _listaART.Add(new ArticuloN(int.Parse(_DT.Rows[a]["Id"].ToString())));
                }
                return(_listaART);
            }
            else
            {
                return(null);
            }
        }
Пример #9
0
        /// <summary>
        /// Consulta un articulod e la base de datos
        /// </summary>
        /// <param name="p_Id"></param>
        public ArticuloN(int p_Id) 
        {
            /*Id	
             * Nombre	
             * IVA	
             * PrecioCompra	
             * Porcentaje	
             * CodigoBarra	
             * PrecioSugerido	
             * IdCuenta	
             * LlevaStock	
             * Cantidad*/

            _Datos = new Datos.ArticuloD();
            DataTable _DT = _Datos.ObtenerArticulo(p_Id);
            if (_DT != null) 
            {
                DataRow _DR = _DT.Rows[0];
                Id= int.Parse( _DR["Id"].ToString());
                Nombre = _DR["Nombre"].ToString();
                IVA = decimal.Parse( _DR["IVA"].ToString());
                PrecioCompra = decimal.Parse(_DR["PrecioCompra"].ToString());
                Porcentaje =decimal.Parse( _DR["Porcentaje"].ToString());
                CodigoBarra = _DR["CodigoBarra"].ToString();
                PrecioSugerido =decimal.Parse( _DR["PrecioSugerido"].ToString());
                IdCuenta =int.Parse( _DR["IdCuenta"].ToString());
                LlevaStock = bool.Parse( _DR["LlevaStock"].ToString());
                Cantidad = int.Parse(_DR["Cantidad"].ToString());
                BloqueaPrecio = bool.Parse(_DR["BloquearPrecio"].ToString());
                IdCategoria = int.Parse(_DR["IdCategoria"].ToString());
                Succed = true;

            }

        }
Пример #10
0
 /// <summary>
 /// Elimina un articulo de la base de datos
 /// </summary>
 /// <returns></returns>
 public Boolean Eliminar() 
 {
     _Datos = new Datos.ArticuloD();
     return _Datos.EliminarArticulo(this.Id);
     
 }
Пример #11
0
        /// <summary>
        /// Guarda un articulo nuevo
        /// </summary>
        /// <returns></returns>
        public bool Guardar()
        {
            _Datos = new Datos.ArticuloD();
            try
            {
                DataTable _DT = _Datos.InsertarArticulo(Nombre, IVA, PrecioCompra, Porcentaje, CodigoBarra, PrecioSugerido, IdCuenta, LlevaStock, Cantidad, BloqueaPrecio, IdCategoria);
                if (_DT.Rows.Count > 0)
                {
                    Id = Convert.ToInt32(_DT.Rows[0]["Id"].ToString());
                    Succed = true;
                    return true;

                }
                else
                {
                    Succed = false;

                    return false;
                }

            }
            catch (Exception EXC) 
            {
                Entidades.Catcher.Catcher.Agregar_Error(this.ToString(), EXC.StackTrace);
                return false;
            }

        }
Пример #12
0
        /// <summary>
        /// Actualiza el articulo
        /// </summary>
        /// <returns></returns>
        public bool Actualizar() 
        {
            _Datos = new Datos.ArticuloD();
            bool _result=false;
            try {
                _result= _Datos.ModificarArticulo(
                    this.Id, 
                    this.Nombre, 
                    this.IVA, 
                    this.PrecioCompra, 
                    this.Porcentaje, 
                    this.CodigoBarra, 
                    this.PrecioSugerido, 
                    this.IdCuenta, 
                    this.LlevaStock, 
                    this.Cantidad,
                    this.BloqueaPrecio,
                    this.IdCategoria
                );
                Succed = true;
            } catch(Exception EXC)
            {
                Entidades.Catcher.Catcher.Agregar_Error(this.ToString(), EXC.StackTrace);
                    Succed = false;
                }
            Succed = _result;

            return _result; 
        }
Пример #13
0
        public List<ArticuloN> ListarArticulos()
        {
            _Articulo = new Datos.ArticuloD();
            DataTable _DT = _Articulo.ListarArticulosPorCuenta(this.Id);
            List<ArticuloN> _listaART = new List<ArticuloN>();
            if (_DT != null)
            {
                for (int a = 0; a < _DT.Rows.Count; a++)
                {
                    _listaART.Add(new ArticuloN(int.Parse(_DT.Rows[a]["Id"].ToString())));
                }
                return _listaART;
            }
            else 
            {
                return null;
            }


        }
Пример #14
0
 /// <summary>
 /// Elimina un articulo de la base de datos
 /// </summary>
 /// <returns></returns>
 public Boolean Eliminar()
 {
     _Datos = new Datos.ArticuloD();
     return(_Datos.EliminarArticulo(this.Id));
 }