Example #1
0
        internal void Update(ActaComite parent)
        {
            this.RaiseListChangedEvents = false;

            // update (thus deleting) any deleted child objects
            foreach (PuntoActa obj in DeletedList)
            {
                obj.DeleteSelf(parent);
            }

            // now that they are deleted, remove them from memory too
            DeletedList.Clear();

            // AddItem/update any current child objects
            foreach (PuntoActa obj in this)
            {
                if (obj.IsNew)
                {
                    obj.Insert(parent);
                }
                else
                {
                    obj.Update(parent);
                }
            }

            this.RaiseListChangedEvents = true;
        }
Example #2
0
        /// <summary>
        /// Devuelve el siguiente Serial de ActaComite
        /// </summary>
        /// <returns></returns>
        private static Int64 GetNewSerial(ActaComite parent)
        {
            // Obtenemos la lista de clientes ordenados por serial
            SortedBindingList <PuntoActaInfo> Puntos =
                PuntoActaList.GetSortedList("Serial", ListSortDirection.Ascending);

            // Obtenemos el último serial de servicio
            Int64 lastcode;

            if (Puntos.Count > 0)
            {
                lastcode = Puntos[Puntos.Count - 1].Serial;
            }
            else
            {
                lastcode = Convert.ToInt64(Resources.Defaults.PUNTO_ACTA_CODE_FORMAT);
            }

            foreach (PuntoActa item in parent.PuntosActas)
            {
                if (lastcode < item.Serial)
                {
                    lastcode = item.Serial;
                }
            }

            lastcode++;
            return(lastcode);
        }
Example #3
0
        internal void DeleteSelf(ActaComite 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 <PuntoActaRecord>(Oid));
            }
            catch (Exception ex)
            {
                iQExceptionHandler.TreatException(ex);
            }

            MarkNew();
        }
Example #4
0
        /// <summary>
        /// Devuelve el siguiente código de ActaComite.
        /// </summary>
        /// <returns></returns>
        public static string GetNewCode(ActaComite parent)
        {
            Int64 lastcode = PuntoActa.GetNewSerial(parent);

            // Devolvemos el siguiente codigo de ActaComite
            return(lastcode.ToString(Resources.Defaults.PUNTO_ACTA_CODE_FORMAT));
        }
Example #5
0
        public void CopyValues(ActaComite source)
        {
            if (source == null)
            {
                return;
            }

            _record.CopyValues(source.Base.Record);
        }
Example #6
0
        public static PuntoActa NewChild(ActaComite parent)
        {
            if (!CanAddObject())
            {
                throw new System.Security.SecurityException(
                          moleQule.Library.Resources.Messages.USER_NOT_ALLOWED);
            }

            PuntoActa obj = new PuntoActa();

            obj.OidActa = parent.Oid;

            return(obj);
        }
Example #7
0
        /// <summary>
        /// Retrieve the complete list from db
        /// </summary>
        /// <param name="get_childs">retrieving the childs</param>
        /// <returns></returns>
        public static ActaComiteList GetList(bool childs)
        {
            CriteriaEx criteria = ActaComite.GetCriteria(ActaComite.OpenSession());

            criteria.Childs = childs;

            //No criteria. Retrieve all de List
            if (nHManager.Instance.UseDirectSQL)
            {
                criteria.Query = ActaComiteList.SELECT();
            }
            ActaComiteList list = DataPortal.Fetch <ActaComiteList>(criteria);

            CloseSession(criteria.SessionCode);
            return(list);
        }
Example #8
0
        internal void Update(ActaComite parent)
        {
            // if we're not dirty then don't update the database
            if (!this.IsDirty)
            {
                return;
            }


            try
            {
                SessionCode = parent.SessionCode;
                PuntoActaRecord obj = Session().Get <PuntoActaRecord>(Oid);
                obj.CopyValues(this.Base.Record);
                Session().Update(obj);
            }
            catch (Exception ex)
            {
                iQExceptionHandler.TreatException(ex);
            }

            MarkOld();
        }
Example #9
0
        internal void Insert(ActaComite parent)
        {
            // if we're not dirty then don't update the database
            if (!this.IsDirty)
            {
                return;
            }

            OidActa = parent.Oid;
            Codigo  = GetNewCode(parent);
            Serial  = GetNewSerial(parent);

            try
            {
                parent.Session().Save(this.Base.Record);
            }
            catch (Exception ex)
            {
                iQExceptionHandler.TreatException(ex);
            }

            MarkOld();
        }
Example #10
0
 public static string SELECT()
 {
     return(ActaComite.SELECT(new QueryConditions(), false));
 }
Example #11
0
 public PuntoActa NewItem(ActaComite parent)
 {
     this.AddItem(PuntoActa.NewChild(parent));
     return(this[Count - 1]);
 }
 public void CopyFrom(ActaComite source)
 {
     _base.CopyValues(source);
 }