Exemplo n.º 1
0
 internal static void ValidInt(int c, Net.Vpc.Upa.Impl.Config.Annotationparser.OverriddenValue <int?> oldVal, int nullVal, int processOrder)
 {
     if (c != nullVal)
     {
         oldVal.SetBetterValue(c, processOrder);
     }
 }
Exemplo n.º 2
0
 internal static float?ParseFloat(Net.Vpc.Upa.Impl.Config.Annotationparser.OverriddenValue <string> val, float?def)
 {
     if (val.specified)
     {
         string s = val.@value;
         if (s == null)
         {
             s = "";
         }
         s = s.Trim();
         if ((s).Length != 0)
         {
             if (char.IsLetter(s[0]))
             {
                 if ("max".Equals(s, System.StringComparison.InvariantCultureIgnoreCase) || "maximum".Equals(s) || "max_value".Equals(s))
                 {
                     return(System.Single.MaxValue);
                 }
                 if ("min".Equals(s, System.StringComparison.InvariantCultureIgnoreCase) || "min".Equals(s) || "min_value".Equals(s))
                 {
                     return(System.Single.MinValue);
                 }
             }
             return(System.Convert.ToSingle(s));
         }
     }
     return(def);
 }
Exemplo n.º 3
0
 public static object ParseStringValue(string s, Net.Vpc.Upa.Types.DataType dataType, object defaultValue) /* throws System.Exception */
 {
     if (s == null || (s).Length == 0)
     {
         return(defaultValue);
     }
     System.Type c = dataType.GetPlatformType();
     if (typeof(string).Equals(c))
     {
         return(s);
     }
     else if (typeof(char?).Equals(c))
     {
         return(s[0]);
     }
     else if (Net.Vpc.Upa.Impl.Util.PlatformUtils.IsInt32(c))
     {
         return(System.Convert.ToInt32(s));
     }
     else if (Net.Vpc.Upa.Impl.Util.PlatformUtils.IsInt64(c))
     {
         return(System.Convert.ToInt64(s));
     }
     else if (Net.Vpc.Upa.Impl.Util.PlatformUtils.IsInt16(c))
     {
         return(System.Convert.ToInt16(s));
     }
     else if (Net.Vpc.Upa.Impl.Util.PlatformUtils.IsInt8(c))
     {
         return(System.Convert.ToByte(s));
     }
     else if (Net.Vpc.Upa.Impl.Util.PlatformUtils.IsFloat64(c))
     {
         return(System.Convert.ToDouble(s));
     }
     else if (Net.Vpc.Upa.Impl.Util.PlatformUtils.IsFloat32(c))
     {
         return(System.Convert.ToSingle(s));
     }
     else if (Net.Vpc.Upa.Impl.Util.PlatformUtils.IsBigInt(c))
     {
         return(Net.Vpc.Upa.Impl.FwkConvertUtils.CreateBigInteger(s));
     }
     else if (Net.Vpc.Upa.Impl.Util.PlatformUtils.IsAnyDate(c))
     {
         Net.Vpc.Upa.Impl.Config.Annotationparser.OverriddenValue <string> vv = new Net.Vpc.Upa.Impl.Config.Annotationparser.OverriddenValue <string>();
         vv.SetValue(s);
         return(ParseDate(c, vv, new Net.Vpc.Upa.Impl.Config.Annotationparser.OverriddenValue <string>(), false));
     }
     else if (Net.Vpc.Upa.Impl.Util.PlatformUtils.IsBool(c))
     {
         return(System.Convert.ToBoolean(s));
     }
     return(null);
 }
Exemplo n.º 4
0
 internal static void ValidStr(string c, Net.Vpc.Upa.Impl.Config.Annotationparser.OverriddenValue <string> oldVal, int processOrder)
 {
     if (c != null)
     {
         c = c.Trim();
         if ((c).Length > 0)
         {
             oldVal.SetBetterValue(c, processOrder);
         }
     }
 }
Exemplo n.º 5
0
 internal static void ValidClass(System.Type c, Net.Vpc.Upa.Impl.Config.Annotationparser.OverriddenValue <System.Type> oldVal, System.Type type, int processOrder)
 {
     if (c != null && !c.Equals(typeof(void)))
     {
         if (type.IsAssignableFrom(c))
         {
             oldVal.SetBetterValue(c, processOrder);
         }
         else
         {
             throw new System.ArgumentException("Expected type " + type);
         }
     }
 }
