Example #1
0
 /**
  *  Get Measure
  *	@return measure or null
  */
 public MMeasure GetMeasure()
 {
     if (GetPA_Measure_ID() != 0)
     {
         return(MMeasure.Get(GetCtx(), GetPA_Measure_ID()));
     }
     return(null);
 }
Example #2
0
        /**
         *  Get MMeasure from Cache
         *	@param ctx context
         *	@param PA_Measure_ID id
         *	@return MMeasure
         */
        public static MMeasure Get(Ctx ctx, int PA_Measure_ID)
        {
            int      key      = PA_Measure_ID;
            MMeasure retValue = (MMeasure)_cache[key];

            if (retValue != null)
            {
                return(retValue);
            }
            retValue = new MMeasure(ctx, PA_Measure_ID, null);
            if (retValue.Get_ID() != 0)
            {
                _cache.Add(key, retValue);
            }
            return(retValue);
        }
Example #3
0
        /**************************************************************************
         *  Update/save Goals for the same measure
         *  @param force force to update goal (default once per day)
         *  @return true if updated
         */
        public Boolean UpdateGoal(Boolean force)
        {
            log.Config("Force=" + force);
            MMeasure measure = MMeasure.Get(GetCtx(), GetPA_Measure_ID());

            if (force ||
                GetDateLastRun() == null ||
                !TimeUtil.IsSameHour(GetDateLastRun(), null))
            {
                if (measure.UpdateGoals())              //	saves
                {
                    Load(Get_ID(), Get_TrxName());
                    return(true);
                }
            }
            return(false);
        }
Example #4
0
        /**
         *  Get Measure Display Text
         *	@return Measure Display Text
         */
        public String GetXAxisText()
        {
            MMeasure measure = GetMeasure();

            if (measure != null &&
                MMeasure.MEASUREDATATYPE_StatusQtyAmount.Equals(measure.GetMeasureDataType()))
            {
                if (MMeasure.MEASURETYPE_Request.Equals(measure.GetMeasureType()))
                {
                    return(Msg.GetElement(GetCtx(), "R_Status_ID"));
                }
                if (MMeasure.MEASURETYPE_Project.Equals(measure.GetMeasureType()))
                {
                    return(Msg.GetElement(GetCtx(), "C_Phase_ID"));
                }
            }
            String value   = GetMeasureDisplay();
            String display = MRefList.GetListName(GetCtx(), MEASUREDISPLAY_AD_Reference_ID, value);

            return(display == null ? value : display);
        }
Example #5
0
 /// <summary>
 /// Get achieved Achievements Of Measure
 /// </summary>
 /// <param name="measure">Measure</param>
 /// <returns>array of Achievements</returns>
 public static MAchievement[] Get(MMeasure measure)
 {
     return(GetOfMeasure(measure.GetCtx(), measure.GetPA_Measure_ID()));
 }
Example #6
0
        /// <summary>
        /// Update Goals with Achievement
        /// </summary>
        private void UpdateAchievementGoals()
        {
            MMeasure measure = MMeasure.Get(GetCtx(), GetPA_Measure_ID());

            measure.UpdateGoals();
        }