コード例 #1
0
ファイル: Registro.cs プロジェクト: anastasiaramos/moleQule
        /// <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)
                {
                    LineaRegistro.DoLOCK(Session());
                    string      query  = RegistryLines.SELECT(this);
                    IDataReader reader = nHMng.SQLNativeSelect(query);
                    _lineas = RegistryLines.GetChildList(SessionCode, reader, false);
                }
            }

            MarkOld();
        }
コード例 #2
0
        /// <summary>
        /// Borra el registro de la base de datos
        /// </summary>
        /// <param name="parent">Lista padre</param>
        /// <remarks>La utiliza la BusinessListBaseEx correspondiente para borrar elementos<remarks/>
        internal void DeleteSelf(RegistryLines parent)
        {
            // if we're not dirty then don't update the database
            if (!this.IsDirty)
            {
                return;
            }

            // if we're new then don't update the database
            if (this.IsNew)
            {
                return;
            }

            SessionCode = parent.SessionCode;
            Session().Delete(Session().Get <RegistryLineRecord>(Oid));

            MarkNew();
        }
コード例 #3
0
        /// <summary>
        /// Inserta el registro en la base de datos
        /// </summary>
        /// <param name="parent">Lista padre</param>
        /// <remarks>La utiliza la BusinessListBaseEx correspondiente para insertar elementos<remarks/>
        internal void Insert(RegistryLines parent)
        {
            // if we're not dirty then don't update the database
            if (!this.IsDirty)
            {
                return;
            }

            ValidationRules.CheckRules();

            if (!IsValid)
            {
                throw new iQValidationException(Library.Resources.Messages.GENERIC_VALIDATION_ERROR);
            }

            parent.Session().Save(Base.Record);

            MarkOld();
        }
コード例 #4
0
ファイル: Registro.cs プロジェクト: anastasiaramos/moleQule
        /// <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
            {
                _base.Record.Oid = 0;
                SessionCode      = criteria.SessionCode;
                Childs           = criteria.Childs;

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

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

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

                        LineaRegistro.DoLOCK(Session());
                        query   = RegistryLines.SELECT(this);
                        reader  = nHMng.SQLNativeSelect(query);
                        _lineas = RegistryLines.GetChildList(SessionCode, reader, Childs);
                    }
                }

                MarkOld();
            }
            catch (Exception ex)
            {
                if (Transaction() != null)
                {
                    Transaction().Rollback();
                }
                iQExceptionHandler.TreatException(ex);
            }
        }
コード例 #5
0
        /// <summary>
        /// Actualiza el registro en la base de datos
        /// </summary>
        /// <param name="parent">Lista padre</param>
        /// <remarks>La utiliza la BusinessListBaseEx correspondiente para actualizar elementos<remarks/>
        internal void Update(RegistryLines parent)
        {
            // if we're not dirty then don't update the database
            if (!this.IsDirty)
            {
                return;
            }

            ValidationRules.CheckRules();

            if (!IsValid)
            {
                throw new iQValidationException(Library.Resources.Messages.GENERIC_VALIDATION_ERROR);
            }

            SessionCode = parent.SessionCode;
            RegistryLineRecord obj = Session().Get <RegistryLineRecord>(Oid);

            obj.CopyValues(this._base.Record);
            Session().Update(obj);

            MarkOld();
        }