예제 #1
0
        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();
        }
예제 #2
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);
            }
        }
        // called to retrieve data from db
        protected override void Fetch(CriteriaEx criteria)
        {
            this.RaiseListChangedEvents = false;

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

            try
            {
                if (nHMng.UseDirectSQL)
                {
                    IDataReader reader = Curso_Instructors.DoNativeSELECT(AppContext.ActiveSchema.Code, Session());

                    IsReadOnly = false;

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

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

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

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

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

            this.RaiseListChangedEvents = true;
        }