internal void Update(Cuestion parent)
        {
            this.RaiseListChangedEvents = false;

            // update (thus deleting) any deleted child objects
            foreach (CuestionAuditoria obj in DeletedList)
            {
                obj.DeleteSelf(parent);
            }

            // now that they are deleted, remove them from memory too
            DeletedList.Clear();

            // AddItem/update any current child objects
            foreach (CuestionAuditoria obj in this)
            {
                if (obj.IsNew)
                {
                    obj.Insert(parent);
                }
                else
                {
                    obj.Update(parent);
                }
            }

            this.RaiseListChangedEvents = true;
        }
Esempio n. 2
0
        private void Fetch(TipoAuditoria source)
        {
            try
            {
                SessionCode = source.SessionCode;

                _base.CopyValues(source);

                CriteriaEx criteria = Criterio.GetCriteria(Session());
                criteria.AddEq("OidTipoAuditoria", this.Oid);
                _criterios = Criterios.GetChildList(criteria.List <Criterio>());

                criteria = Auditoria_Area.GetCriteria(Session());
                criteria.AddEq("OidAuditoria", this.Oid);
                _areas = Auditorias_Areas.GetChildList(criteria.List <Auditoria_Area>());

                criteria = Cuestion.GetCriteria(Session());
                criteria.AddEq("OidTipoAuditoria", this.Oid);
                _cuestiones = Cuestiones.GetChildList(criteria.List <Cuestion>());

                criteria = Plan_Tipo.GetCriteria(Session());
                criteria.AddEq("OidTipo", this.Oid);
                _planes_tipos = Planes_Tipos.GetChildList(criteria.List <Plan_Tipo>());
            }
            catch (Exception ex)
            {
                iQExceptionHandler.TreatException(ex);
            }

            MarkOld();
        }
Esempio n. 3
0
        internal void DeleteSelf(Cuestion 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;
            }

            try
            {
                SessionCode = parent.SessionCode;
                Session().Delete(Session().Get <CuestionAuditoriaRecord>(Oid));
            }
            catch (Exception ex)
            {
                iQExceptionHandler.TreatException(ex);
            }

            MarkNew();
        }
        public void CopyValues(Cuestion source)
        {
            if (source == null)
            {
                return;
            }

            _record.CopyValues(source.Base.Record);
        }
Esempio n. 5
0
        // called to retrieve data from the database
        private void DataPortal_Fetch(CriteriaEx criteria)
        {
            try
            {
                SessionCode = criteria.SessionCode;

                Childs = criteria.Childs;

                if (nHMng.UseDirectSQL)
                {
                    TipoAuditoria.LOCK();
                    IDataReader reader = nHMng.SQLNativeSelect(criteria.Query);

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

                    if (Childs)
                    {
                        Criterio.LOCK(AppContext.ActiveSchema.Code);

                        string query = Criterios.SELECT_BY_TIPO_AUDITORIA(this.Oid);
                        reader     = nHManager.Instance.SQLNativeSelect(query, Session());
                        _criterios = Criterios.GetChildList(reader);

                        Auditoria_Area.LOCK(AppContext.ActiveSchema.Code);

                        query  = Auditorias_Areas.SELECT_BY_AUDITORIA(this.Oid);
                        reader = nHManager.Instance.SQLNativeSelect(query, Session());
                        _areas = Auditorias_Areas.GetChildList(reader);

                        Cuestion.LOCK(AppContext.ActiveSchema.Code);

                        query       = Cuestiones.SELECT_BY_TIPO_AUDITORIA(this.Oid);
                        reader      = nHManager.Instance.SQLNativeSelect(query, Session());
                        _cuestiones = Cuestiones.GetChildList(criteria.SessionCode, reader);

                        Plan_Tipo.LOCK(AppContext.ActiveSchema.Code);

                        query         = Planes_Tipos.SELECT_BY_FIELD("OidTipo", this.Oid);
                        reader        = nHManager.Instance.SQLNativeSelect(query, Session());
                        _planes_tipos = Planes_Tipos.GetChildList(reader);
                    }
                }
            }
            catch (Exception ex)
            {
                if (Transaction() != null)
                {
                    Transaction().Rollback();
                }
                iQExceptionHandler.TreatException(ex);
            }
        }
