Beispiel #1
0
 public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, System.Type destinationType)
 {
     if (destinationType == typeof(System.String) &&
         value is ObjDataPresentation)
     {
         ObjDataPresentation op = (ObjDataPresentation)value;
         return("类型:" + GetObjDataType(op.ObjDataType) +
                ",查询: " + op.IsSchemaForOther +
                ",更新: " + op.UpdateTableName +
                ",存储: " + op.StoreProcedureQuery);
     }
     return(base.ConvertTo(context, culture, value, destinationType));
 }
Beispiel #2
0
        public AzClassCreatProperty()
        {
            ObjPresentation = new ObjDataPresentation();
            //CtrSpecialitySet = new SpecialitySet();
            if (string.Compare(System.Diagnostics.Process.GetCurrentProcess().ProcessName, "devenv") == 0)
            {
                return;
            }
            var valuedef = typeof(AzClassCreatProperty).GetProperties()
                           .Where(p => p.IsDefaultValueField());

            foreach (var inf in valuedef)
            {
                var atr = inf.GetCustomAttribute(typeof(DefaultValueAttribute));
                if (atr != null)
                {
                    inf.SetValue(this, ((DefaultValueAttribute)atr).Value);
                }
            }
        }
Beispiel #3
0
        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            if (value is string)
            {
                try
                {
                    string s     = (string)value;
                    int    colon = s.IndexOf(':');
                    int    comma = s.IndexOf(',');
                    if (colon != -1 && comma != -1)
                    {
                        ObjDataTypeEnum objdatetype = GetObjDataTypeStr(s.Substring(colon + 1, (comma - colon - 1)));
                        colon = s.IndexOf(':', comma + 1);
                        comma = s.IndexOf(',', comma + 1);
                        bool isview = Boolean.Parse(s.Substring(colon + 1, (comma - colon - 1)));
                        colon = s.IndexOf(':', comma + 2);
                        comma = s.IndexOf(',', comma + 2);
                        string updatetablefrom = s.Substring(colon + 1, (comma - colon - 1));
                        colon = s.IndexOf(':', comma + 3);
                        string storeProcedureQuery = s.Substring(colon + 1);

                        ObjDataPresentation op = new ObjDataPresentation();
                        op.ObjDataType         = objdatetype;
                        op.IsSchemaForOther    = isview;
                        op.UpdateTableName     = updatetablefrom;
                        op.StoreProcedureQuery = storeProcedureQuery;
                        return(op);
                    }
                }
                catch
                {
                    throw new ArgumentException(
                              "无法将“" + (string)value +
                              "”转换为 SpellingOptions 类型");
                }
            }
            return(base.ConvertFrom(context, culture, value));
        }
Beispiel #4
0
 public AzClassCreatProperty(ObjDataPresentation objDataPresentation, SpecialitySet specialitySet)
 {
     ObjPresentation = objDataPresentation;
     //CtrSpecialitySet = specialitySet;
 }