/// <summary> /// Crea un nuevo elemento y lo añade a la lista /// </summary> /// <returns>Nuevo item</returns> public WorkReportResource NewItem(WorkReport parent) { this.NewItem(WorkReportResource.NewChild(parent)); WorkReportResource item = this[Count - 1]; return(item); }
/// <summary> /// Realiza el Save de los objetos de la lista. Inserta, Actualiza o Borra en función /// de los flags de cada objeto de la lista /// </summary> /// <param name="parent">BusinessBaseEx padre de la lista</param> internal void Update(WorkReport parent) { try { this.RaiseListChangedEvents = false; SessionCode = parent.SessionCode; // update (thus deleting) any deleted child objects foreach (WorkReportResource 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 (WorkReportResource obj in this) { if (obj.IsNew) { obj.Insert(parent); } else { obj.Update(parent); } } } finally { this.RaiseListChangedEvents = true; } }
/// <summary> /// Borra un registro de la base de datos. /// </summary> /// <param name="parent">Objeto padre</param> /// <remarks>Borrado inmediato<remarks/> internal void DeleteSelf(WorkReport 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; } if (EEntityType == moleQule.Common.Structs.ETipoEntidad.OutputDelivery) { Assembly assembly = Assembly.Load("moleQule.Library.Invoice"); Type type = assembly.GetType("moleQule.Library.Invoice.OutputDelivery"); type.InvokeMember("Delete" , BindingFlags.Static | BindingFlags.InvokeMethod | BindingFlags.Public , null, null, new object[3] { OidResource, ETipoEntidad.WorkReport, parent.SessionCode }); //OutputDelivery.Delete(OidResource, ETipoEntidad.WorkReport, parent.SessionCode); } SessionCode = parent.SessionCode; Session().Delete(Session().Get <WorkReportResourceRecord>(Oid)); MarkNew(); }
/// <summary> /// Actualiza un registro en la base de datos /// </summary> /// <param name="parent">Objeto padre</param> internal void Update(WorkReport parent) { // if we're not dirty then don't update the database if (!this.IsDirty) { return; } //Debe obtener la sesion del padre pq el objeto es padre a su vez SessionCode = parent.SessionCode; OidWorkReport = parent.Oid; ValidationRules.CheckRules(); if (!IsValid) { throw new iQValidationException(moleQule.Resources.Messages.GENERIC_VALIDATION_ERROR); } WorkReportResourceRecord obj = parent.Session().Get <WorkReportResourceRecord>(Oid); obj.CopyValues(Base.Record); parent.Session().Update(obj); MarkOld(); }
public static string SELECT(WorkReport item) { Library.Store.QueryConditions conditions = new Library.Store.QueryConditions { WorkReport = item.GetInfo(false) }; return(SELECT(conditions, false)); }
public static WorkReportResources GetChildList(WorkReport parent, bool childs) { CriteriaEx criteria = WorkReport.GetCriteria(parent.SessionCode); criteria.Query = SELECT(parent); criteria.Childs = childs; return(DataPortal.Fetch <WorkReportResources>(criteria)); }
protected virtual void CopyFrom(WorkReport source) { if (source == null) { return; } OidWorkReport = source.Oid; From = source.From; Till = source.Till; Hours = source.Hours; }
public void CopyValues(WorkReport source) { if (source == null) { return; } _record.CopyValues(source.Base.Record); _expedient = source.Expedient; _owner = source.Owner; _category_name = source.CategoryName; }
public static WorkReportResource NewChild(WorkReport parent, IWorkResource item = null) { if (!CanAddObject()) { throw new System.Security.SecurityException(moleQule.Resources.Messages.USER_NOT_ALLOWED); } WorkReportResource obj = DataPortal.Create <WorkReportResource>(new CriteriaCs(-1)); obj.CopyFrom(parent); obj.CopyFrom(item); obj.MarkAsChild(); return(obj); }
public WorkReportResource NewItem(WorkReport parent, WorkReportResourceInfo item) { this.NewItem(WorkReportResource.NewChild(parent, item)); return(this[Count - 1]); }
public static string SELECT(WorkReport parent) { return(WorkReportResource.SELECT(new QueryConditions { WorkReport = parent.GetInfo(false) }, true)); }