public CustomValueProxy SaveCustomValue(int customFieldID, int refID, object value) { CustomValue customValue = CustomValues.GetValue(TSAuthentication.GetLoginUser(), customFieldID, refID); if (value == null) { customValue.Value = ""; customValue.Collection.Save(); return(null); } switch (customValue.FieldType) { case CustomFieldType.DateTime: customValue.Value = ((DateTime)value).ToString(); break; case CustomFieldType.Date: customValue.Value = ((DateTime)value).ToShortDateString(); break; default: customValue.Value = DataUtils.CleanValueScript(value.ToString()); break; } customValue.Collection.Save(); return(customValue.GetProxy()); }