private void DataPortal_Create(CriteriaCs criteria)
        {
            Random r = new Random();

            Oid = (long)r.Next();
            GetNewCode();

            _c_profesores  = Curso_Instructors.NewChildList();
            _convocatorias = Convocatoria_Cursos.NewChildList();
            _materiales    = MaterialDocentes.NewChildList();
        }
        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);
            }
        }
示例#3
0
        // 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)
                {
                    IDataReader reader = Convocatoria_Cursos.DoNativeSELECT(AppContext.ActiveSchema.Code, Session());

                    IsReadOnly = false;

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

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

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

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

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

            this.RaiseListChangedEvents = true;
        }