internal void DeleteSelf(MaterialDocente 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 <Material_AlumnoRecord>(Oid));
            }
            catch (Exception ex)
            {
                iQExceptionHandler.TreatException(ex);
            }

            MarkNew();
        }
예제 #2
0
        internal void Update(MaterialDocente parent)
        {
            this.RaiseListChangedEvents = false;

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

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

            OidMaterial = parent.Oid;

            try
            {
                ValidationRules.CheckRules();

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

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

            MarkOld();
        }
예제 #4
0
        internal void Update(MaterialDocente 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;

            OidMaterial = parent.Oid;

            try
            {
                ValidationRules.CheckRules();

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

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

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

            MarkOld();
        }
예제 #5
0
        public void CopyValues(MaterialDocente source)
        {
            if (source == null)
            {
                return;
            }

            _record.CopyValues(source.Base.Record);

            _modulo = source.Modulo;
            _curso  = source.Curso;
        }
        public static Material_Alumno NewChild(MaterialDocente parent)
        {
            if (!CanAddObject())
            {
                throw new System.Security.SecurityException(
                          moleQule.Library.Resources.Messages.USER_NOT_ALLOWED);
            }

            Material_Alumno obj = new Material_Alumno();

            obj.OidMaterial = parent.Oid;
            return(obj);
        }
예제 #7
0
        public static RevisionMaterial NewChild(MaterialDocente parent)
        {
            if (!CanAddObject())
            {
                throw new System.Security.SecurityException(
                          moleQule.Library.Resources.Messages.USER_NOT_ALLOWED);
            }

            RevisionMaterial obj = new RevisionMaterial();

            obj.MarkAsChild();
            obj.OidMaterial = parent.Oid;
            return(obj);
        }
예제 #8
0
        private void DataPortal_Fetch(CriteriaEx criteria)
        {
            try
            {
                SessionCode = criteria.SessionCode;
                Childs      = criteria.Childs;

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

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

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

                        Curso_Instructor.DoLOCK(Session());

                        query         = Curso_Instructors.SELECT_BY_CURSO(this.Oid);
                        reader        = nHManager.Instance.SQLNativeSelect(query, Session());
                        _c_profesores = Curso_Instructors.GetChildList(reader);

                        Convocatoria_Curso.DoLOCK(Session());

                        query          = Convocatoria_Cursos.SELECT_BY_CURSO(this.Oid);
                        reader         = nHManager.Instance.SQLNativeSelect(query, Session());
                        _convocatorias = Convocatoria_Cursos.GetChildList(criteria.SessionCode, reader);

                        MaterialDocente.DoLOCK(Session());

                        query       = MaterialDocentes.SELECT_BY_CURSO(this.Oid);
                        reader      = nHManager.Instance.SQLNativeSelect(query, Session());
                        _materiales = MaterialDocentes.GetChildList(criteria.SessionCode, reader);
                    }
                }
            }
            catch (Exception exception)
            {
                if (Transaction() != null)
                {
                    Transaction().Rollback();
                }
                iQExceptionHandler.TreatException(exception);
            }
        }
예제 #9
0
        //  private MaterialDocenteList() { }

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

            criteria.Childs = childs;

            criteria.Query = MaterialDocenteList.SELECT();

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

            CloseSession(criteria.SessionCode);

            return(list);
        }
 public void CopyFrom(MaterialDocente source)
 {
     _base.CopyValues(source);
 }
예제 #11
0
 public Material_Plan NewItem(MaterialDocente parent)
 {
     this.AddItem(Material_Plan.NewChild(parent));
     return(this[Count - 1]);
 }
 public RevisionMaterial NewItem(MaterialDocente parent)
 {
     this.AddItem(RevisionMaterial.NewChild(parent));
     return(this[Count - 1]);
 }