public static ClientDataSet.EntityFieldDataTable GetEntityField(Guid entityFieldId, Guid organizationId) { using (EntityFieldTableAdapter adapter = new EntityFieldTableAdapter(OrganizationProvider.GetConnectionString(organizationId))) { return(adapter.GetEntityField(entityFieldId)); } }
public static void DeleteEntityField(Guid entityFieldId, Guid organizationId) { using (EntityFieldTableAdapter adapter = new EntityFieldTableAdapter(OrganizationProvider.GetConnectionString(organizationId))) { adapter.Delete(entityFieldId); } RemoveFromCache(); }
public static void UpdateEntityField(Guid entityFieldId, int entityFieldTypeId, string name, string description, int dataTypeId, string defaultValue , bool allowDBNull, bool unique, int maxLength, string minValue, string maxValue, int decimalDigits, int orderNumber , Guid entityId, Guid organizationId, Guid?instanceId, bool active) { using (EntityFieldTableAdapter adapter = new EntityFieldTableAdapter(OrganizationProvider.GetConnectionString(organizationId))) { adapter.Update(entityFieldId, entityFieldTypeId, name, description, dataTypeId, (((EntityFieldType)entityFieldTypeId == EntityFieldType.Value) ? defaultValue : null) , allowDBNull, unique, maxLength, minValue, maxValue, decimalDigits, orderNumber, entityId, organizationId, instanceId, active); } RemoveFromCache(); }
public static Guid InsertEntityField(int entityFieldTypeId, string name, string description, int dataTypeId, string defaultValue , bool allowDBNull, bool unique, int maxLength, string minValue, string maxValue, int decimalDigits, int orderNumber , Guid entityId, Guid organizationId, Guid?instanceId, bool active) { ClientDataSet.EntityFieldDataTable table = new ClientDataSet.EntityFieldDataTable(); ClientDataSet.EntityFieldRow row = table.NewEntityFieldRow(); row.EntityFieldId = Guid.NewGuid(); row.EntityFieldTypeId = entityFieldTypeId; row.Name = name; row.Description = description; row.DataTypeId = dataTypeId; if ((EntityFieldType)entityFieldTypeId == EntityFieldType.Value) { row.DefaultValue = defaultValue; } row.AllowDBNull = allowDBNull; row.Unique = unique; row.MaxLength = maxLength; if (minValue != null) { row.MinValue = minValue; } if (maxValue != null) { row.MaxValue = maxValue; } row.DecimalDigits = decimalDigits; row.OrderNumber = orderNumber; row.EntityId = entityId; row.OrganizationId = organizationId; if (instanceId.HasValue) { row.InstanceId = instanceId.Value; } row.Active = active; table.AddEntityFieldRow(row); using (EntityFieldTableAdapter adapter = new EntityFieldTableAdapter(OrganizationProvider.GetConnectionString(organizationId))) { adapter.Update(row); } RemoveFromCache(); return(row.EntityFieldId); }
public static ClientDataSet.EntityFieldDataTable GetEntityFields(Guid entityId, Guid organizationId, Guid?instanceId, bool?active) { ClientDataSet.EntityFieldDataTable table = null; using (EntityFieldTableAdapter adapter = new EntityFieldTableAdapter(OrganizationProvider.GetConnectionString(organizationId))) { table = adapter.GetEntityFields(entityId, organizationId, instanceId, active); } if (!FrameworkConfiguration.Current.WebApplication.EnableMultipleInstances) { foreach (ClientDataSet.EntityFieldRow row in table.Select(string.Format(CultureInfo.InvariantCulture, "{0} IS NOT NULL", table.InstanceIdColumn.ColumnName))) { table.RemoveEntityFieldRow(table.FindByEntityFieldId(row.EntityFieldId)); } table.AcceptChanges(); } return(table); }