Example #1
0
        private void DataPortal_Fetch(CriteriaEx criteria)
        {
            try
            {
                SessionCode = criteria.SessionCode;
                Childs      = criteria.Childs;

                if (nHMng.UseDirectSQL)
                {
                    PlanExtra.DoLOCK(Session());
                    IDataReader reader = PlanExtra.DoSELECT(AppContext.ActiveSchema.Code, Session(), criteria.Oid);

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

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

                        ClaseExtra.DoLOCK(Session());

                        query     = ClaseExtras.SELECT_CLASES_EXTRAS_PLAN(this.Oid);
                        reader    = nHManager.Instance.SQLNativeSelect(query, Session());
                        _c_extras = ClaseExtras.GetChildList(reader);
                    }
                }
                else
                {
                    _base.Record.CopyValues((PlanExtraRecord)(criteria.UniqueResult()));
                    //Session().Lock(Session().Get<PlanExtraRecord>(Oid), LockMode.UpgradeNoWait);

                    if (Childs)
                    {
                        criteria = ClaseExtra.GetCriteria(Session());
                        criteria.AddEq("OidPlan", this.Oid);
                        _c_extras = ClaseExtras.GetChildList(criteria.List <ClaseExtra>());
                    }
                }
            }
            catch (NHibernate.ADOException)
            {
                if (Transaction() != null)
                {
                    Transaction().Rollback();
                }
                throw new iQLockException(moleQule.Library.Resources.Messages.LOCK_ERROR);
            }
            catch (Exception ex)
            {
                if (Transaction() != null)
                {
                    Transaction().Rollback();
                }
                iQExceptionHandler.TreatException(ex);
            }
        }
Example #2
0
        //  private ClaseExtraList() { }

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

            criteria.Query = ClaseExtras.SELECT();

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

            CloseSession(criteria.SessionCode);

            return(list);
        }
Example #3
0
        /// <summary>
        /// Retrieve the complete list from db
        /// </summary>
        /// <returns>ClaseExtraList</returns>
        public static ClaseExtraList GetDisponiblesList(long oid_promocion, long oid_horario)
        {
            CriteriaEx criteria = ClaseExtra.GetCriteria(ClaseExtra.OpenSession());

            criteria.Query = ClaseExtras.SELECT_CLASES_EXTRAS_DISPONIBLES(oid_promocion, oid_horario);

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

            CloseSession(criteria.SessionCode);

            return(list);
        }
Example #4
0
        /// <summary>
        /// Retrieve the complete list from db
        /// </summary>
        /// <returns>ClasePracticaList</returns>
        public static ClaseExtraList GetClasesPlanList(long oid_plan)
        {
            CriteriaEx criteria = ClaseExtra.GetCriteria(ClaseExtra.OpenSession());

            //No criteria. Retrieve all de List
            if (nHManager.Instance.UseDirectSQL)
            {
                criteria.Query = ClaseExtras.SELECT_CLASES_EXTRAS_PLAN(oid_plan);
            }
            ClaseExtraList list = DataPortal.Fetch <ClaseExtraList>(criteria);

            CloseSession(criteria.SessionCode);

            return(list);
        }