Esempio n. 1
0
        private static void LoadEntityFieldValues(EntityField entityField)
        {
            ClientDataSet.EntityFieldListsValuesDataTable table = GetEntityFieldListValues(entityField.Id, entityField.OrganizationId, true);
            foreach (ClientDataSet.EntityFieldListsValuesRow row in table)
            {
                object obj = Support.ConvertStringToType(row.Value, entityField.DataType);

                if (!(string.IsNullOrEmpty(row.Name) || (obj == null)))
                {
                    entityField.ListValues.Add(row.Name, new object[] { obj, row.Default });
                }
            }
        }
Esempio n. 2
0
        public static Guid InsertEntityFieldListValue(Guid entityFieldId, string name, string value, bool Default, bool active)
        {
            ClientDataSet.EntityFieldListsValuesDataTable table = new ClientDataSet.EntityFieldListsValuesDataTable();
            ClientDataSet.EntityFieldListsValuesRow       row   = table.NewEntityFieldListsValuesRow();

            row.EntityFieldListValueId = Guid.NewGuid();
            row.EntityFieldId          = entityFieldId;
            row.Name    = name;
            row.Value   = value;
            row.Default = Default;
            row.Active  = active;

            table.AddEntityFieldListsValuesRow(row);

            using (EntityFieldListsValuesTableAdapter adapter = new EntityFieldListsValuesTableAdapter(OrganizationProvider.GetConnectionString(UserContext.Current.OrganizationId)))
            {
                adapter.Update(row);
            }

            RemoveFromCache();

            return(row.EntityFieldListValueId);
        }