private void DataPortal_Delete(CriteriaCs criteria) { try { SessionCode = OpenSession(); BeginTransaction(); //Si no hay integridad referencial, aquí se deben borrar las listas hijo CriteriaEx criterio = GetCriteria(); criterio.AddOidSearch(criteria.Oid); moleQule.Store.Data.ShippingCompanyRecord obj = (moleQule.Store.Data.ShippingCompanyRecord)(criterio.UniqueResult()); _base.Record.CopyValues(obj); _base.ProviderBase.Productos = ProductoProveedores.GetChildList(this, false); _base.ProviderBase.Productos.Clear(); _base.ProviderBase.Productos.Update(this); Session().Delete(obj); Transaction().Commit(); } catch (Exception ex) { if (Transaction() != null) { Transaction().Rollback(); } iQExceptionHandler.TreatException(ex); } finally { CloseSession(); } }
private void DataPortal_Fetch(CriteriaEx criteria) { try { _base.Record.Oid = 0; SessionCode = criteria.SessionCode; Childs = criteria.Childs; if (nHMng.UseDirectSQL) { Transporter.DoLOCK(Session()); IDataReader reader = nHMng.SQLNativeSelect(criteria.Query, Session()); if (reader.Read()) { CopyValues(reader); } if (Childs) { string query = string.Empty; ProductoProveedor.DoLOCK(Session()); query = ProductoProveedores.SELECT(this); reader = nHMng.SQLNativeSelect(query, Session()); _base.ProviderBase.Productos = ProductoProveedores.GetChildList(SessionCode, reader); PrecioDestino.DoLOCK(Session()); query = PrecioDestinos.SELECT(this); reader = nHManager.Instance.SQLNativeSelect(query, Session()); _precio_destinos = PrecioDestinos.GetChildList(SessionCode, reader); PrecioOrigen.DoLOCK(Session()); query = Store.PrecioOrigenes.SELECT(this); reader = nHManager.Instance.SQLNativeSelect(query, Session()); _precio_origenes = PrecioOrigenes.GetChildList(SessionCode, reader); //Pago.DoLOCK(Session()); //query = Pagos.SELECT(this); //reader = nHManager.Instance.SQLNativeSelect(query, Session()); //_proveedor_base._pagos = Pagos.GetChildList(SessionCode, reader); } } } catch (Exception ex) { if (Transaction() != null) { Transaction().Rollback(); } iQExceptionHandler.TreatException(ex); } }