public static LivestockBook Get(long oid, bool childs, bool cache, int sessionCode) { LivestockBook item; //No está en la cache de listas if (!Cache.Instance.Contains(typeof(LivestockBooks))) { LivestockBooks items = LivestockBooks.NewList(); item = LivestockBook.GetChild(sessionCode, oid, childs); items.AddItem(item); items.SessionCode = sessionCode; Cache.Instance.Save(typeof(LivestockBooks), items); } else { LivestockBooks items = Cache.Instance.Get(typeof(LivestockBooks)) as LivestockBooks; item = items.GetItem(oid); //No está en la lista de la cache de listas if (item == null) { item = LivestockBook.GetChild(items.SessionCode, oid, childs); items.AddItem(item); Cache.Instance.Save(typeof(LivestockBooks), items); } } return(item); }
/// <summary> /// Borra el registro de la base de datos /// </summary> /// <param name="parent">Lista padre</param> /// <remarks>La utiliza la BusinessListBaseEx correspondiente para borrar elementos<remarks/> internal void DeleteSelf(LivestockBooks 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; } SessionCode = parent.SessionCode; Session().Delete(Session().Get <LivestockBookRecord>(Oid)); MarkNew(); }
/// <summary> /// Inserta el registro en la base de datos /// </summary> /// <param name="parent">Lista padre</param> /// <remarks>La utiliza la BusinessListBaseEx correspondiente para insertar elementos<remarks/> internal void Insert(LivestockBooks parent) { // if we're not dirty then don't update the database if (!this.IsDirty) { return; } GetNewCode(); ValidationRules.CheckRules(); if (!IsValid) { throw new iQValidationException(moleQule.Resources.Messages.GENERIC_VALIDATION_ERROR); } parent.Session().Save(Base.Record); MarkOld(); }
/// <summary> /// Actualiza el registro en la base de datos /// </summary> /// <param name="parent">Lista padre</param> /// <remarks>La utiliza la BusinessListBaseEx correspondiente para actualizar elementos<remarks/> internal void Update(LivestockBooks parent) { // if we're not dirty then don't update the database if (!this.IsDirty) { return; } ValidationRules.CheckRules(); if (!IsValid) { throw new iQValidationException(moleQule.Resources.Messages.GENERIC_VALIDATION_ERROR); } SessionCode = parent.SessionCode; LivestockBookRecord obj = Session().Get <LivestockBookRecord>(Oid); obj.CopyValues(this._base.Record); Session().Update(obj); MarkOld(); }