コード例 #1
0
        private void DataPortal_Fetch(CriteriaEx criteria)
        {
            try
            {
                SessionCode = criteria.SessionCode;
                Childs      = criteria.Childs;

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

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

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

                        PuntoActa.DoLOCK(Session());
                        query       = PuntosActas.SELECT_BY_ACTA(this.Oid);
                        reader      = nHManager.Instance.SQLNativeSelect(query, Session());
                        _puntoactas = PuntosActas.GetChildList(reader);
                    }
                }
                else
                {
                    Session().Lock(Session().Get <ActaComiteRecord>(Oid), LockMode.UpgradeNoWait);
                    _base.Record.CopyValues((ActaComiteRecord)(criteria.UniqueResult()));

                    if (Childs)
                    {
                        criteria = PuntoActa.GetCriteria(Session());
                        criteria.AddEq("OidActa", this.Oid);
                        _puntoactas = PuntosActas.GetChildList(criteria.List <PuntoActa>());
                    }
                }
            }
            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
        private void DataPortal_Create(CriteriaCs criteria)
        {
            Random r = new Random();

            Oid    = (long)r.Next();
            Codigo = (0).ToString(Resources.Defaults.ACTA_COMITE_CODE_FORMAT);

            _puntoactas = PuntosActas.NewChildList();
        }