示例#1
0
        internal static bool DeleteCustomProperty(CustomPropertyManager customPropertyManager, string CustomProperty)
        {
            //get custom property value
            var Val = customPropertyManager.Get(CustomProperty);

            //check if custom Property exists
            if (!string.IsNullOrEmpty(CustomProperty))
            {
                int ret = customPropertyManager.Delete(CustomProperty);
                if (ret == 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            return(false);
        }
示例#2
0
        internal static bool ReplaceCustomPropertyValue(CustomPropertyManager customPropertyManager, string CustomProperty, string Replaceable, string Replacing)
        {
            string val = customPropertyManager.Get(CustomProperty);

            if (val == null)
            {
                if (val.ToLower().Contains(Replaceable.ToLower()))
                {
                    string NewVal = val.Replace(Replaceable, Replacing);
                    int    ret    = customPropertyManager.Set(CustomProperty, NewVal);

                    if (ret == 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            return(false);
        }
示例#3
0
        internal static bool replaceCustomPropertyValue(CustomPropertyManager customPropertyManager, string CustomProperty, string Repleacable, string Replacing)
        {
            string val = customPropertyManager.Get(CustomProperty);

            // check if the custom property exists
            if (!string.IsNullOrEmpty(val))
            {
                // check if the replecable string exists in the custom property value
                if (val.ToLower().Contains(Repleacable.ToLower()))
                {
                    string NewVal = val.Replace(Repleacable, Replacing);
                    int    ret    = customPropertyManager.Set(CustomProperty, NewVal);
                    if (ret == 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            return(false);
        }