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

            // update (thus deleting) any deleted child objects
            foreach (AccionCorrectora 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 (AccionCorrectora obj in this)
            {
                if (obj.IsNew)
                {
                    obj.Insert(parent);
                }
                else
                {
                    obj.Update(parent);
                }
            }

            this.RaiseListChangedEvents = true;
        }
Exemplo n.º 2
0
        internal void DeleteSelf(Discrepancia 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 <AmpliacionRecord>(Oid));
            }
            catch (Exception ex)
            {
                iQExceptionHandler.TreatException(ex);
            }

            MarkNew();
        }
Exemplo n.º 3
0
        private void Fetch(InformeDiscrepancia source)
        {
            try
            {
                SessionCode = source.SessionCode;

                _base.CopyValues(source);

                CriteriaEx criteria = InformeAmpliacion.GetCriteria(Session());
                criteria.AddEq("OidInformeDiscrepancia", this.Oid);
                _ampliaciones = InformesAmpliaciones.GetChildList(criteria.List <InformeAmpliacion>());

                criteria = InformeCorrector.GetCriteria(Session());
                criteria.AddEq("OidInformeDiscrepancia", this.Oid);
                _correctores = InformesCorrectores.GetChildList(criteria.List <InformeCorrector>());

                criteria = Discrepancia.GetCriteria(Session());
                criteria.AddEq("OidInformeDiscrepancia", this.Oid);
                _discrepancias = Discrepancias.GetChildList(criteria.List <Discrepancia>());

                criteria = NotificacionInterna.GetCriteria(Session());
                criteria.AddEq("OidAsociado", this.Oid);
                criteria.AddEq("TipoAsociado", (long)TipoNotificacionAsociado.INFORME_DISCREPANCIAS);
                _notificaciones = NotificacionesInternas.GetChildList(criteria.List <NotificacionInterna>());
            }
            catch (Exception ex)
            {
                iQExceptionHandler.TreatException(ex);
            }

            MarkOld();
        }
Exemplo n.º 4
0
        public void CopyValues(Discrepancia source)
        {
            if (source == null)
            {
                return;
            }

            _record.CopyValues(source.Base.Record);
        }
Exemplo n.º 5
0
        public static Ampliacion NewChild(Discrepancia parent)
        {
            if (!CanAddObject())
            {
                throw new System.Security.SecurityException(
                          moleQule.Library.Resources.Messages.USER_NOT_ALLOWED);
            }

            Ampliacion obj = new Ampliacion();

            obj.OidDiscrepancia = parent.Oid;

            return(obj);
        }
Exemplo n.º 6
0
        public static DiscrepanciaList GetList(bool get_childs)
        {
            CriteriaEx criteria = Discrepancia.GetCriteria(Discrepancia.OpenSession());

            criteria.Childs = get_childs;

            criteria.Query = DiscrepanciaList.SELECT();

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

            CloseSession(criteria.SessionCode);

            return(list);
        }
Exemplo n.º 7
0
        public static DiscrepanciaList GetDiscrepanciasAbiertasList()
        {
            CriteriaEx criteria = Discrepancia.GetCriteria(Discrepancia.OpenSession());

            criteria.Childs = false;

            criteria.Query = DiscrepanciaList.SELECT_DISCREPANCIAS_ABIERTAS();

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

            CloseSession(criteria.SessionCode);

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

            OidDiscrepancia = parent.Oid;

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

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


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

            MarkOld();
        }
 public AccionCorrectora NewItem(Discrepancia parent)
 {
     this.AddItem(AccionCorrectora.NewChild(parent));
     return(this[Count - 1]);
 }
Exemplo n.º 11
0
 public void CopyFrom(Discrepancia source)
 {
     _base.CopyValues(source);
 }
Exemplo n.º 12
0
 public Ampliacion NewItem(Discrepancia parent)
 {
     this.AddItem(Ampliacion.NewChild(parent));
     return(this[Count - 1]);
 }
Exemplo n.º 13
0
        // called to retrieve data from the database
        private void DataPortal_Fetch(CriteriaEx criteria)
        {
            try
            {
                SessionCode = criteria.SessionCode;

                Childs = criteria.Childs;

                if (nHMng.UseDirectSQL)
                {
                    InformeDiscrepancia.LOCK(AppContext.ActiveSchema.Code);

                    IDataReader reader = InformeDiscrepancia.DoSELECT(AppContext.ActiveSchema.Code, Session(), criteria.Oid);

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

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

                        string query = InformesAmpliaciones.SELECT_BY_INFORME_DISCREPANCIA(this.Oid);
                        reader        = nHManager.Instance.SQLNativeSelect(query, Session());
                        _ampliaciones = InformesAmpliaciones.GetChildList(criteria.SessionCode, reader);

                        InformeCorrector.LOCK(AppContext.ActiveSchema.Code);

                        query        = InformesCorrectores.SELECT_BY_INFORME_DISCREPANCIA(this.Oid);
                        reader       = nHManager.Instance.SQLNativeSelect(query, Session());
                        _correctores = InformesCorrectores.GetChildList(criteria.SessionCode, reader);

                        Discrepancia.LOCK(AppContext.ActiveSchema.Code);

                        query          = Discrepancias.SELECT_BY_INFORME_DISCREPANCIA(this.Oid);
                        reader         = nHManager.Instance.SQLNativeSelect(query, Session());
                        _discrepancias = Discrepancias.GetChildList(criteria.SessionCode, reader);

                        NotificacionInterna.LOCK(AppContext.ActiveSchema.Code);

                        query           = NotificacionesInternas.SELECT_BY_INFORME_DISCREPANCIA(this.Oid, TipoNotificacionAsociado.INFORME_DISCREPANCIAS);
                        reader          = nHManager.Instance.SQLNativeSelect(query, Session());
                        _notificaciones = NotificacionesInternas.GetChildList(reader);
                    }
                }
                else
                {
                    _base.Record.CopyValues((InformeDiscrepanciaRecord)(criteria.UniqueResult()));

                    Session().Lock(Session().Get <InformeDiscrepanciaRecord>(Oid), LockMode.UpgradeNoWait);

                    if (Childs)
                    {
                        criteria = InformeAmpliacion.GetCriteria(Session());
                        criteria.AddEq("OidInformeDiscrepancia", this.Oid);
                        _ampliaciones = InformesAmpliaciones.GetChildList(criteria.List <InformeAmpliacion>());

                        criteria = InformeCorrector.GetCriteria(Session());
                        criteria.AddEq("OidInformeDiscrepancia", this.Oid);
                        _correctores = InformesCorrectores.GetChildList(criteria.List <InformeCorrector>());

                        criteria = Discrepancia.GetCriteria(Session());
                        criteria.AddEq("OidInformeDiscrepancia", this.Oid);
                        _discrepancias = Discrepancias.GetChildList(criteria.List <Discrepancia>());

                        criteria = NotificacionInterna.GetCriteria(Session());
                        criteria.AddEq("OidAsociado", this.Oid);
                        criteria.AddEq("TipoAsociado", (long)TipoNotificacionAsociado.INFORME_DISCREPANCIAS);
                        _notificaciones = NotificacionesInternas.GetChildList(criteria.List <NotificacionInterna>());
                    }
                }
            }
            catch (NHibernate.ADOException)
            {
                if (Transaction() != null)
                {
                    Transaction().Rollback();
                }
                throw new iQLockException(moleQule.Library.Resources.Messages.LOCK_ERROR);
            }
            catch (Exception ex)
            {
                if (Transaction() != null)
                {
                    Transaction().Rollback();
                }
                iQExceptionHandler.TreatException(ex);
            }
        }