Exemple #1
0
        public bool GetById(int id)
        {
            string          Statement = string.Format("select * from t10_productos where t10_pk01 = '{0}'", id);
            MySqlDataReader data      = null;
            bool            result    = false;

            try
            {
                data = DBMysql_.DoQuery(Statement);
                if (data.HasRows)
                {
                    while (data.Read())
                    {
                        Id               = data.IsDBNull(0) ? 0 : (int)data.GetUInt32(0);
                        IdTipoProducto   = data.IsDBNull(1) ? 0 : data.GetInt32(1);
                        Pagina           = data.IsDBNull(2) ? 0 : data.GetInt32(2);
                        Codigo           = data.IsDBNull(3) ? " -- " : data.GetString(3);
                        Descripcion      = data.IsDBNull(4) ? " -- " : data.GetString(4);
                        PrecioCotizacion = data.IsDBNull(5) ? 0 : data.GetDouble(5);
                        PrecioCompra     = data.IsDBNull(6) ? 0 : data.GetDouble(6);
                        PrecioVenta      = data.IsDBNull(7) ? 0 : data.GetDouble(7);
                        IdCliente        = data.IsDBNull(8) ? 0 : data.GetInt32(8);
                        Cotizacion       = data.IsDBNull(9) ? DateTime.Now : data.GetDateTime(9);
                        Compra           = data.IsDBNull(10) ? DateTime.Now : data.GetDateTime(10);
                        Venta            = data.IsDBNull(11) ? DateTime.Now : data.GetDateTime(11);
                        Created          = data.IsDBNull(12) ? DateTime.Now : data.GetDateTime(12);
                        Updated          = data.IsDBNull(13) ? DateTime.Now : data.GetDateTime(13);
                        IdNota           = data.IsDBNull(16) ? 0 : data.GetInt32(16);
                    }
                    data.Close();
                    Cliente_ = new Cliente(DBMysql_);
                    Cliente_.GetById(IdCliente);
                    NotaPedido_ = new NotaPedido(DBMysql_);
                    NotaPedido_.GetById(IdNota);
                    result = true;
                }
                return(result);
            }
            catch (DBException ex)
            {
                throw ex;
            }
            catch (MySqlException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (data != null)
                {
                    data.Close();
                }
            }
        }
Exemple #2
0
        public bool GetById(int id)
        {
            string          Statement = string.Format("select * from t05_notas where t05_pk01 = '{0}'", id);
            MySqlDataReader data      = null;
            bool            result    = false;

            try
            {
                data = DBMysql_.DoQuery(Statement);
                if (data.HasRows)
                {
                    while (data.Read())
                    {
                        Id           = data.IsDBNull(0) ? 0 : (int)data.GetUInt32(0);
                        Fecha        = data.IsDBNull(1) ? DateTime.Now : data.GetDateTime(1);
                        Total        = data.IsDBNull(2) ? 0 : data.GetDouble(2);
                        TipoPedido   = data.IsDBNull(3) ? 0 : data.GetInt32(3);
                        StatusPedido = data.IsDBNull(4) ? 0 : data.GetInt32(4);
                    }
                    data.Close();
                    if (Id != 0)
                    {
                        Notas         = new NotaPedido(DBMysql_).ListByPedido(Id);
                        PedidoAbono_  = new PedidoAbono(DBMysql_).ListByPedido(Id);
                        PedidoAjuste_ = new PedidoAjuste(DBMysql_).ListByPedido(Id);
                        TotalAportes  = new PedidoAbono(DBMysql_).GetTotalByPedido(Id);
                        TotalAjustesE = new PedidoAjuste(DBMysql_).GetTotalByPedido("E", Id);
                        TotalAjustesI = new PedidoAjuste(DBMysql_).GetTotalByPedido("I", Id);
                        Producto_     = new Producto(DBMysql_).ListByPedido(Id);
                    }

                    result = true;
                }
                return(result);
            }
            catch (DBException ex)
            {
                throw ex;
            }
            catch (MySqlException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (data != null)
                {
                    data.Close();
                }
            }
        }
Exemple #3
0
        public bool GetById(int id)
        {
            string          Statement = string.Format("select * from t08_notas_abonos where t08_pk01 = '{0}'", id);
            MySqlDataReader data      = null;
            bool            result    = false;

            try
            {
                data = DBMysql_.DoQuery(Statement);
                if (data.HasRows)
                {
                    while (data.Read())
                    {
                        Id               = data.IsDBNull(0) ? 0 : (int)data.GetUInt32(0);
                        Id_pedido        = data.IsDBNull(1) ? 0 : data.GetInt32(1);
                        Total            = data.IsDBNull(2) ? 0 : data.GetDouble(2);
                        Id_invercionista = data.IsDBNull(3) ? 0 : data.GetInt32(3);
                        Created          = data.IsDBNull(4) ? DateTime.Now : data.GetDateTime(4);
                        Updated          = data.IsDBNull(5) ? DateTime.Now : data.GetDateTime(5);;
                    }
                    data.Close();
                    Inversionista_ = new Inversionista(DBMysql_);
                    Inversionista_.GetById(Id_invercionista);
                    Pedido_ = new Pedido(DBMysql_);
                    Pedido_.GetById(Id_pedido);
                    result = true;
                }
                return(result);
            }
            catch (DBException ex)
            {
                throw ex;
            }
            catch (MySqlException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (data != null)
                {
                    data.Close();
                }
            }
        }
