예제 #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);
            }
        }
예제 #2
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);
        }