internal void Update(Agente parent) { this.RaiseListChangedEvents = false; // update (thus deleting) any deleted child objects foreach (AgenteDocumento obj in DeletedList) { try { obj.DeleteSelf(parent); } catch { continue; } } // now that they are deleted, remove them from memory too DeletedList.Clear(); // add/update any current child objects foreach (AgenteDocumento obj in this) { if (obj.IsNew) { obj.Insert(parent); } else { obj.Update(parent); } } this.RaiseListChangedEvents = true; }
internal void DeleteSelf(Agente parent) { // if we're not dirty then don't update the database if (!this.IsDirty) { return; } // if we're new then don't update the database if (this.IsNew) { return; } try { SessionCode = parent.SessionCode; Session().Delete(Session().Get <AgentDocumentRecord>(Oid)); } catch (Exception ex) { throw new iQPersistentException(iQExceptionHandler.GetAllMessages(ex)); } MarkNew(); }
public static string SELECT(EntidadInfo source) { return(Agente.SELECT(new QueryConditions() { Entity = source }, true)); }
internal void CopyValues(Agente source) { if (source == null) { return; } _record.CopyValues(source.Base.Record); _entidad = source.Entidad; }
public static AgenteDocumento NewChild(Agente parent) { if (!CanAddObject()) { throw new System.Security.SecurityException(Resources.Messages.USER_NOT_ALLOWED); } AgenteDocumento obj = new AgenteDocumento(); obj.OidAgente = parent.Oid; return(obj); }
public static bool CheckDuplicate(Agente agente, Documento doc) { DocumentoList documentos = DocumentoList.GetListByAgente(agente); foreach (DocumentoInfo obj in documentos) { if (obj.Nombre.Equals(doc.Nombre) && obj.Oid != doc.Oid) { return(true); } } return(false); }
public static AgenteList GetList(bool childs) { CriteriaEx criteria = Agente.GetCriteria(Agente.OpenSession()); criteria.Childs = childs; //No criteria. Retrieve all de List if (nHManager.Instance.UseDirectSQL) { criteria.Query = AgenteList.SELECT(); } AgenteList list = DataPortal.Fetch <AgenteList>(criteria); CloseSession(criteria.SessionCode); return(list); }
// called to retrieve data from database protected override void Fetch(CriteriaEx criteria) { this.RaiseListChangedEvents = false; SessionCode = criteria.SessionCode; Childs = criteria.Childs; try { if (nHMng.UseDirectSQL) { IDataReader reader = nHManager.Instance.SQLNativeSelect(criteria.Query, Session()); IsReadOnly = false; while (reader.Read()) { this.AddItem(AgenteInfo.Get(SessionCode, reader, Childs)); } IsReadOnly = true; if (criteria.PagingInfo != null) { reader = nHManager.Instance.SQLNativeSelect(Agente.SELECT_COUNT(criteria), criteria.Session); if (reader.Read()) { criteria.PagingInfo.TotalItems = Format.DataReader.GetInt32(reader, "TOTAL_ROWS"); } } } } catch (Exception ex) { iQExceptionHandler.TreatException(ex, new object[] { criteria.Query }); } this.RaiseListChangedEvents = true; }
internal void Insert(Agente parent) { // if we're not dirty then don't update the database if (!this.IsDirty) { return; } OidAgente = parent.Oid; try { SessionCode = parent.SessionCode; parent.Session().Save(Base.Record); } catch (Exception ex) { throw new iQPersistentException(iQExceptionHandler.GetAllMessages(ex)); } MarkOld(); }
//Fetch independiente de DataPortal para generar un Entidad a partir de un IDataReader private void Fetch(IDataReader source) { try { _base.CopyValues(source); if (Childs) { if (nHMng.UseDirectSQL) { Agente.DoLOCK(Session()); string query = Agentes.SELECT(this); IDataReader reader = nHMng.SQLNativeSelect(query, Session()); _agentes = Agentes.GetChildList(reader, false); } } } catch (Exception ex) { iQExceptionHandler.TreatException(ex); } }
internal void Update(Agente parent) { this.RaiseListChangedEvents = false; // update (thus deleting) any deleted child objects /* foreach (Entidad obj in DeletedList) * obj.DeleteSelf(parent); * * // now that they are deleted, remove them from memory too * DeletedList.Clear(); * * // add/update any current child objects * foreach (Entidad obj in this) * { * if (obj.IsNew) * obj.Insert(parent); * else * obj.Update(parent); * }*/ this.RaiseListChangedEvents = true; }
private void DataPortal_Fetch(CriteriaEx criteria) { try { _base.Record.Oid = 0; SessionCode = criteria.SessionCode; Childs = criteria.Childs; if (nHMng.UseDirectSQL) { Entidad.DoLOCK(Session()); IDataReader reader = nHMng.SQLNativeSelect(criteria.Query, Session()); if (reader.Read()) { _base.CopyValues(reader); } if (Childs) { Agente.DoLOCK(Session()); string query = Agentes.SELECT(this); reader = nHMng.SQLNativeSelect(query, Session()); _agentes = Agentes.GetChildList(reader, false); } } } catch (Exception ex) { if (Transaction() != null) { Transaction().Rollback(); } iQExceptionHandler.TreatException(ex, new object[] { criteria.Query }); } }
internal void Update(Agente parent) { // if we're not dirty then don't update the database if (!this.IsDirty) { return; } OidAgente = parent.Oid; try { SessionCode = parent.SessionCode; AgentDocumentRecord obj = Session().Get <AgentDocumentRecord>(Oid); obj.CopyValues(Base.Record); Session().Update(obj); } catch (Exception ex) { throw new iQPersistentException(iQExceptionHandler.GetAllMessages(ex)); } MarkOld(); }
public Entidad NewItem(Agente parent) { //this.NewItem(Entidad.NewChild(parent)); return(this[Count - 1]); }
public static string SELECT(QueryConditions conditions) { return(Agente.SELECT(conditions, true)); }
public static DocumentoList GetListByAgente(Agente agente) { return(GetListByAgente(agente.GetInfo(false))); }
public static string SELECT(Agente source) { return(SELECT(new QueryConditions { Agent = source.GetInfo(false) })); }
public AgenteDocumento NewItem(Agente parent) { this.AddItem(AgenteDocumento.NewChild(parent)); return(this[Count - 1]); }