internal void DeleteSelf(Auditoria 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
            {
                parent.Session().Delete(parent.Session().Get <HistoriaAuditoriaRecord>(Oid));
            }
            catch (Exception ex)
            {
                iQExceptionHandler.TreatException(ex);
            }

            MarkNew();
        }
        internal void Update(Auditoria parent)
        {
            // if we're not dirty then don't update the database
            if (!this.IsDirty)
            {
                return;
            }

            OidAuditoria = parent.Oid;
            OidEmpleado  = OidEmpleado != 0 ? OidEmpleado : parent.OidAuditor;

            try
            {
                ValidationRules.CheckRules();

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

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

            MarkOld();
        }
예제 #3
0
        internal void Insert(Auditoria parent)
        {
            // if we're not dirty then don't update the database
            if (!this.IsDirty)
            {
                return;
            }

            try
            {
                OidAuditoria = parent.Oid;
                long oid_old = this.Oid;
                parent.Session().Save(this.Base.Record);

                foreach (InformeDiscrepancia informe in parent.Informes)
                {
                    foreach (Discrepancia disc in informe.Discrepancias)
                    {
                        if (disc.OidCuestion == oid_old)
                        {
                            disc.OidCuestion = this.Oid;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                iQExceptionHandler.TreatException(ex);
            }

            MarkOld();
        }
예제 #4
0
        internal void Insert(Auditoria parent)
        {
            // if we're not dirty then don't update the database
            if (!this.IsDirty)
            {
                return;
            }

            OidAsociado = parent.Oid;
            GetNewCode();

            try
            {
                ValidationRules.CheckRules();

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

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

            MarkOld();
        }
예제 #5
0
        internal void Update(Auditoria parent)
        {
            // if we're not dirty then don't update the database
            if (!this.IsDirty)
            {
                return;
            }

            //Debe obtener la sesion del padre pq el objeto es padre a su vez
            SessionCode = parent.SessionCode;

            OidAuditoria = parent.Oid;

            try
            {
                ValidationRules.CheckRules();

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

                InformeDiscrepanciaRecord obj = parent.Session().Get <InformeDiscrepanciaRecord>(Oid);
                obj.CopyValues(this.Base.Record);
                parent.Session().Update(obj);

                _ampliaciones.Update(this);
                _correctores.Update(this);
                _discrepancias.Update(this);
                _notificaciones.Update(this);
            }
            catch (Exception ex)
            {
                iQExceptionHandler.TreatException(ex);
            }

            MarkOld();
        }