/// <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> /// Gets the <see cref="LookupValue"/> entity where the ID matches the given specification. /// </summary> public static LookupValue GetById(int lookupId, BootFX.Common.Data.SqlOperator lookupIdOperator, BootFX.Common.OnNotFound onNotFound) { BootFX.Common.Data.SqlFilter filter = new BootFX.Common.Data.SqlFilter(typeof(LookupValue)); filter.Constraints.Add("LookupId", lookupIdOperator, lookupId); LookupValue results = ((LookupValue)(filter.ExecuteEntity())); return(results); }
/// <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); }
/// <summary> /// Adds a <see cref="LookupValue"/> instance to the collection. /// </summary> public int Add(LookupValue item) { return(base.Add(item)); }