private static OutputInvoiceLineList GetList(string query, bool childs)
        {
            CriteriaEx criteria = OutputInvoiceLine.GetCriteria(OutputInvoiceLine.OpenSession());

            criteria.Childs = childs;

            criteria.Query = query;
            OutputInvoiceLineList list = DataPortal.Fetch <OutputInvoiceLineList>(criteria);

            CloseSession(criteria.SessionCode);
            return(list);
        }
        public static OutputInvoiceLineList GetChildList(OutputInvoiceInfo parent, bool childs)
        {
            CriteriaEx criteria = OutputInvoiceLine.GetCriteria(OutputInvoiceLine.OpenSession());

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

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

            list.CloseSession();

            return(list);
        }
        public static long GetCountByExpediente(long oid_exp)
        {
            CriteriaEx criteria = OutputInvoiceLine.GetCriteria(OutputInvoiceLine.OpenSession());

            criteria.Childs = false;

            criteria.Query = OutputInvoiceLine.COUNT_BY_EXPEDIENTE(oid_exp);
            IDataReader reader = nHManager.Instance.SQLNativeSelect(criteria.Query, criteria.Session);

            reader.Read();
            long cuenta = Convert.ToInt64(reader["CUENTA"]);

            CloseSession(criteria.SessionCode);
            return(cuenta);
        }
        /// <summary>
        /// Retrieve the complete list from db
        /// </summary>
        /// <param name="get_childs">retrieving the childs</param>
        /// <returns>ConceptoFacturaList</returns>
        public static OutputInvoiceLineList GetChildList(bool childs)
        {
            CriteriaEx criteria = OutputInvoiceLine.GetCriteria(OutputInvoiceLine.OpenSession());

            criteria.Childs = childs;

            if (nHManager.Instance.UseDirectSQL)
            {
                criteria.Query = SELECT();
            }

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

            CloseSession(criteria.SessionCode);
            return(list);
        }
        public static OutputInvoiceLineList GetListByExpediente(long oidExpedient, bool childs)
        {
            CriteriaEx criteria = OutputInvoiceLine.GetCriteria(OutputInvoiceLine.OpenSession());

            criteria.Childs = childs;

            Library.Invoice.QueryConditions conditions = new Library.Invoice.QueryConditions {
                Expediente = ExpedientInfo.New(oidExpedient)
            };
            criteria.Query = OutputInvoiceLineList.SELECT(conditions);

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

            CloseSession(criteria.SessionCode);

            return(list);
        }