Esempio n. 1
0
 public static ClientDataSet.EntityFieldDataTable GetEntityField(Guid entityFieldId, Guid organizationId)
 {
     using (EntityFieldTableAdapter adapter = new EntityFieldTableAdapter(OrganizationProvider.GetConnectionString(organizationId)))
     {
         return(adapter.GetEntityField(entityFieldId));
     }
 }
Esempio n. 2
0
        public static void DeleteEntityField(Guid entityFieldId, Guid organizationId)
        {
            using (EntityFieldTableAdapter adapter = new EntityFieldTableAdapter(OrganizationProvider.GetConnectionString(organizationId)))
            {
                adapter.Delete(entityFieldId);
            }

            RemoveFromCache();
        }
Esempio n. 3
0
        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();
        }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
        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);
        }