private static VLogger _log = VLogger.GetVLogger(typeof(MContainer).FullName); //.class);

        /// <summary>
        ///     get Container Element by ID
        /// </summary>
        /// <param name="ctx">context</param>
        /// <param name="CM_ContainerElement_ID">id</param>
        /// <param name="trxName">trx</param>
        /// <returns>container element</returns>
        public static MContainerElement Get(Ctx ctx, int CM_ContainerElement_ID, Trx trxName)
        {
            MContainerElement thisContainerElement = null;
            String            sql = "SELECT * FROM CM_Container_Element WHERE CM_Container_Element_ID=@param";

            SqlParameter[] param = new SqlParameter[1];
            IDataReader    idr   = null;

            try
            {
                //pstmt = DataBase.prepareStatement(sql, trxName);
                //pstmt.setInt(1, CM_ContainerElement_ID);
                param[0] = new SqlParameter("@param", CM_ContainerElement_ID);
                idr      = DataBase.DB.ExecuteReader(sql, param, trxName);
                if (idr.Read())
                {
                    thisContainerElement = (new MContainerElement(ctx, idr, trxName));
                }
                idr.Read();
            }
            catch (Exception e)
            {
                if (idr != null)
                {
                    idr.Close();
                }
                _log.Log(Level.SEVERE, sql, e);
            }

            return(thisContainerElement);
        }
示例#2
0
        } // afterSave

        protected MContainerElement[] GetAllElements()
        {
            int[] elements = MContainerElement.GetAllIDs("CM_Container_Element", "CM_Container_ID=" + Get_ID(), Get_Trx());
            if (elements != null && elements.Length > 0)
            {
                MContainerElement[] containerElements = new MContainerElement[elements.Length];
                for (int i = 0; i < elements.Length; i++)
                {
                    containerElements[i] = new MContainerElement(GetCtx(), elements[i], Get_Trx());
                }
                return(containerElements);
            }
            else
            {
                return(null);
            }
        }