Ejemplo n.º 1
0
        internal void Insert(InformeDiscrepancia 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();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Devuelve el siguiente Serial de PlanAnual
        /// </summary>
        /// <returns></returns>
        private static Int64 GetNewSerial(InformeDiscrepancia parent)
        {
            // Obtenemos la lista de clientes ordenados por serial
            SortedBindingList <DiscrepanciaInfo> Discrepancias =
                DiscrepanciaList.GetSortedList("Serial", ListSortDirection.Ascending);

            // Obtenemos el último serial de servicio
            Int64 lastcode;

            if (Discrepancias.Count > 0)
            {
                lastcode = Discrepancias[Discrepancias.Count - 1].Serial;
            }
            else
            {
                lastcode = Convert.ToInt64(Resources.Defaults.DISCREPANCIA_CODE_FORMAT);
            }

            foreach (Discrepancia item in parent.Discrepancias)
            {
                if (item.Serial > lastcode)
                {
                    lastcode = item.Serial;
                }
            }

            lastcode++;
            return(lastcode);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Devuelve el siguiente código de PlanAnual.
        /// </summary>
        /// <returns></returns>
        public static string GetNewCode(InformeDiscrepancia parent)
        {
            Int64 lastcode = Discrepancia.GetNewSerial(parent);

            // Devolvemos el siguiente codigo de PlanAnual
            return(lastcode.ToString(Resources.Defaults.DISCREPANCIA_CODE_FORMAT));
        }
Ejemplo n.º 4
0
        internal void Update(InformeDiscrepancia parent)
        {
            this.RaiseListChangedEvents = false;

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

            this.RaiseListChangedEvents = true;
        }
Ejemplo n.º 5
0
        private void Fetch(Auditoria source)
        {
            try
            {
                SessionCode = source.SessionCode;

                _base.CopyValues(source);

                CriteriaEx criteria = CuestionAuditoria.GetCriteria(Session());
                criteria.AddEq("OidAuditoria", this.Oid);
                _cuestiones = CuestionesAuditoria.GetChildList(criteria.List <CuestionAuditoria>());

                criteria = InformeDiscrepancia.GetCriteria(Session());
                criteria.AddEq("OidAuditoria", this.Oid);
                _informes = InformesDiscrepancias.GetChildList(criteria.List <InformeDiscrepancia>());

                criteria = HistoriaAuditoria.GetCriteria(Session());
                criteria.AddEq("OidAuditoria", this.Oid);
                _historial = HistoriaAuditorias.GetChildList(criteria.List <HistoriaAuditoria>());

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

            MarkOld();
        }
Ejemplo n.º 6
0
        internal void DeleteSelf(InformeDiscrepancia 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 <InformeAmpliacionRecord>(Oid));
            }
            catch (Exception ex)
            {
                iQExceptionHandler.TreatException(ex);
            }

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

            OidAsociado = parent.Oid;

            try
            {
                ValidationRules.CheckRules();

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

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

            MarkOld();
        }
Ejemplo n.º 8
0
        internal void Insert(InformeDiscrepancia 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;

            OidInformeDiscrepancia = parent.Oid;
            GetNewCode(parent.Oid);

            try
            {
                ValidationRules.CheckRules();

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

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

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

            MarkOld();
        }
Ejemplo n.º 9
0
        public void CopyValues(InformeDiscrepancia source)
        {
            if (source == null)
            {
                return;
            }

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

                Childs = criteria.Childs;

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

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

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

                        string query = CuestionesAuditoria.SELECT_BY_AUDITORIA(this.Oid);
                        reader      = nHManager.Instance.SQLNativeSelect(query, Session());
                        _cuestiones = CuestionesAuditoria.GetChildList(reader);

                        InformeDiscrepancia.LOCK(AppContext.ActiveSchema.Code);

                        query     = InformesDiscrepancias.SELECT_BY_AUDITORIA(this.Oid);
                        reader    = nHManager.Instance.SQLNativeSelect(query, Session());
                        _informes = InformesDiscrepancias.GetChildList(criteria.SessionCode, reader);

                        HistoriaAuditoria.LOCK(AppContext.ActiveSchema.Code);

                        query      = HistoriaAuditorias.SELECT_BY_AUDITORIA(Oid);
                        reader     = nHManager.Instance.SQLNativeSelect(query, Session());
                        _historial = HistoriaAuditorias.GetChildList(reader);

                        NotificacionInterna.LOCK(AppContext.ActiveSchema.Code);

                        query           = NotificacionesInternas.SELECT_BY_AUDITORIA(this.Oid, TipoNotificacionAsociado.COMUNICADO_AUDITORIA);
                        reader          = nHManager.Instance.SQLNativeSelect(query, Session());
                        _notificaciones = NotificacionesInternas.GetChildList(reader);
                    }
                }
            }
            catch (Exception ex)
            {
                if (Transaction() != null)
                {
                    Transaction().Rollback();
                }
                iQExceptionHandler.TreatException(ex);
            }
        }
        //  private InformeDiscrepanciaList() { }

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

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

            CloseSession(criteria.SessionCode);

            return(list);
        }