Esempio n. 6
0
        //  private CuestionList() { }

        /// <summary>
        /// Retrieve the complete list from db
        /// </summary>
        /// <returns>CuestionList</returns>
        public static CuestionList GetList()
        {
            CriteriaEx criteria = Cuestion.GetCriteria(Cuestion.OpenSession());

            //No criteria. Retrieve all de List
            CuestionList list = DataPortal.Fetch <CuestionList> (criteria);

            CloseSession(criteria.SessionCode);

            return(list);
        }
Esempio n. 7
0
        public static CuestionAuditoria NewChild(Cuestion parent)
        {
            if (!CanAddObject())
            {
                throw new System.Security.SecurityException(
                          moleQule.Library.Resources.Messages.USER_NOT_ALLOWED);
            }

            CuestionAuditoria obj = new CuestionAuditoria();

            obj.OidCuestion = parent.Oid;

            return(obj);
        }
Esempio n. 8
0
        internal void Insert(Cuestion parent)
        {
            // if we're not dirty then don't update the database
            if (!this.IsDirty)
            {
                return;
            }

            try
            {
                parent.Session().Save(this.Base.Record);
            }
            catch (Exception ex)
            {
                iQExceptionHandler.TreatException(ex);
            }

            MarkOld();
        }
Esempio n. 9
0
        private void Fetch(int session_code, IDataReader source)
        {
            try
            {
                _base.CopyValues(source);

                if (Childs)
                {
                    Criterio.LOCK(AppContext.ActiveSchema.Code);

                    string      query  = Criterios.SELECT_BY_TIPO_AUDITORIA(this.Oid);
                    IDataReader reader = nHManager.Instance.SQLNativeSelect(query, Session(session_code));
                    _criterios = Criterios.GetChildList(reader);

                    Auditoria_Area.LOCK(AppContext.ActiveSchema.Code);

                    query  = Auditorias_Areas.SELECT_BY_AUDITORIA(this.Oid);
                    reader = nHManager.Instance.SQLNativeSelect(query, Session(session_code));
                    _areas = Auditorias_Areas.GetChildList(reader);

                    Cuestion.LOCK(AppContext.ActiveSchema.Code);

                    query       = Cuestiones.SELECT_BY_TIPO_AUDITORIA(this.Oid);
                    reader      = nHManager.Instance.SQLNativeSelect(query, Session(session_code));
                    _cuestiones = Cuestiones.GetChildList(session_code, reader);

                    Plan_Tipo.LOCK(AppContext.ActiveSchema.Code);

                    query         = Planes_Tipos.SELECT_BY_FIELD("OidTipo", this.Oid);
                    reader        = nHManager.Instance.SQLNativeSelect(query, Session(session_code));
                    _planes_tipos = Planes_Tipos.GetChildList(reader);
                }
            }
            catch (Exception ex)
            {
                iQExceptionHandler.TreatException(ex);
            }

            MarkOld();
        }
Esempio n. 10
0
        internal void Update(Cuestion parent)
        {
            // if we're not dirty then don't update the database
            if (!this.IsDirty)
            {
                return;
            }


            try
            {
                SessionCode = parent.SessionCode;
                CuestionAuditoriaRecord obj = Session().Get <CuestionAuditoriaRecord>(Oid);
                obj.CopyValues(this.Base.Record);
                Session().Update(obj);
            }
            catch (Exception ex)
            {
                iQExceptionHandler.TreatException(ex);
            }

            MarkOld();
        }
 public CuestionAuditoria NewItem(Cuestion parent)
 {
     this.AddItem(CuestionAuditoria.NewChild(parent));
     return(this[Count - 1]);
 }
Esempio n. 12
0
 public void CopyFrom(Cuestion source)
 {
     _base.CopyValues(source);
 }
Esempio n. 13
0
 public static string SELECT()
 {
     return(Cuestion.SELECT(new QueryConditions(), false));
 }