Example #1
0
        public static Key CreateKey(string id, Domain domain, string name, string attibType, object defaultVal)
        {
            Key key = null;

             if (attibType.ToLower() == XMLConstants._Bool)
             {
            key = new BooleanKey(id, domain, name, (bool)defaultVal);
             }
             else if (attibType.ToLower() == XMLConstants._Int)
             {
             key = new IntegerKey(id, domain, name, (int)defaultVal);
             }
             else if (attibType.ToLower() == XMLConstants._Long)
             {
             key = new LongKey(id, domain, name, (long)defaultVal);
             }
             else if (attibType.ToLower() == XMLConstants._Float)
             {
             key = new FloatKey(id, domain, name, (float)defaultVal);
             }
             else if (attibType.ToLower() == XMLConstants._Double)
             {
             key = new DoubleKey(id, domain, name, (double)defaultVal);
             }
             else if (attibType.ToLower() == XMLConstants._String)
             {
             key = new StringKey(id, domain, name, (string)defaultVal);
             }

             return key;
        }
Example #2
0
        public static Key CreateKey(string attibType)
        {
            Key key = null;

             if (attibType.ToLower() == XMLConstants._Bool)
             {
            key = new BooleanKey();
             }
             else if (attibType.ToLower() == XMLConstants._Int)
             {
            key = new IntegerKey();
             }
             else if (attibType.ToLower() == XMLConstants._Long)
             {
            key = new LongKey();
             }
             else if (attibType.ToLower() == XMLConstants._Float)
             {
            key = new FloatKey();
             }
             else if (attibType.ToLower() == XMLConstants._Double)
             {
            key = new DoubleKey();
             }
             else if (attibType.ToLower() == XMLConstants._String)
             {
            key = new StringKey();
             }

             return key;
        }
Example #3
0
        public static Key CreateKey(string id, Domain domain, string name, Type type, object defaultVal)
        {
            Key key = null;

              if (type == typeof(bool))
              {
              key = new BooleanKey(id, domain, name, (bool)defaultVal);
              }
              else if (type == typeof(int))
              {
              key = new IntegerKey(id, domain, name, (int)defaultVal);
              }
              else if (type == typeof(long))
              {
              key = new LongKey(id, domain, name, (long)defaultVal);
              }
              else if (type == typeof(float))
              {
              key = new FloatKey(id, domain, name, (float)defaultVal);
              }
              else if (type == typeof(double))
              {
              key = new DoubleKey(id, domain, name, (double)defaultVal);
              }
              else if (type == typeof(string))
              {
              key = new StringKey(id, domain, name, (string)defaultVal);
              }

              return key;
        }