Ejemplo n.º 12
0
        public static Discrepancia NewChild(InformeDiscrepancia parent)
        {
            if (!CanAddObject())
            {
                throw new System.Security.SecurityException(
                          moleQule.Library.Resources.Messages.USER_NOT_ALLOWED);
            }

            Discrepancia obj = new Discrepancia();

            obj.OidInforme = parent.Oid;
            return(obj);
        }
Ejemplo n.º 13
0
        public static NotificacionInterna NewChild(InformeDiscrepancia parent)
        {
            if (!CanAddObject())
            {
                throw new System.Security.SecurityException(
                          moleQule.Library.Resources.Messages.USER_NOT_ALLOWED);
            }

            NotificacionInterna obj = new NotificacionInterna();

            obj.OidAsociado = parent.Oid;
            return(obj);
        }
        // called to retrieve data from db
        protected override void Fetch(CriteriaEx criteria)
        {
            this.RaiseListChangedEvents = false;

            Childs      = criteria.Childs;
            SessionCode = criteria.SessionCode;

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

                    IDataReader reader = nHManager.Instance.SQLNativeSelect(InformeDiscrepanciaList.SELECT(), Session());

                    IsReadOnly = false;

                    while (reader.Read())
                    {
                        this.AddItem(InformeDiscrepanciaInfo.Get(reader, Childs));
                    }

                    IsReadOnly = true;
                }
                else
                {
                    IList <InformeDiscrepancia> list = criteria.List <InformeDiscrepancia>();

                    if (list.Count > 0)
                    {
                        IsReadOnly = false;

                        foreach (InformeDiscrepancia item in list)
                        {
                            this.AddItem(item.GetInfo());
                        }

                        IsReadOnly = true;
                    }
                }
            }
            catch (Exception ex)
            {
                iQExceptionHandler.TreatException(ex);
            }

            this.RaiseListChangedEvents = true;
        }
Ejemplo n.º 15
0
        public static InformeAmpliacion NewChild(InformeDiscrepancia parent)
        {
            if (!CanAddObject())
            {
                throw new System.Security.SecurityException(
                          moleQule.Library.Resources.Messages.USER_NOT_ALLOWED);
            }

            InformeAmpliacion obj = new InformeAmpliacion();

            obj.MarkAsChild();
            obj.GetNewCode(parent.Oid);
            obj.OidInformeDiscrepancia = parent.Oid;
            obj.Numero = parent.Numero;
            return(obj);
        }
Ejemplo n.º 16
0
        private void Fetch(int session_code, IDataReader source)
        {
            try
            {
                _base.CopyValues(source);

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

                    string      query  = CuestionesAuditoria.SELECT_BY_AUDITORIA(this.Oid);
                    IDataReader reader = nHManager.Instance.SQLNativeSelect(query, Session(session_code));
                    _cuestiones = CuestionesAuditoria.GetChildList(reader);

                    InformeDiscrepancia.LOCK(AppContext.ActiveSchema.Code);

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

                    HistoriaAuditoria.LOCK(AppContext.ActiveSchema.Code);

                    query      = HistoriaAuditorias.SELECT_BY_AUDITORIA(Oid);
                    reader     = nHManager.Instance.SQLNativeSelect(query, Session(session_code));
                    _historial = HistoriaAuditorias.GetChildList(reader);

                    NotificacionInterna.LOCK(AppContext.ActiveSchema.Code);

                    query           = NotificacionesInternas.SELECT_BY_AUDITORIA(this.Oid, TipoNotificacionAsociado.COMUNICADO_AUDITORIA);
                    reader          = nHManager.Instance.SQLNativeSelect(query, Session(session_code));
                    _notificaciones = NotificacionesInternas.GetChildList(reader);
                }
            }
            catch (Exception ex)
            {
                iQExceptionHandler.TreatException(ex);
            }

            MarkOld();
        }
 public InformeCorrector NewItem(InformeDiscrepancia parent)
 {
     this.AddItem(InformeCorrector.NewChild(parent));
     return(this[Count - 1]);
 }
Ejemplo n.º 18
0
 public InformeAmpliacion NewItem(InformeDiscrepancia parent)
 {
     this.AddItem(InformeAmpliacion.NewChild(parent));
     return(this[Count - 1]);
 }
 public void CopyFrom(InformeDiscrepancia source)
 {
     _base.CopyValues(source);
 }
 public Discrepancia NewItem(InformeDiscrepancia parent)
 {
     this.AddItem(Discrepancia.NewChild(parent));
     return(this[Count - 1]);
 }
Ejemplo n.º 21
0
 public NotificacionInterna NewItem(InformeDiscrepancia parent)
 {
     this.AddItem(NotificacionInterna.NewChild(parent));
     return(this[Count - 1]);
 }
 public static string SELECT()
 {
     return(InformeDiscrepancia.SELECT(new QueryConditions(), false));
 }