示例#1
0
 public virtual void LoadChilds(Type type, bool childs)
 {
     if (type.Equals(typeof(MonitorLine)))
     {
         _lines = MonitorLines.GetChildList(this, childs);
     }
 }
示例#2
0
        /// <summary>
        /// Construye el objeto y se encarga de obtener los
        /// hijos si los tiene y se solicitan
        /// </summary>
        /// <param name="source">DataReader fuente</param>
        private void Fetch(IDataReader source)
        {
            _base.CopyValues(source);

            if (Childs)
            {
                if (nHMng.UseDirectSQL)
                {
                    MonitorLine.DoLOCK(Session());
                    string      query  = MonitorLines.SELECT(this);
                    IDataReader reader = nHMng.SQLNativeSelect(query);
                    _lines = MonitorLines.GetChildList(SessionCode, reader, false);
                }
            }

            MarkOld();
        }
示例#3
0
        /// <summary>
        /// Obtiene un registro de la base de datos
        /// </summary>
        /// <param name="criteria">Criterios de consulta</param>
        /// <remarks>Lo llama el DataPortal tras generar el objeto</remarks>
        private void DataPortal_Fetch(CriteriaEx criteria)
        {
            try
            {
                Oid         = 0;
                SessionCode = criteria.SessionCode;
                Childs      = criteria.Childs;

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

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

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

                        MonitorLine.DoLOCK(Session());
                        query  = MonitorLine.SELECT(this);
                        reader = nHMng.SQLNativeSelect(query);
                        _lines = MonitorLines.GetChildList(SessionCode, reader, Childs);
                    }
                }

                MarkOld();
            }
            catch (Exception ex)
            {
                if (Transaction() != null)
                {
                    Transaction().Rollback();
                }
                iQExceptionHandler.TreatException(ex, new object[] { criteria.Query });
            }
        }