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

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

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

                    if (Childs)
                    {
                        ContactoEmpresa.DoLOCK(Session());
                        string query = ContactoEmpresas.SELECT_BY_FIELD("OidEmpresa", this.Oid);
                        reader     = nHManager.Instance.SQLNativeSelect(query, Session());
                        _contactos = ContactoEmpresas.GetChildList(reader);
                    }
                }
            }
            catch (Exception ex)
            {
                if (Transaction() != null)
                {
                    Transaction().Rollback();
                }
                iQExceptionHandler.TreatException(ex);
            }
        }
Beispiel #2
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);
            }
        }
            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);
            }
        // called to load data from list
        private void Fetch(IDataReader reader)
        {
            this.RaiseListChangedEvents = false;

            IsReadOnly = false;
            while (reader.Read())
            {
                this.AddItem(ContactoEmpresa.GetChild(reader).GetInfo());
            }
            IsReadOnly = true;

            this.RaiseListChangedEvents = true;
        }
        // called to retrieve data from database
        protected override void Fetch(CriteriaEx criteria)
        {
            this.RaiseListChangedEvents = false;

            SessionCode = criteria.SessionCode;

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

                    IDataReader reader = nHManager.Instance.SQLNativeSelect(criteria.Query, Session());;

                    IsReadOnly = false;

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

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

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

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

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

            this.RaiseListChangedEvents = true;
        }
Beispiel #6
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);
            }
        }