Exemplo n.º 6
0
 internal static System.Numerics.BigInteger?ParseBigInteger(Net.Vpc.Upa.Impl.Config.Annotationparser.OverriddenValue <string> val, System.Numerics.BigInteger? def)
 {
     if (val.specified)
     {
         string s = val.@value;
         if (s == null)
         {
             s = "";
         }
         s = s.Trim();
         if ((s).Length != 0)
         {
             return(Net.Vpc.Upa.Impl.FwkConvertUtils.CreateBigInteger(s));
         }
     }
     return(def);
 }
Exemplo n.º 7
0
 internal static byte?ParseByte(Net.Vpc.Upa.Impl.Config.Annotationparser.OverriddenValue <string> val, byte?def)
 {
     if (val.specified)
     {
         string s = val.@value;
         if (s == null)
         {
             s = "";
         }
         s = s.Trim();
         if ((s).Length != 0)
         {
             return(System.Convert.ToByte(s));
         }
     }
     return(def);
 }
Exemplo n.º 8
0
 internal virtual void SetUnique(Net.Vpc.Upa.Impl.Config.Annotationparser.OverriddenValue <bool?> unique)
 {
     this.unique = unique;
 }
Exemplo n.º 9
0
        internal static Net.Vpc.Upa.Types.Temporal ParseDate(System.Type type1, Net.Vpc.Upa.Impl.Config.Annotationparser.OverriddenValue <string> @value, Net.Vpc.Upa.Impl.Config.Annotationparser.OverriddenValue <string> format, bool end) /* throws System.Exception */
        {
            string svalue = @value.specified ? @value.@value : null;

            if (svalue == null)
            {
                svalue = "";
            }
            svalue = svalue.Trim();
            if ((svalue).Length == 0)
            {
                return(null);
            }
            string sformat = format.specified ? format.@value : null;

            if (sformat == null || (sformat.Trim()).Length == 0)
            {
                sformat = CreateDateFormatString(type1);
            }
            Net.Vpc.Upa.Types.Temporal s = Net.Vpc.Upa.Impl.Util.DateUtils.ParseDateTime(svalue, sformat);
            if (type1.Equals(typeof(Net.Vpc.Upa.Types.Date)))
            {
                return(new Net.Vpc.Upa.Types.Date(s.GetTime()));
            }
            else if (type1.Equals(typeof(Net.Vpc.Upa.Types.Date)))
            {
                return(new Net.Vpc.Upa.Types.Date(s.GetTime()));
            }
            else if (type1.Equals(typeof(Net.Vpc.Upa.Types.Time)))
            {
                return(new Net.Vpc.Upa.Types.Time(s));
            }
            else if (type1.Equals(typeof(Net.Vpc.Upa.Types.Time)))
            {
                return(new Net.Vpc.Upa.Types.Time(s.GetTime()));
            }
            else if (type1.Equals(typeof(Net.Vpc.Upa.Types.DateTime)))
            {
                return(new Net.Vpc.Upa.Types.DateTime(s));
            }
            else if (type1.Equals(typeof(Net.Vpc.Upa.Types.Timestamp)))
            {
                return(new Net.Vpc.Upa.Types.Timestamp(s.GetTime()));
            }
            else if (type1.Equals(typeof(Net.Vpc.Upa.Types.Timestamp)))
            {
                return(new Net.Vpc.Upa.Types.Timestamp(s.GetTime()));
            }
            else if (type1.Equals(typeof(Net.Vpc.Upa.Types.Month)))
            {
                return(new Net.Vpc.Upa.Types.Month(s.GetTime()));
            }
            else if (type1.Equals(typeof(Net.Vpc.Upa.Types.Year)))
            {
                return(new Net.Vpc.Upa.Types.Year(s.GetTime()));
            }
            else
            {
                return(s);
            }
        }
Exemplo n.º 10
0
 internal static Net.Vpc.Upa.Types.Temporal ParseDate(System.Type type1, Net.Vpc.Upa.Impl.Config.Annotationparser.OverriddenValue <string> @value, Net.Vpc.Upa.Impl.Config.Annotationparser.OverriddenValue <string> format) /* throws System.Exception */
 {
     return(ParseDate(type1, @value, format, false));
 }