Exemplo n.º 1
0
        internal void DeleteSelf(WorkReports 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 <WorkReportRecord>(Oid));

            MarkNew();
        }
Exemplo n.º 2
0
        internal void Insert(WorkReports parent)
        {
            // if we're not dirty then don't update the database
            if (!this.IsDirty)
            {
                return;
            }

            GetNewCode();

            ValidationRules.CheckRules();

            if (!IsValid)
            {
                throw new iQValidationException(Library.Resources.Messages.GENERIC_VALIDATION_ERROR);
            }

            parent.Session().Save(Base.Record);

            MarkOld();
        }
Exemplo n.º 3
0
        public static WorkReport Get(long oid, bool childs, bool cache, int sessionCode)
        {
            WorkReport item;

            if (!cache)
            {
                return(Get(oid, childs));
            }

            //Está en la cache de listas
            if (Cache.Instance.Contains(typeof(WorkReports)))
            {
                WorkReports items = Cache.Instance.Get(typeof(WorkReports)) as WorkReports;
                item = items.GetItem(oid);

                //No está en la lista de la cache de listas
                if (item == null)
                {
                    item = WorkReport.GetChild(items.SessionCode, oid, childs);
                    items.AddItem(item);
                    Cache.Instance.Save(typeof(WorkReports), items);
                }
            }
            //Está en la cache de objetos
            else if (Cache.Instance.Contains(typeof(WorkReport)))
            {
                item = Cache.Instance.Get(typeof(WorkReport)) as WorkReport;
            }
            else
            {
                WorkReports items = WorkReports.NewList();

                item = sessionCode == -1 ? WorkReport.GetChild(oid, childs) : WorkReport.GetChild(sessionCode, oid, childs);
                items.AddItem(item);
                items.SessionCode = item.SessionCode;
                Cache.Instance.Save(typeof(WorkReports), items);
            }

            return(item);
        }
Exemplo n.º 4
0
        internal void Update(WorkReports parent)
        {
            // if we're not dirty then don't update the database
            if (!this.IsDirty)
            {
                return;
            }

            ValidationRules.CheckRules();

            if (!IsValid)
            {
                throw new iQValidationException(Library.Resources.Messages.GENERIC_VALIDATION_ERROR);
            }

            SessionCode = parent.SessionCode;
            WorkReportRecord obj = Session().Get <WorkReportRecord>(Oid);

            obj.CopyValues(Base.Record);
            Session().Update(obj);

            MarkOld();
        }