Exemple #1
0
        private static VLogger _log = VLogger.GetVLogger(typeof(MCStageElement).FullName);         //.class);

        /// <summary>
        /// get By ElementName
        /// </summary>
        /// <param name="ctx">context</param>
        /// <param name="CM_CStage_ID">id</param>
        /// <param name="elementName">elementname</param>
        /// <param name="trxName">trx</param>
        /// <returns>element by name</returns>
        public static MCStageElement GetByName(Ctx ctx, int CM_CStage_ID, String elementName, Trx trxName)
        {
            String         sql         = "SELECT * FROM CM_CStage_Element WHERE CM_CStage_ID=@param1 AND Name LIKE @param2";
            MCStageElement thisElement = null;

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

            try
            {
                //pstmt = DataBase.prepareStatement (sql, trxName);
                //pstmt.setInt (1, CM_CStage_ID);
                param[0] = new SqlParameter("@param1", CM_CStage_ID);
                //pstmt.setString (2, elementName);
                param[1] = new SqlParameter("@param2", Utility.Util.GetValueOfString(elementName));
                idr      = DataBase.DB.ExecuteReader(sql, param, trxName);
                if (idr.Read())
                {
                    thisElement = new MCStageElement(ctx, idr, trxName);
                }
                idr.Close();
            }
            catch (Exception e)
            {
                if (idr != null)
                {
                    idr.Close();
                }
                _log.Log(Level.SEVERE, "getByName", e);
            }

            return(thisElement);
        }       //	getByName
Exemple #2
0
        /// <summary>
        /// Check single Element, if not existing create it...
        /// </summary>
        /// <param name="elementName">element name</param>
        public void CheckElement(String elementName)
        {
            MCStageElement thisElement = GetElementByName(elementName);

            if (thisElement == null)
            {
                thisElement = new MCStageElement(GetCtx(), 0, Get_TrxName());
                thisElement.SetAD_Client_ID(GetAD_Client_ID());
                thisElement.SetAD_Org_ID(GetAD_Org_ID());
                thisElement.SetCM_CStage_ID(this.Get_ID());
                thisElement.SetContentHTML(" ");
                thisElement.SetName(elementName);
                thisElement.Save(Get_TrxName());
            }
        }
Exemple #3
0
 public MCStageElement GetElementByName(String elementName)
 {
     return(MCStageElement.GetByName(GetCtx(), Get_ID(), elementName, Get_TrxName()));
 }