Esempio n. 1
0
        public TypedValue PurchasedHours(PropertyEnvironment env)
        {
            TypedValue      typedValue      = new TypedValueClass();
            float           num             = 0;
            MFSearchBuilder mfSearchBuilder = new MFSearchBuilder(env.Vault);

            mfSearchBuilder.Deleted(false);
            mfSearchBuilder.Class(invoiceClass.ID);
            if (env.ObjVerEx.Class == projectClass.ID)
            {
                mfSearchBuilder.Conditions.AddPropertyCondition(projectProp, MFConditionType.MFConditionTypeEqual, MFDataType.MFDatatypeLookup, env.ObjVerEx.ID);
            }
            if (env.ObjVerEx.Class == phaseClass.ID)
            {
                mfSearchBuilder.Conditions.AddPropertyCondition(phaseProp, MFConditionType.MFConditionTypeEqual, MFDataType.MFDatatypeLookup, env.ObjVerEx.ID);
            }
            var searchResults = mfSearchBuilder.FindEx();

            foreach (var searchResult in searchResults)
            {
                num += float.Parse(searchResult.GetProperty(hoursProp).TypedValue.GetValueAsUnlocalizedText());
            }
            typedValue.SetValue(MFDataType.MFDatatypeFloating, num);
            return(typedValue);
        }
Esempio n. 2
0
        public TypedValue RemainingHours(PropertyEnvironment env)
        {
            TypedValue typedValue = new TypedValueClass();
            float      num        = float.Parse(env.ObjVerEx.GetProperty(purchasedHoursProp).TypedValue.GetValueAsUnlocalizedText()) - float.Parse(env.ObjVerEx.GetProperty(usedHoursProp).TypedValue.GetValueAsUnlocalizedText());

            typedValue.SetValue(MFDataType.MFDatatypeFloating, num);
            return(typedValue);
        }