示例#1
0
        public static StringCollection GetDataSourceCoordinateFields(object dataSource, string dataMember, string fieldToExclude)
        {
            StringCollection stringCollection     = new StringCollection();
            ArrayList        dataSourceDataFields = DataBindingHelper.GetDataSourceDataFields(dataSource, dataMember, fieldToExclude);

            foreach (DataFieldDescriptor item in dataSourceDataFields)
            {
                if (DataBindingHelper.IsValidAsCoordinateType(item.Type))
                {
                    stringCollection.Add(item.Name);
                }
            }
            return(stringCollection);
        }
示例#2
0
        public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
        {
            ArrayList values = new ArrayList();

            if (context != null && context.Instance != null && context.Instance is DataBindingRuleBase)
            {
                try
                {
                    object obj = null;
                    DataBindingRuleBase dataBindingRuleBase = (DataBindingRuleBase)context.Instance;
                    obj = dataBindingRuleBase.DataSource;
                    if (obj != null)
                    {
                        values = DataBindingHelper.GetDataSourceDataFields(obj, dataBindingRuleBase.DataMember, string.Empty);
                    }
                }
                catch
                {
                }
            }
            return(new StandardValuesCollection(values));
        }
示例#3
0
 public static void InitDesignDataTable(object dataSource, string dataMember, DataTable designDataTable)
 {
     if (dataSource != null)
     {
         designDataTable.Clear();
         designDataTable.Columns.Clear();
         try
         {
             ArrayList dataSourceDataFields = DataBindingHelper.GetDataSourceDataFields(dataSource, dataMember, string.Empty);
             if (dataSourceDataFields.Count != 0)
             {
                 foreach (DataFieldDescriptor item in dataSourceDataFields)
                 {
                     designDataTable.Columns.Add(item.Name, Field.ConvertToSupportedType(item.Type));
                 }
             }
         }
         catch (Exception)
         {
         }
     }
 }