Пример #1
0
 protected void Read_if_not_empty(SelectedDictionary selectedDictionary, string name)
 {
     if (CrmEntity.Contains(name))
     {
         OptionSetValue value = (OptionSetValue)CrmEntity[name];
         selectedDictionary.Select(value.Value);
         return;
     }
     else
     {
         _tracingService.Trace($"Read_if_not_empty didn't find :{name}");
     }
 }
Пример #2
0
        protected void Fill_if_not_empty(string name, object value, List <string> parameters)
        {
            if (parameters != null && parameters.Contains(name) == false)
            {
                return;
            }

            if (value == null)
            {
                return;
            }

            if (value.GetType() == typeof(int?))
            {
                CrmEntity[name] = ((int?)value).Value;
                return;
            }

            if (value.GetType() == typeof(float?))
            {
                CrmEntity[name] = ((float?)value).Value;
                return;
            }

            if (value.GetType() == typeof(double?))
            {
                CrmEntity[name] = ((double?)value).Value;
                return;
            }

            if (value.GetType() == typeof(SelectedDictionary))
            {
                SelectedDictionary dictionary = (SelectedDictionary)value;
                if (dictionary.SelectedKey.HasValue == false)
                {
                    return;
                }

                CrmEntity[name] = new OptionSetValue(dictionary.SelectedKey.Value);
                return;
            }

            CrmEntity[name] = value;
        }