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

        //        CopyValues((Empresa)(criteria.UniqueResult()));

        //        Session().Lock(Session().Get<Empresa>(Oid), LockMode.UpgradeNoWait);

        //        criteria = ContactoE.GetCriteria(Session());
        //        criteria.AddEq("OidEmpresa", this.Oid);
        //        _contactos = ContactosE.GetChildList(criteria.List<ContactoE>());

        //    }
        //    catch (NHibernate.ADOException)
        //    {
        //        if (Transaction() != null) Transaction().Rollback();
        //        throw new iQLockException(Resources.Messages.LOCK_ERROR);
        //    }
        //    catch (Exception ex)
        //    {
        //        if (Transaction() != null) Transaction().Rollback();
        //        iQExceptionHandler.TreatException(ex);
        //    }
        //}

        private void DataPortal_Fetch(CriteriaEx criteria)
        {
            try
            {
                SessionCode = criteria.SessionCode;
                Childs      = criteria.Childs;

                if (nHMng.UseDirectSQL)
                {
                    Empresa.DoLOCK("COMMON", Session());

                    IDataReader reader = Empresa.DoSELECT("COMMON", Session(), criteria.Oid);

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

                    if (Childs)
                    {
                        ContactoEmpresa.DoLOCK("COMMON", Session());

                        string query = ContactoEmpresas.SELECT_BY_FIELD("COMMON", "OidEmpresa", this.Oid);
                        reader     = nHManager.Instance.SQLNativeSelect(query, Session());
                        _contactos = ContactoEmpresas.GetChildList(reader);
                    }
                }
                else
                {
                    CopyValues((Empresa)(criteria.UniqueResult()));

                    Session().Lock(Session().Get <Empresa>(Oid), LockMode.UpgradeNoWait);

                    if (Childs)
                    {
                        criteria = ContactoEmpresa.GetCriteria(Session());
                        criteria.AddEq("OidEmpresa", this.Oid);
                        _contactos = ContactoEmpresas.GetChildList(criteria.List <ContactoEmpresa>());
                    }
                }
            }
            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
            protected override void DataPortal_Execute()
            {
                // Buscar por Oid
                CriteriaEx criteria = ContactoEmpresa.GetCriteria(ContactoEmpresa.OpenSession());

                criteria.AddOidSearch(_codigo);
                ContactoEmpresaList list = ContactoEmpresaList.GetList(criteria);

                _exists = (list.Count > 0);
            }
Example #3
0
        private void DataPortal_Fetch(CriteriaEx criteria)
        {
            try
            {
                CopyValues((Empresa)(criteria.UniqueResult()));
                SessionCode = criteria.SessionCode;
                Childs      = criteria.Childs;

                if (Childs)
                {
                    criteria = ContactoEmpresa.GetCriteria(Session());
                    criteria.AddEq("OidEmpresa", this.Oid);
                    _contactos = ContactoEmpresaList.GetChildList(criteria.List <ContactoEmpresa>());
                }
            }
            catch (Exception ex)
            {
                iQExceptionHandler.TreatException(ex);
            }
        }