/// <summary> /// Sets properties on an instance of 'LookupValue'. /// </summary> public static void SetProperties(int lookupId, string[] propertyNames, object[] propertyValues) { LookupValue entity = BootFX.Common.Data.LookupValue.GetById(lookupId); entity.SetProperties(entity, propertyNames, propertyValues); entity.SaveChanges(); }
/// <summary> /// Creates and instance of 'LookupValue'. /// </summary> public static LookupValue CreateInstance(string name, int value) { LookupValue entity = new LookupValue(); entity.Name = name; entity.Value = value; entity.SaveChanges(); return(entity); }
public static LookupValue CreateAndSave(string name, string description) { if (name == null) { throw new ArgumentNullException("name"); } if (name.Length == 0) { throw new ArgumentOutOfRangeException("'name' is zero-length."); } if (description == null) { throw new ArgumentNullException("description"); } if (description.Length == 0) { throw new ArgumentOutOfRangeException("'description' is zero-length."); } // has it already been used... if (Contains(name, description)) { throw new InvalidOperationException(string.Format("Lookup '{0}' already contains '{1}'.", name, description)); } // get... LookupValue item = new LookupValue(); item.Name = name; item.Description = description; item.Value = GetNextValueForLookup(name); // save... item.SaveChanges(); // return... return(item); }