Example #1
0
        internal void Update(ClaseTeorica parent)
        {
            // if we're not dirty then don't update the database
            if (!this.IsDirty)
            {
                return;
            }

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

            OidClaseTeorica = parent.Oid;

            try
            {
                ValidationRules.CheckRules();

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

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

                //_asistencias.Update(this);
            }
            catch (Exception ex)
            {
                iQExceptionHandler.TreatException(ex);
            }

            MarkOld();
        }
Example #2
0
        internal void DeleteSelf(ClaseTeorica 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 <SesionCronogramaRecord>(Oid));
            }
            catch (Exception ex)
            {
                iQExceptionHandler.TreatException(ex);
            }

            MarkNew();
        }
        internal void Update(ClaseTeorica parent)
        {
            this.RaiseListChangedEvents = false;

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

            this.RaiseListChangedEvents = true;
        }
Example #4
0
        internal void Insert(ClaseTeorica 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;

            OidClaseTeorica = parent.Oid;

            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();
        }
Example #5
0
        private void DataPortal_Fetch(CriteriaEx criteria)
        {
            try
            {
                SessionCode = criteria.SessionCode;
                Childs      = criteria.Childs;

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

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

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

                        ClaseTeorica.DoLOCK(Session());
                        query       = ClaseTeoricas.SELECT_BY_PLAN(this.Oid);
                        reader      = nHManager.Instance.SQLNativeSelect(query, Session());
                        _c_teoricas = ClaseTeoricas.GetChildList(reader);

                        ClasePractica.DoLOCK(Session());
                        query        = ClasePracticas.SELECT_BY_PLAN(this.Oid);
                        reader       = nHManager.Instance.SQLNativeSelect(query, Session());
                        _c_practicas = ClasePracticas.GetChildList(reader);
                    }
                }
                else
                {
                    _base.Record.CopyValues((PlanEstudiosRecord)(criteria.UniqueResult()));
                    //Session().Lock(Session().Get<PlanEstudiosRecord>(Oid), LockMode.UpgradeNoWait);

                    if (Childs)
                    {
                        criteria = ClaseTeorica.GetCriteria(Session());
                        criteria.AddEq("OidPlan", this.Oid);
                        _c_teoricas = ClaseTeoricas.GetChildList(criteria.List <ClaseTeorica>());

                        criteria = ClasePractica.GetCriteria(Session());
                        criteria.AddEq("OidPlan", this.Oid);
                        _c_practicas = ClasePracticas.GetChildList(criteria.List <ClasePractica>());
                    }
                }
            }
            catch (Exception ex)
            {
                if (Transaction() != null)
                {
                    Transaction().Rollback();
                }
                iQExceptionHandler.TreatException(ex);
            }
        }
        /// <summary>
        /// Retrieve the complete list from db
        /// </summary>
        /// <returns>ClaseTeoricaList</returns>
        public static ClaseTeoricaList GetProgramadasList(long oid_plan, long oid_promocion)
        {
            CriteriaEx criteria = ClaseTeorica.GetCriteria(ClaseTeorica.OpenSession());

            //No criteria. Retrieve all de List
            criteria.Query = ClaseTeoricas.SELECT_CLASES_TEORICAS_PROGRAMADAS(oid_plan, oid_promocion);
            ClaseTeoricaList list = DataPortal.Fetch <ClaseTeoricaList>(criteria);

            CloseSession(criteria.SessionCode);

            return(list);
        }
        /// <summary>
        /// Retrieve the complete list from db
        /// </summary>
        /// <returns>ClaseTeoricaList</returns>
        public static ClaseTeoricaList GetDisponiblesList(long oid_plan, long oid_promocion, long oid_horario)
        {
            CriteriaEx criteria = ClaseTeorica.GetCriteria(ClaseTeorica.OpenSession());

            //No criteria. Retrieve all de List
            criteria.Query = ClaseTeoricas.SELECT_CLASES_TEORICAS_DISPONIBLES(oid_plan, oid_promocion, oid_horario);
            ClaseTeoricaList list = DataPortal.Fetch <ClaseTeoricaList>(criteria);

            CloseSession(criteria.SessionCode);

            return(list);
        }
        /// <summary>
        /// Retrieve the complete list from db
        /// </summary>
        /// <returns>ClaseTeoricaList</returns>
        public static ClaseTeoricaList GetImpartidasList(long oid_promocion, DateTime fecha)
        {
            CriteriaEx criteria = ClaseTeorica.GetCriteria(ClaseTeorica.OpenSession());

            //No criteria. Retrieve all de List
            criteria.Query = ClaseTeorica.SELECT_IMPARTIDAS(oid_promocion, fecha, false);
            ClaseTeoricaList list = DataPortal.Fetch <ClaseTeoricaList>(criteria);

            CloseSession(criteria.SessionCode);

            return(list);
        }
        }/// <summary>

        /// Retrieve the complete list from db
        /// </summary>
        /// <returns>ClaseTeoricaList</returns>
        public static ClaseTeoricaList GetClasesPlanList(long oid_plan)
        {
            CriteriaEx criteria = ClaseTeorica.GetCriteria(ClaseTeorica.OpenSession());

            //No criteria. Retrieve all de List
            criteria.Query = ClaseTeoricas.SELECT_CLASES_TEORICAS_PLAN(oid_plan);
            ClaseTeoricaList list = DataPortal.Fetch <ClaseTeoricaList>(criteria);

            CloseSession(criteria.SessionCode);

            return(list);
        }
Example #10
0
        public static SesionCronograma NewChild(ClaseTeorica parent)
        {
            if (!CanAddObject())
            {
                throw new System.Security.SecurityException(
                          moleQule.Library.Resources.Messages.USER_NOT_ALLOWED);
            }

            SesionCronograma obj = new SesionCronograma();

            obj.OidClaseTeorica = parent.Oid;
            return(obj);
        }
        //  private ClaseTeoricaList() { }

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

            //No criteria. Retrieve all de List
            if (nHManager.Instance.UseDirectSQL)
            {
                criteria.Query = ClaseTeoricas.SELECT();
            }
            ClaseTeoricaList list = DataPortal.Fetch <ClaseTeoricaList>(criteria);

            CloseSession(criteria.SessionCode);

            return(list);
        }
        public static ClaseTeoricaList GetListBySubmodulo(long oid)
        {
            CriteriaEx criteria = ClaseTeorica.GetCriteria(ClaseTeorica.OpenSession());

            if (nHManager.Instance.UseDirectSQL)
            {
                criteria.Query = ClaseTeoricaList.SELECT_BY_SUBMODULO(oid);
            }

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

            CloseSession(criteria.SessionCode);

            return(list);
        }
        public void CopyValues(ClaseTeorica source)
        {
            if (source == null)
            {
                return;
            }

            _record.CopyValues(source.Base.Record);

            _modulo          = source.Modulo;
            _submodulo       = source.Submodulo;
            _codigo_orden    = source.CodigoOrden;
            _estado          = source.Estado;
            _instructor      = source.Instructor;
            _fecha           = source.Fecha;
            _hora            = source.Hora;
            _total_modulo    = source.TotalModulo;
            _total_submodulo = source.TotalSubmodulo;
        }
 public Sesion NewItem(ClaseTeorica parent)
 {
     this.AddItem(Sesion.NewChild(parent));
     return(this[Count - 1]);
 }
Example #15
0
 public void CopyFrom(ClaseTeorica source)
 {
     _base.CopyValues(source);
 }