Exemple #4
0
        public bool GetById(int id)
        {
            string          Statement = string.Format("select * from t09_notas_ajustes where t09_pk01 = '{0}'", id);
            MySqlDataReader data      = null;
            bool            result    = false;

            try
            {
                data = DBMysql_.DoQuery(Statement);
                if (data.HasRows)
                {
                    while (data.Read())
                    {
                        Id             = data.IsDBNull(0) ? 0 : (int)data.GetUInt32(0);
                        Id_cliente     = data.IsDBNull(1) ? 0 : data.GetInt32(1);
                        Total          = data.IsDBNull(2) ? 0 : data.GetDouble(2);
                        Concepto       = data.IsDBNull(3) ? " -- " : data.GetString(3);
                        Created        = data.IsDBNull(4) ? DateTime.Now : data.GetDateTime(4);
                        Updated        = data.IsDBNull(5) ? DateTime.Now : data.GetDateTime(5);;
                        TipoMovimiento = data.IsDBNull(6) ? " -- " : data.GetString(6);
                    }
                    data.Close();
                    Cliente_ = new Cliente(DBMysql_);
                    Cliente_.GetById(Id_cliente);
                    result = true;
                }
                return(result);
            }
            catch (DBException ex)
            {
                throw ex;
            }
            catch (MySqlException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (data != null)
                {
                    data.Close();
                }
            }
        }
Exemple #5
0
        public List <Cliente> List()
        {
            string          Statement = string.Format("select * from t04_clientes");
            MySqlDataReader data      = null;
            List <Cliente>  List      = null;

            try
            {
                data = DBMysql_.DoQuery(Statement);
                List = new List <Cliente>();
                if (data.HasRows)
                {
                    while (data.Read())
                    {
                        Cliente Cliente_ = new Cliente();
                        Cliente_.Id       = data.IsDBNull(0) ? 0 : (int)data.GetUInt32(0);
                        Cliente_.Nombre   = data.IsDBNull(1) ? "" : data.GetString(1);
                        Cliente_.Telefono = data.IsDBNull(2) ? "" : data.GetString(2);
                        Cliente_.Correo   = data.IsDBNull(3) ? "" : data.GetString(3);
                        Cliente_.IsActive = data.IsDBNull(4) ? false : (data.GetInt32(4) == 1 ? true: false);
                        Cliente_.Created  = data.IsDBNull(5) ? DateTime.Now : data.GetDateTime(5);
                        Cliente_.Updated  = data.IsDBNull(6) ? DateTime.Now : data.GetDateTime(6);
                        List.Add(Cliente_);
                    }
                }
                return(List);
            }
            catch (DBException ex)
            {
                throw ex;
            }
            catch (MySqlException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (data != null)
                {
                    data.Close();
                }
            }
        }
Exemple #6
0
        public bool GetById(int id)
        {
            string          Statement = string.Format("select * from t06_notas_notas where t06_pk01 = '{0}'", id);
            MySqlDataReader data      = null;
            bool            result    = false;

            try
            {
                data = DBMysql_.DoQuery(Statement);
                if (data.HasRows)
                {
                    while (data.Read())
                    {
                        Id        = data.IsDBNull(0) ? 0 : (int)data.GetUInt32(0);
                        Folio     = data.IsDBNull(1) ? " -- " : data.GetString(1);
                        Total     = data.IsDBNull(2) ? 0 : data.GetDouble(2);
                        Id_Pedido = data.IsDBNull(3) ? 0 : data.GetInt32(3);
                    }
                    data.Close();
                    Producto_ = new Producto(DBMysql_).ListByNota(Id);
                    Pedido_   = new Pedido(DBMysql_);
                    Pedido_.GetById(Id);
                    result = true;
                }
                return(result);
            }
            catch (DBException ex)
            {
                throw ex;
            }
            catch (MySqlException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (data != null)
                {
                    data.Close();
                }
            }
        }
Exemple #7
0
        public bool GetById(int id)
        {
            string          Statement = string.Format("select * from t07_inversionistas where t07_pk01 = '{0}'", id);
            MySqlDataReader data      = null;
            bool            result    = false;

            try
            {
                data = DBMysql_.DoQuery(Statement);
                if (data.HasRows)
                {
                    while (data.Read())
                    {
                        Id       = data.IsDBNull(0) ? 0 : (int)data.GetUInt32(0);
                        Nombre   = data.IsDBNull(1) ? " -- " : data.GetString(1);
                        isActive = data.IsDBNull(2) ? false : (data.GetInt32(2) == 1 ? true : false);
                        Created  = data.IsDBNull(3) ? DateTime.Now : data.GetDateTime(3);
                        Updated  = data.IsDBNull(4) ? DateTime.Now : data.GetDateTime(4);
                    }
                    result = true;
                }
                return(result);
            }
            catch (DBException ex)
            {
                throw ex;
            }
            catch (MySqlException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (data != null)
                {
                    data.Close();
                }
            }
        }
Exemple #8
0
        public List <TipoArticulo> List()
        {
            string              Statement = string.Format("select * from t03_tipoarticulo");
            MySqlDataReader     data      = null;
            List <TipoArticulo> List      = null;

            try
            {
                data = DBMysql_.DoQuery(Statement);
                if (data.HasRows)
                {
                    List = new List <TipoArticulo>();
                    while (data.Read())
                    {
                        TipoArticulo TipoArticulo_ = new TipoArticulo();
                        TipoArticulo_.Id          = data.IsDBNull(0) ? 0 : (int)data.GetUInt32(0);
                        TipoArticulo_.Descripcion = data.IsDBNull(1) ? "" : data.GetString(1);
                        List.Add(TipoArticulo_);
                    }
                }
                return(List);
            }
            catch (DBException ex)
            {
                throw ex;
            }
            catch (MySqlException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (data != null)
                {
                    data.Close();
                }
            }
        }