internal void UpdateTipo(ETipoAcreedor oldProviderType)
        {
            CriteriaEx criteria = Proveedor.GetCriteria(SessionCode);

            QueryConditions conditions = new QueryConditions
            {
                Acreedor     = this.GetInfo(false),
                TipoAcreedor = new ETipoAcreedor[1] {
                    oldProviderType
                },
                PaymentType = ETipoPago.Factura
            };

            criteria.Query = InputDelivery.UPDATE_TIPO(conditions);
            ExecuteSQL(criteria);

            criteria.Query = InputInvoiceSQL.UPDATE_TIPO(conditions);
            ExecuteSQL(criteria);

            criteria.Query = ProductoProveedor.UPDATE_TIPO(conditions);
            ExecuteSQL(criteria);

            //PagoFactura antes que Pago porque si modificamos el tipo del pago antes luego no coinciden
            criteria.Query = TransactionPayment.UPDATE_TIPO(conditions);
            ExecuteSQL(criteria);

            criteria.Query = Payment.UPDATE_TIPO(conditions);
            ExecuteSQL(criteria);
        }
        private void DataPortal_Fetch(CriteriaEx criteria)
        {
            try
            {
                _base.Record.Oid = 0;
                SessionCode      = criteria.SessionCode;
                Childs           = criteria.Childs;

                if (nHMng.UseDirectSQL)
                {
                    Transporter.DoLOCK(Session());
                    IDataReader reader = nHMng.SQLNativeSelect(criteria.Query, Session());

                    if (reader.Read())
                    {
                        CopyValues(reader);
                    }

                    if (Childs)
                    {
                        string query = string.Empty;

                        ProductoProveedor.DoLOCK(Session());
                        query  = ProductoProveedores.SELECT(this);
                        reader = nHMng.SQLNativeSelect(query, Session());
                        _base.ProviderBase.Productos = ProductoProveedores.GetChildList(SessionCode, reader);

                        PrecioDestino.DoLOCK(Session());
                        query            = PrecioDestinos.SELECT(this);
                        reader           = nHManager.Instance.SQLNativeSelect(query, Session());
                        _precio_destinos = PrecioDestinos.GetChildList(SessionCode, reader);

                        PrecioOrigen.DoLOCK(Session());
                        query            = Store.PrecioOrigenes.SELECT(this);
                        reader           = nHManager.Instance.SQLNativeSelect(query, Session());
                        _precio_origenes = PrecioOrigenes.GetChildList(SessionCode, reader);

                        //Pago.DoLOCK(Session());
                        //query = Pagos.SELECT(this);
                        //reader = nHManager.Instance.SQLNativeSelect(query, Session());
                        //_proveedor_base._pagos = Pagos.GetChildList(SessionCode, reader);
                    }
                }
            }
            catch (Exception ex)
            {
                if (Transaction() != null)
                {
                    Transaction().Rollback();
                }
                iQExceptionHandler.TreatException(ex);
            }
        }
        public static ProductoProveedorList GetChildList(IAcreedorInfo parent, bool childs)
        {
            CriteriaEx criteria = ProductoProveedor.GetCriteria(ProductoProveedor.OpenSession());

            criteria.Query  = ProductoProveedorList.SELECT(parent);
            criteria.Childs = childs;

            ProductoProveedorList list = DataPortal.Fetch <ProductoProveedorList>(criteria);

            CloseSession(criteria.SessionCode);

            return(list);
        }
        internal void CopyValues(ProductoProveedor source)
        {
            if (source == null)
            {
                return;
            }

            _record.CopyValues(source._base.Record);

            _p_impuestos  = source.PImpuestos;
            _oid_familia  = source.OidFamilia;
            _familia      = source.Familia;
            _producto     = source.Producto;
            _precio_venta = source.PrecioVenta;
            _ayuda        = source.Ayuda;
        }
        /// <summary>
        /// Retrieve the complete list from db
        /// </summary>
        /// <param name="get_childs">retrieving the childs</param>
        /// <returns></returns>
        public static ProductoProveedorList GetList(bool childs)
        {
            CriteriaEx criteria = ProductoProveedor.GetCriteria(ProductoProveedor.OpenSession());

            criteria.Childs = childs;

            //No criteria. Retrieve all de List
            if (nHManager.Instance.UseDirectSQL)
            {
                criteria.Query = ProductoProveedorList.SELECT();
            }

            ProductoProveedorList list = DataPortal.Fetch <ProductoProveedorList>(criteria);

            CloseSession(criteria.SessionCode);
            return(list);
        }
 public static string SELECT(QueryConditions conditions)
 {
     return(ProductoProveedor.SELECT(conditions, false));
 }