internal void Update(Puerto parent)
        {
            // if we're not dirty then don't update the database
            if (!this.IsDirty)
            {
                return;
            }

            OidPuerto = parent.Oid;

            try
            {
                ValidationRules.CheckRules();

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

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

            MarkOld();
        }
        internal void DeleteSelf(Puerto 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 <PuertoDespachanteRecord>(Oid));
            }
            catch (Exception ex)
            {
                iQExceptionHandler.TreatException(ex);
            }

            MarkNew();
        }
예제 #3
0
 internal static string SELECT(Puerto source)
 {
     return(SELECT(new QueryConditions()
     {
         Puerto = source.GetInfo(false)
     }));
 }
        internal void Insert(Puerto parent)
        {
            // if we're not dirty then don't update the database
            if (!this.IsDirty)
            {
                return;
            }

            OidPuerto = parent.Oid;

            try
            {
                ValidationRules.CheckRules();

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

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

            MarkOld();
        }
예제 #5
0
        internal void Update(Puerto parent)
        {
            this.RaiseListChangedEvents = false;

            // update (thus deleting) any deleted child objects
            foreach (PuertoDespachante 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 (PuertoDespachante obj in this)
            {
                if (obj.IsNew)
                {
                    obj.Insert(parent);
                }
                else
                {
                    obj.Update(parent);
                }
            }

            this.RaiseListChangedEvents = true;
        }
예제 #6
0
        /// <summary>
        /// Builds a PuertoList from IList<!--<Puerto>--> and retrieve PuertoInfo Childs from DB
        /// </summary>
        /// <param name="list"></param>
        /// <returns>PuertoList</returns>
        public static PuertoList GetChildList(IList <Puerto> list)
        {
            PuertoList flist = new PuertoList();

            if (list != null)
            {
                int        sessionCode = Puerto.OpenSession();
                CriteriaEx criteria    = null;

                flist.IsReadOnly = false;

                foreach (Puerto item in list)
                {
                    criteria = PuertoDespachante.GetCriteria(sessionCode);
                    criteria.AddEq("OidPuerto", item.Oid);
                    criteria.AddOrder("Codigo", true);
                    item.PuertoDespachantes = PuertoDespachantes.GetChildList(criteria.List <PuertoDespachante>());


                    flist.AddItem(item.GetInfo());
                }

                flist.IsReadOnly = true;

                Puerto.CloseSession(sessionCode);
            }

            return(flist);
        }
예제 #7
0
        internal static string SELECT(QueryConditions conditions)
        {
            OrderList orders = new OrderList();

            orders.NewOrder("Valor", ListSortDirection.Ascending, typeof(Puerto));
            conditions.Orders = orders;
            return(Puerto.SELECT(conditions, false));
        }
예제 #8
0
        internal void CopyValues(Puerto source)
        {
            if (source == null)
            {
                return;
            }

            _record.CopyValues(source.Base.Record);
        }
예제 #9
0
 public bool ExistOtherItem(Puerto Puerto)
 {
     foreach (PuertoInfo obj in this)
     {
         if ((obj.Oid != Puerto.Oid) && (obj.Valor.Equals(Puerto.Valor)))
         {
             return(true);
         }
     }
     return(false);
 }
예제 #10
0
        public static PuertoList GetPuertoList(long oidDespachante)
        {
            CriteriaEx criteria = Puerto.GetCriteria(Despachante.OpenSession());

            criteria.Childs = false;

            criteria.Query = PuertoDespachanteList.SELECT_BY_DESPACHANTE(oidDespachante);

            PuertoList list = DataPortal.Fetch <PuertoList>(criteria);

            CloseSession(criteria.SessionCode);
            return(list);
        }
예제 #11
0
        /// <summary>
        /// Devuelve una lista de despachantes asociados a un puerto
        /// </summary>
        /// <param name="oid">Oid del puerto</param>
        /// <returns>DespachanteList</returns>
        public static DespachanteList GetDespachanteList(long oidPuerto)
        {
            CriteriaEx criteria = Puerto.GetCriteria(Puerto.OpenSession());

            criteria.Childs = false;

            criteria.Query = PuertoDespachanteList.SELECT_BY_PUERTO(oidPuerto);

            DespachanteList list = DataPortal.Fetch <DespachanteList>(criteria);

            CloseSession(criteria.SessionCode);
            return(list);
        }
        public static PuertoDespachante NewChild(Puerto parent)
        {
            if (!CanAddObject())
            {
                throw new System.Security.SecurityException(moleQule.Resources.Messages.USER_NOT_ALLOWED);
            }

            PuertoDespachante obj = new PuertoDespachante();

            obj.OidPuerto = parent.Oid;

            return(obj);
        }
예제 #13
0
        /// <summary>
        /// Retrieve the complete list from db
        /// </summary>
        /// <param name="get_childs">retrieving the childs</param>
        /// <returns>PuertoList</returns>
        public static PuertoList GetChildList(bool childs)
        {
            CriteriaEx criteria = Puerto.GetCriteria(Puerto.OpenSession());

            criteria.Childs = childs;

            if (nHManager.Instance.UseDirectSQL)
            {
                criteria.Query = SELECT();
            }

            PuertoList list = DataPortal.Fetch <PuertoList>(criteria);

            CloseSession(criteria.SessionCode);
            return(list);
        }
예제 #14
0
 public void CopyFrom(Puerto source)
 {
     _base.CopyValues(source);
 }
예제 #15
0
 public PuertoDespachante NewItem(Puerto parent)
 {
     this.NewItem(PuertoDespachante.NewChild(parent));
     return(this[Count - 1]);
 }