Exemple #1
0
 public virtual void TestBigDecimal11()
 {
     System.Decimal bd1 = new System.Decimal(-0.00000);
     byte[]         b2  = byteArrayConverter.BigDecimalToByteArray(bd1, true);
     System.Decimal bd2 = byteArrayConverter.ByteArrayToBigDecimal(b2, true);
     AssertEquals(bd1, bd2);
 }
Exemple #2
0
 public virtual void TestBigDecimal2()
 {
     System.Decimal bd1 = new System.Decimal(10.123456789123456789);
     byte[]         b2  = byteArrayConverter.BigDecimalToByteArray(bd1, true);
     System.Decimal bd2 = byteArrayConverter.ByteArrayToBigDecimal(b2, true);
     AssertEquals(bd1, bd2);
 }
Exemple #3
0
        public virtual void Test9()
        {
            DeleteBase("valuesA2");
            NeoDatis.Odb.ODB odb = Open("valuesA2");
            int  size            = isLocal ? 100000 : 1000;
            long sum             = 0;

            for (int i = 0; i < size; i++)
            {
                NeoDatis.Odb.Test.VO.Attribute.TestClass tc1 = new NeoDatis.Odb.Test.VO.Attribute.TestClass
                                                                   ();
                tc1.SetInt1(i);
                odb.Store(tc1);
                sum += i;
            }
            odb.Close();
            odb = Open("valuesA2");
            NeoDatis.Odb.Values values = odb.GetValues(new NeoDatis.Odb.Impl.Core.Query.Values.ValuesCriteriaQuery
                                                           (typeof(NeoDatis.Odb.Test.VO.Attribute.TestClass)).Min("int1", "min of int1").Avg
                                                           ("int1", "avg of int1").Sum("int1", "sum of int1"));
            NeoDatis.Odb.ObjectValues ov   = values.NextValues();
            System.Decimal            min  = (System.Decimal)ov.GetByAlias("min of int1");
            System.Decimal            avg  = (System.Decimal)ov.GetByAlias("avg of int1");
            System.Decimal            bsum = (System.Decimal)ov.GetByAlias("sum of int1");
            Println(min);
            Println(avg);
            Println(bsum);
            odb.Close();
            AssertEquals(new System.Decimal(sum), bsum);
            AssertEquals(new System.Decimal(0), min);
            AssertEquals(bsum / 2, avg);
        }
Exemple #4
0
 /// <summary>
 /// carga un elemento nuevo a la lista
 /// </summary>
 /// <param name="aElemento">Elemento a cargar en la lista</param>
 /// <returns></returns>
 public System.String CargarLista(System.String aNombre,
                                  System.Decimal mPrecio)
 {
     System.String mRes = "";
     try
     {
         if (CantElem == Nombre.Length)
         {
             Nombre = RedimensionarStr(Nombre);
             Precio = RedimensionarDec(Precio);
         }
         if (BuscaPorNombre(aNombre) == -1)
         {
             Nombre[CantElem] = aNombre;
             Precio[CantElem] = mPrecio;
             CantElem++;
             mRes = Listado();
         }
         else
         {
             mRes = "El elemento " + aNombre + " ya existe";
         }
     }
     catch (System.Exception err)
     {
         throw err;
     }
     return(mRes);
 }
Exemple #5
0
 public override void Execute(NeoDatis.Odb.OID oid, NeoDatis.Odb.Core.Layers.Layer2.Meta.AttributeValuesMap
                              values)
 {
     System.Decimal n = (System.Decimal)values[attributeName];
     sum = NeoDatis.Tool.Wrappers.NeoDatisNumber.Add(sum, NeoDatis.Odb.Impl.Core.Query.Values.ValuesUtil
                                                     .Convert(n));
 }
Exemple #6
0
        public virtual void Test10()
        {
            DeleteBase("valuesA2");
            NeoDatis.Odb.ODB        odb = Open("valuesA2");
            NeoDatis.Tool.StopWatch t   = new NeoDatis.Tool.StopWatch();
            t.Start();
            int  size = 1000;
            long sum  = 0;

            for (int i = 0; i < size; i++)
            {
                NeoDatis.Odb.Test.VO.Attribute.TestClass tc1 = new NeoDatis.Odb.Test.VO.Attribute.TestClass
                                                                   ();
                tc1.SetInt1(i);
                odb.Store(tc1);
                sum += i;
            }
            odb.Close();
            t.End();
            Println(" time for insert = " + t.GetDurationInMiliseconds());
            odb = Open("valuesA2");
            t.Start();
            NeoDatis.Odb.Core.Query.Values.ICustomQueryFieldAction custom = new NeoDatis.Odb.Test.Query.Values.TestCustomQueryFieldAction
                                                                                ();
            NeoDatis.Odb.Values values = odb.GetValues(new NeoDatis.Odb.Impl.Core.Query.Values.ValuesCriteriaQuery
                                                           (typeof(NeoDatis.Odb.Test.VO.Attribute.TestClass)).Custom("int1", "custom of int1"
                                                                                                                     , custom));
            t.End();
            NeoDatis.Odb.ObjectValues ov = values.NextValues();
            System.Decimal            c  = (System.Decimal)ov.GetByAlias("custom of int1");
            Println(c);
            Println(" time for count = " + t.GetDurationInMiliseconds());
            odb.Close();
        }
Exemple #7
0
 /// <exception cref="System.Exception"></exception>
 public virtual void Test1()
 {
     if (!isLocal)
     {
         return;
     }
     DeleteBase(OdbFileName1);
     DeleteBase(OdbFileName2);
     NeoDatis.Odb.ODB odb = Open(OdbFileName1);
     NeoDatis.Odb.Test.VO.Login.User user = new NeoDatis.Odb.Test.VO.Login.User("olivier"
                                                                                , "*****@*****.**", null);
     odb.Store(user);
     odb.Close();
     odb = Open(OdbFileName1);
     odb.DefragmentTo(Directory + OdbFileName2);
     NeoDatis.Odb.ODB newOdb = Open(OdbFileName2);
     // int n = odb.getObjects(User.class).size();
     // println("n="+n);
     System.Decimal nbUser = odb.Count(new NeoDatis.Odb.Impl.Core.Query.Criteria.CriteriaQuery
                                           (typeof(NeoDatis.Odb.Test.VO.Login.User)));
     System.Decimal nbNewUser = newOdb.Count(new NeoDatis.Odb.Impl.Core.Query.Criteria.CriteriaQuery
                                                 (typeof(NeoDatis.Odb.Test.VO.Login.User)));
     AssertEquals(nbUser, nbNewUser);
     AssertEquals(odb.Count(new NeoDatis.Odb.Impl.Core.Query.Criteria.CriteriaQuery(typeof(
                                                                                        NeoDatis.Odb.Test.VO.Login.Profile))), newOdb.Count(new NeoDatis.Odb.Impl.Core.Query.Criteria.CriteriaQuery
                                                                                                                                                (typeof(NeoDatis.Odb.Test.VO.Login.Profile))));
     odb.Close();
     newOdb.Close();
     DeleteBase(OdbFileName1);
     DeleteBase(OdbFileName2);
 }
        public static bool _WriteLine_System_IO_StringWriter_System_Decimal( )
        {
            //Parameters
            System.Decimal _value = null;


            //Exception
            Exception exception_Real        = null;
            Exception exception_Intercepted = null;

            InterceptionMaintenance.disableInterception( );

            try
            {
                returnValue_Real = System.IO.StringWriter.WriteLine(_value);
            }

            catch (Exception e)
            {
                exception_Real = e;
            }


            InterceptionMaintenance.enableInterception( );

            try
            {
                returnValue_Intercepted = System.IO.StringWriter.WriteLine(_value);
            }

            catch (Exception e)
            {
                exception_Intercepted = e;
            }
        }
		public override void Execute(NeoDatis.Odb.OID oid, NeoDatis.Odb.Core.Layers.Layer2.Meta.AttributeValuesMap
			 values)
		{
			System.Decimal n = (System.Decimal)values[attributeName];
			sum = NeoDatis.Tool.Wrappers.NeoDatisNumber.Add(sum, NeoDatis.Odb.Impl.Core.Query.Values.ValuesUtil
				.Convert(n));
		}
        /** Convert
         */
        public static void Convert(string a_in_jsonstring, out System.Decimal a_out_value)
        {
            try{
                if (a_in_jsonstring.Length < 1)
                {
                    //不明。
                    Tool.Assert(false);
                    a_out_value = default;
                    return;
                }

                string t_value;
                if ((a_in_jsonstring[a_in_jsonstring.Length - 1] == 'M') || (a_in_jsonstring[a_in_jsonstring.Length - 1] == 'm'))
                {
                    t_value = a_in_jsonstring.Substring(0, a_in_jsonstring.Length - 1);
                }
                else
                {
                    t_value = a_in_jsonstring;
                }

                System.Globalization.NumberStyles t_style = System.Globalization.NumberStyles.AllowLeadingSign | System.Globalization.NumberStyles.AllowDecimalPoint;
                if (System.Decimal.TryParse(t_value, t_style, Config.CULTURE, out a_out_value) == true)
                {
                    return;
                }
            }catch (System.Exception t_exception) {
                Tool.DebugReThrow(t_exception);
            }

            //不明。
            Tool.Assert(false);
            a_out_value = default;
            return;
        }
Exemple #11
0
 /// <summary>
 /// SOBRECARGA: carga un elemento nuevo a la lista
 /// </summary>
 /// <param name="aNombre">Elemento a cargar en la lista</param>
 /// <param name="aPrecio">Precio del elemento en string</param>
 public System.String CargarLista(System.String aNombre,
                                  System.String aPrecio)
 {
     System.String  mRes    = "";
     System.Decimal mPrecio = System.Convert.ToDecimal(aPrecio);
     mRes = this.CargarLista(aNombre, mPrecio);
     return(mRes);
 }
Exemple #12
0
 public void BinaryConstructorTest2()
 {
     System.Decimal left = new System.Decimal(); // TODO: Initialize to an appropriate value
     BinaryOperators op = new BinaryOperators(); // TODO: Initialize to an appropriate value
     System.Decimal right = new System.Decimal(); // TODO: Initialize to an appropriate value
     jgshort.SqlDom.Expressions.Binary target = new jgshort.SqlDom.Expressions.Binary(left, op, right);
     Assert.Inconclusive("TODO: Implement code to verify target");
 }
Exemple #13
0
 public override void Execute(NeoDatis.Odb.OID oid, NeoDatis.Odb.Core.Layers.Layer2.Meta.AttributeValuesMap
                              values)
 {
     System.Decimal n = NeoDatis.Odb.Impl.Core.Query.Values.ValuesUtil.Convert((System.Decimal
                                                                                )values[attributeName]);
     myValue = myValue.Add(new System.Decimal(n.ToString()).Multiply(new System.Decimal
                                                                         (2)));
 }
 //default constructor
 public OrderItem()
 {
     IsBackOrder = false ;
     title = String.Empty;
     note = String.Empty;
     quantity = 0 ;
     price = default(decimal) ;
 }
		public override void Execute(NeoDatis.Odb.OID oid, NeoDatis.Odb.Core.Layers.Layer2.Meta.AttributeValuesMap
			 values)
		{
			System.Decimal n = NeoDatis.Odb.Impl.Core.Query.Values.ValuesUtil.Convert((System.Decimal
				)values[attributeName]);
			myValue = myValue.Add(new System.Decimal(n.ToString()).Multiply(new System.Decimal
				(2)));
		}
Exemple #16
0
 /// <summary>
 /// Initializes a new instance of the Container class.
 /// </summary>
 /// <param name="id">The container ID.</param>
 /// <param name="length">The container length.</param>
 /// <param name="width">The container width.</param>
 /// <param name="height">The container height.</param>
 public Container(System.Int32 id, System.Decimal length, System.Decimal width, System.Decimal height)
 {
     ID     = id;
     Length = length;
     Width  = width;
     Height = height;
     Volume = length * width * height;
 }
        IEnumerator FetchIPRisk(Player conn, string testAddress, string email)
        {
            this.plugin.Debug("Checking player Nick: \"" + conn.Name + "\" IP: " + testAddress + "\" SteamID: " + conn.SteamId);

            string webRequest = "http://" + this.plugin.GetConfigString("kick_risky_ips_subdomain") + ".getipintel.net/check.php?ip=" + testAddress + email + "&flags=f&oflags=c";

            this.plugin.Debug("Contacting website with request: " + webRequest);
            UnityWebRequest www = UnityWebRequest.Get(webRequest);

            yield return(www.SendWebRequest());

            if (string.IsNullOrEmpty(www.error) && float.TryParse(www.downloadHandler.text.Split(',')[0], out float likelyBad))
            {
                string country = www.downloadHandler.text.Split(',')[1];
                this.smIPCountry.Add(testAddress, country);

                System.Decimal percentSure = System.Math.Round((System.Decimal)(likelyBad * 100f), 1, System.MidpointRounding.ToEven);
                this.smIPTrust.Add(testAddress, percentSure);


                this.plugin.Debug("Player IP checked Suspicion: " + percentSure + "% Nick: \"" + conn.Name + "\" IP: " + testAddress + "\" Country: " + country + " SteamID: " + conn.SteamId);

                this.RiskyIPAction(conn, percentSure, country, testAddress);
            }
            else
            {
                this.plugin.Debug("Error on player IP: " + testAddress);
                this.plugin.Debug("Error: " + www.error);
                this.plugin.Debug("Response: " + www.downloadHandler.text);

                switch (www.downloadHandler.text)
                {
                case "-1":
                    this.plugin.Debug("Invalid query, no input (http://getipintel.net/)");
                    break;

                case "-2":
                    this.plugin.Debug("Invalid IP address (http://getipintel.net/)");
                    break;

                case "-3":
                    this.plugin.Debug("Unroutable address / private address (http://getipintel.net/)");
                    break;

                case "-4":
                    this.plugin.Debug("Unable to reach database, most likely the database is being updated. Keep an eye on twitter for more information. (http://getipintel.net/)");
                    break;

                case "-5":
                    this.plugin.Debug("Your connecting IP has been banned from the system or you do not have permission to access a particular service. Did you exceed your query limits? Did you use an invalid email address? (http://getipintel.net/)");
                    break;

                case "-6":
                    this.plugin.Debug("You did not provide any contact information with your query or the contact information is invalid. (http://getipintel.net/)");
                    break;
                }
            }
        }
Exemple #18
0
		/// <summary>
		/// Test in place update for array when the number of elements remains the
		/// same
		/// </summary>
		/// <exception cref="System.Exception">System.Exception</exception>
		public virtual void TestArray5()
		{
			NeoDatis.Odb.ODB odb = null;
			int size = 50;
			try
			{
				NeoDatis.Odb.Impl.Core.Layers.Layer3.Engine.AbstractObjectWriter.ResetNbUpdates();
				DeleteBase("array1.neodatis");
				odb = Open("array1.neodatis");
				System.Decimal[] array = new System.Decimal[size];
				for (int i = 0; i < size; i++)
				{
					array[i] = new System.Decimal(((double)i) * 78954545 / 89);
				}
				ObjectWithNativeArrayOfBigDecimal owna = new 
					ObjectWithNativeArrayOfBigDecimal("t1", array
					);
				odb.Store(owna);
				odb.Close();
				odb = Open("array1.neodatis");
				NeoDatis.Odb.Objects<ObjectWithNativeArrayOfBigDecimal> l = odb.GetObjects<ObjectWithNativeArrayOfBigDecimal>();
				ObjectWithNativeArrayOfBigDecimal owna2 = l.GetFirst();
				owna2.SetNumber(0, new System.Decimal(1));
				odb.Store(owna2);
				odb.Close();
				odb = Open("array1.neodatis");
				l = odb.GetObjects<ObjectWithNativeArrayOfBigDecimal>();
				ObjectWithNativeArrayOfBigDecimal o = l.GetFirst();
				AssertEquals(owna2.GetNumber(0), o.GetNumber(0));
				AssertEquals(owna2.GetNumber(1), o.GetNumber(1));
				if (isLocal)
				{
					// check that it was in place update and not normal update (by
					// creatig now object)
					AssertEquals(0, NeoDatis.Odb.Impl.Core.Layers.Layer3.Engine.AbstractObjectWriter.
						GetNbInPlaceUpdates());
					AssertEquals(1, NeoDatis.Odb.Impl.Core.Layers.Layer3.Engine.AbstractObjectWriter.
						GetNbNormalUpdates());
				}
			}
			catch (System.Exception e)
			{
				if (odb != null)
				{
					odb.Rollback();
					odb = null;
				}
				throw;
			}
			finally
			{
				if (odb != null)
				{
					odb.Close();
				}
				DeleteBase("array1.neodatis");
			}
		}
 public void RiskyIPAction(Player conn, System.Decimal percentSure, string country, string testAddress)
 {
     if (this.plugin.GetConfigBool("use_risky_country"))
     {
         bool risky_country;
         if (this.plugin.GetConfigBool("use_white_list_contry"))
         {
             risky_country = true;
             string[] whiteList = this.plugin.GetConfigList("risky_country_whitelist");
             if (whiteList.Length == 0)
             {
                 plugin.Info("RiskyCountryCheck ignored because nothing is set in the whitelist");
                 risky_country = false;
             }
             foreach (string whitelistcountry in whiteList)
             {
                 if (country == whitelistcountry)
                 {
                     risky_country = false;
                 }
             }
         }
         else
         {
             risky_country = false;
             string[] blackList = this.plugin.GetConfigList("risky_country_blacklist");
             if (blackList.Length == 0)
             {
                 plugin.Info("RiskyCountryCheck ignored because nothing is set in the blacklist");
             }
             foreach (string blacklistcountry in blackList)
             {
                 if (country == blacklistcountry)
                 {
                     risky_country = true;
                 }
             }
         }
         if (risky_country)
         {
             this.plugin.Info("Banning player for having a risky Country (" + percentSure + "%) Nick: \"" + conn.Name + "\" IP: " + testAddress + "\" Country: " + country + " SteamID: " + conn.SteamId);
             conn.Ban(26297460);
         }
     }
     if (this.plugin.GetConfigBool("only_use_risky_country") == false)
     {
         if (percentSure >= (System.Decimal) this.plugin.GetConfigInt("ban_risky_ips_at_percent"))
         {
             this.plugin.Info("Banning player for having a known bad IP (" + percentSure + "%) Nick: \"" + conn.Name + "\" IP: " + testAddress + "\" Country: " + country + " SteamID: " + conn.SteamId);
             conn.Ban(26297460);
         }
         else if (percentSure >= (System.Decimal) this.plugin.GetConfigInt("kick_risky_ips_at_percent"))
         {
             this.plugin.Info("Kicking player for having a suspicious IP (" + percentSure + "%) Nick: \"" + conn.Name + "\" IP: " + testAddress + "\" Country: " + country + " SteamID: " + conn.SteamId);
         }
     }
 }
Exemple #20
0
 public AverageValueAction(string attributeName, string alias) : base(attributeName
                                                                      , alias, false)
 {
     this.totalValue    = new System.Decimal(0);
     this.nbValues      = new System.Decimal(0);
     this.attributeName = attributeName;
     this.scale         = NeoDatis.Odb.OdbConfiguration.GetScaleForAverageDivision();
     this.roundType     = NeoDatis.Odb.OdbConfiguration.GetRoundTypeForAverageDivision();
 }
Exemple #21
0
 public void DecimalTest()
 {
     System.Decimal d = new System.Decimal(); // TODO: Initialize to an appropriate value
     ConstantTypes.Decimal expected = null; // TODO: Initialize to an appropriate value
     ConstantTypes.Decimal actual;
     actual = Sql.Decimal(d);
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
 /// <summary>
 /// Initializes a new instance of the Item class.
 /// </summary>
 /// <param name="id">The item ID.</param>
 /// <param name="dim1">The length of one of the three item dimensions.</param>
 /// <param name="dim2">The length of another of the three item dimensions.</param>
 /// <param name="dim3">The length of the other of the three item dimensions.</param>
 /// <param name="itemQuantity">The item quantity.</param>
 public Item(System.Int32 id, System.Decimal dim1, System.Decimal dim2, System.Decimal dim3, System.Int32 quantity)
 {
     ID       = id;
     Dim1     = dim1;
     Dim2     = dim2;
     Dim3     = dim3;
     volume   = dim1 * dim2 * dim3;
     Quantity = quantity;
 }
		public AverageValueAction(string attributeName, string alias) : base(attributeName
			, alias, false)
		{
			this.totalValue = new System.Decimal(0);
			this.nbValues = new System.Decimal(0);
			this.attributeName = attributeName;
			this.scale = NeoDatis.Odb.OdbConfiguration.GetScaleForAverageDivision();
			this.roundType = NeoDatis.Odb.OdbConfiguration.GetRoundTypeForAverageDivision();
		}
Exemple #24
0
        internal AggregateArgument(System.Decimal arg)
            : base(arg)
        {
            Build = (buildContext, buildArgs) =>
            {
                return(BuildClr(arg, buildContext));
            };

            SetArgType(arg);
        }
 public virtual long Count(NeoDatis.Odb.Impl.Core.Query.Criteria.CriteriaQuery
                           query)
 {
     NeoDatis.Odb.Core.Query.IValuesQuery q = new NeoDatis.Odb.Impl.Core.Query.Values.ValuesCriteriaQuery
                                                  (query).Count("count");
     q.SetPolymorphic(query.IsPolymorphic());
     NeoDatis.Odb.Values values = storageEngine.GetValues(q, -1, -1);
     System.Decimal      count  = (System.Decimal)values.NextValues().GetByIndex(0);
     return(System.Decimal.ToInt64(count));
 }
 public DecimalConstantAttribute(
     byte scale,
     byte sign,
     int hi,
     int mid,
     int low
 )
 {
     dec = new System.Decimal(low, mid, hi, (sign != 0), scale);
 }
 //| <include path='docs/doc[@for="DecimalConstantAttribute.DecimalConstantAttribute"]/*' />
 public DecimalConstantAttribute(
     byte scale,
     byte sign,
     uint hi,
     uint mid,
     uint low
     )
 {
     dec = new System.Decimal((int)low, (int)mid, (int)hi, (sign != 0), scale);
 }
 public DecimalConstantAttribute(
     byte scale,
     byte sign,
     int hi,
     int mid,
     int low
     )
 {
     dec = new System.Decimal(low, mid, hi, (sign != 0), scale);
 }
 public DecimalConstantAttribute(
     byte scale,
     byte sign,
     uint hi,
     uint mid,
     uint low
 )
 {
     dec = new System.Decimal((int) low, (int)mid, (int)hi, (sign != 0), scale);
 }
Exemple #30
0
		/// <summary>Decreasing array size</summary>
		/// <exception cref="System.Exception">System.Exception</exception>
		public virtual void TestArrayUpdateDecreasingArraySize()
		{
			NeoDatis.Odb.ODB odb = null;
			int size = 50;
			try
			{
				DeleteBase("array1.neodatis");
				odb = Open("array1.neodatis");
				System.Decimal[] array = new System.Decimal[size];
				System.Decimal[] array2 = new System.Decimal[size + 1];
				for (int i = 0; i < size; i++)
				{
					array[i] = new System.Decimal(((double)i) * 78954545 / 89);
					array2[i] = new System.Decimal(((double)i) * 78954545 / 89);
				}
				array[size - 1] = new System.Decimal(99);
				array2[size] = new System.Decimal(100);
				ObjectWithNativeArrayOfBigDecimal owna = new 
					ObjectWithNativeArrayOfBigDecimal("t1", array2
					);
				odb.Store(owna);
				odb.Close();
				odb = Open("array1.neodatis");
				NeoDatis.Odb.Objects<ObjectWithNativeArrayOfBigDecimal> l = odb.GetObjects<ObjectWithNativeArrayOfBigDecimal>();
				ObjectWithNativeArrayOfBigDecimal owna2 = l.GetFirst();
				owna2.SetNumbers(array);
				odb.Store(owna2);
				odb.Close();
				odb = Open("array1.neodatis");
				l = odb.GetObjects<ObjectWithNativeArrayOfBigDecimal>();
				ObjectWithNativeArrayOfBigDecimal o = (ObjectWithNativeArrayOfBigDecimal
					)l.GetFirst();
				AssertEquals(size, o.GetNumbers().Length);
				AssertEquals(new System.Decimal(99), o.GetNumber(size - 1));
				AssertEquals(owna2.GetNumber(1), o.GetNumber(1));
				odb = null;
			}
			catch (System.Exception e)
			{
				if (odb != null)
				{
					odb.Rollback();
					odb = null;
				}
				throw;
			}
			finally
			{
				if (odb != null)
				{
					odb.Close();
				}
				DeleteBase("array1.neodatis");
			}
		}
Exemple #31
0
        internal static string Parameterize(this System.Decimal value, BuildContext buildContext, Parameterization p = Parameterization.Value)
        {
            if (!ParameterizationCriteria(buildContext, p))
            {
                return(null);
            }

            var argument = new ParameterArgument(value);

            return(Parameterize(argument, buildContext, p));
        }
        /** Convert
         */
        public static void Convert(System.Decimal a_in_value, System.Text.StringBuilder a_out_stringbuilder, ConvertToJsonStringOption a_option)
        {
            string t_string = a_in_value.ToString(Config.CULTURE);

            a_out_stringbuilder.Append(t_string);

            if ((a_option & ConvertToJsonStringOption.NoDecimalNumberSuffix) == 0)
            {
                a_out_stringbuilder.Append("m");
            }
        }
		public override void Execute(NeoDatis.Odb.OID oid, NeoDatis.Odb.Core.Layers.Layer2.Meta.AttributeValuesMap
			 values)
		{
			System.Decimal n = (System.Decimal)values[attributeName];
			System.Decimal bd = NeoDatis.Odb.Impl.Core.Query.Values.ValuesUtil.Convert(n);
			if (minValue.CompareTo(bd) > 0)
			{
				oidOfMinValues = oid;
				minValue = bd;
			}
		}
 public override void Execute(NeoDatis.Odb.OID oid, NeoDatis.Odb.Core.Layers.Layer2.Meta.AttributeValuesMap
                              values)
 {
     System.Decimal n  = (System.Decimal)values[attributeName];
     System.Decimal bd = NeoDatis.Odb.Impl.Core.Query.Values.ValuesUtil.Convert(n);
     if (minValue.CompareTo(bd) > 0)
     {
         oidOfMinValues = oid;
         minValue       = bd;
     }
 }
Exemple #35
0
        /// <summary>
        /// Agrega un elemento null a la lista al final
        /// </summary>
        /// <param name="aLista">Lista de descimal a redimensionar</param>
        /// <returns></returns>
        private System.Decimal[] RedimensionarDec(System.Decimal[] aLista)
        {
            System.Decimal[] Res = new System.Decimal[aLista.Length + 1];
            System.Int32     j   = 0;
            foreach (System.Decimal mElemento in aLista)
            {
                Res[j] = mElemento;
                j++;
            }

            return(Res);
        }
Exemple #36
0
        public virtual System.Decimal ReadBigInteger(string label)
        {
            long position = io.GetCurrentPosition();

            System.Decimal d = byteArrayConverter.ByteArrayToBigInteger(ReadBigIntegerBytes(true
                                                                                            ), true);
            if (NeoDatis.Odb.OdbConfiguration.IsDebugEnabled(LogId) && canLog)
            {
                NeoDatis.Tool.DLogger.Debug("Reading bigInteger '" + d + "' at " + position + (label
                                                                                               != null ? " : " + label : string.Empty));
            }
            return(d);
        }
 /// <exception cref="System.Exception"></exception>
 public virtual void T1est()
 {
     NeoDatis.Odb.ODB odb = Open("perfOValuesVsCriteria");
     NeoDatis.Odb.OdbConfiguration.MonitorMemory(true);
     NeoDatis.Odb.Core.Query.IQuery q = new NeoDatis.Odb.Impl.Core.Query.Criteria.CriteriaQuery
                                            (typeof(NeoDatis.Odb.Test.VO.Login.User2));
     System.Decimal b = odb.Count(new NeoDatis.Odb.Impl.Core.Query.Criteria.CriteriaQuery
                                      (typeof(NeoDatis.Odb.Test.VO.Login.User2)));
     Println(b);
     System.Console.Out.WriteLine(q.GetExecutionPlan().GetDetails());
     AssertEquals(new System.Decimal("500000"), b);
     odb.Close();
 }
        public static System.Decimal GetDecimal(IRandom rand,
												System.Decimal min = System.Decimal.MinValue,
												System.Decimal max = System.Decimal.MaxValue)
        {
            System.Decimal result = new System.Decimal(rand.Next(), rand.Next(), rand.Next(), GetBoolean(rand), GetByte(rand, 0, 29));

            if(result < min)
                return min;
            else if (result >= max)
                return max - 1m;
            else
                return result;
        }
Exemple #39
0
		/// <exception cref="System.Exception"></exception>
		public virtual void TestAtomicNativeCollectionBigDecimal()
		{
			System.Decimal bd = new System.Decimal("123456789.987654321");
			NeoDatis.Odb.Core.Layers.Layer2.Meta.AtomicNativeObjectInfo anoi = null;
			anoi = new NeoDatis.Odb.Core.Layers.Layer2.Meta.AtomicNativeObjectInfo(bd, NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType
				.BigDecimalId);
			string s = NeoDatis.Odb.Impl.Core.Layers.Layer2.Meta.Serialization.Serializer.GetInstance
				().ToString(anoi);
			// println(s);
			NeoDatis.Odb.Core.Layers.Layer2.Meta.AtomicNativeObjectInfo anoi2 = (NeoDatis.Odb.Core.Layers.Layer2.Meta.AtomicNativeObjectInfo
				)NeoDatis.Odb.Impl.Core.Layers.Layer2.Meta.Serialization.Serializer.GetInstance(
				).FromOneString(s);
			AssertEquals(anoi, anoi2);
		}
Exemple #40
0
        public virtual void TestAtomicNativeCollectionBigDecimal()
        {
            System.Decimal bd = new System.Decimal("123456789.987654321");
            NeoDatis.Odb.Core.Layers.Layer2.Meta.AtomicNativeObjectInfo anoi = null;
            anoi = new NeoDatis.Odb.Core.Layers.Layer2.Meta.AtomicNativeObjectInfo(bd, NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType
                                                                                   .BigDecimalId);
            string s = NeoDatis.Odb.Impl.Core.Layers.Layer2.Meta.Serialization.Serializer.GetInstance
                           ().ToString(anoi);

            // println(s);
            NeoDatis.Odb.Core.Layers.Layer2.Meta.AtomicNativeObjectInfo anoi2 = (NeoDatis.Odb.Core.Layers.Layer2.Meta.AtomicNativeObjectInfo
                                                                                 )NeoDatis.Odb.Impl.Core.Layers.Layer2.Meta.Serialization.Serializer.GetInstance(
                ).FromOneString(s);
            AssertEquals(anoi, anoi2);
        }
        private void Run(string filename)
        {
            LoadRecording(filename);
            target = new KKDemo.Math();

            aInput  = (System.Int32)GetInputParameterValue("a");
            aOutput = (System.Int32)GetOutputParameterValue("a");

            expected = (System.Decimal)GetReturnValue();
            actual   = target.ConvertMilesToKm(aInput);

            ConfigureComparison(filename);
            CompareObjects(aInput, aOutput);
            CompareObjects(expected, actual);
        }
Exemple #42
0
		public virtual void SetBigDecimal1(System.Decimal bigDecimal1)
		{
			this.bigDecimal1 = bigDecimal1;
		}
		public TestCustomQueryFieldAction()
		{
			this.myValue = new System.Decimal(0);
		}
 //DeepCopy
 public void DeepCopy(OrderItem from)
 {
     IsBackOrder = from.IsBackOrder ;
     title = from.title ;
     note = from.note ;
     quantity = from.quantity ;
     price = from.price ;
 }
Exemple #45
0
        public virtual void TestBigDecimal2()
		{
			System.Decimal bd1 = new System.Decimal(10.123456789123456789);
			byte[] b2 = byteArrayConverter.BigDecimalToByteArray(bd1, true);
			System.Decimal bd2 = byteArrayConverter.ByteArrayToBigDecimal(b2, true);
			AssertEquals(bd1, bd2);
		}
		public CountAction(string alias) : base(alias, alias, false)
		{
			count = NeoDatis.Tool.Wrappers.NeoDatisNumber.NewBigInteger(0);
		}
		public override void Execute(NeoDatis.Odb.OID oid, NeoDatis.Odb.Core.Layers.Layer2.Meta.AttributeValuesMap
			 values)
		{
			count = NeoDatis.Tool.Wrappers.NeoDatisNumber.Add(count, One);
		}
Exemple #48
0
		public Product(string name, System.Decimal price) : base()
		{
			this.name = name;
			this.price = price;
		}
Exemple #49
0
 public void DecimalConstructorTest()
 {
     System.Decimal value = new System.Decimal(); // TODO: Initialize to an appropriate value
     ConstantTypes.Decimal target = new ConstantTypes.Decimal(value);
     Assert.Inconclusive("TODO: Implement code to verify target");
 }
Exemple #50
0
        public virtual void TestBigDecimal11()
		{
			System.Decimal bd1 = new System.Decimal(-0.00000);
			byte[] b2 = byteArrayConverter.BigDecimalToByteArray(bd1, true);
			System.Decimal bd2 = byteArrayConverter.ByteArrayToBigDecimal(b2, true);
			AssertEquals(bd1, bd2);
		}
		public override void End()
		{
			average = NeoDatis.Tool.Wrappers.NeoDatisNumber.Divide(totalValue, nbValues, roundType
				, scale);
		}
Exemple #52
0
		/// <exception cref="System.Exception"></exception>
		public virtual void TestArray4()
		{
			NeoDatis.Odb.ODB odb = null;
			int size = 50;
			try
			{
				odb = Open("array1.neodatis");
				System.Decimal[] array = new System.Decimal[size];
				for (int i = 0; i < size; i++)
				{
					array[i] = new System.Decimal(((double)i) * 78954545 / 89);
				}
				ObjectWithNativeArrayOfBigDecimal owna = new 
					ObjectWithNativeArrayOfBigDecimal("t1", array
					);
				odb.Store(owna);
				odb.Close();
				odb = Open("array1.neodatis");
				NeoDatis.Odb.Objects<ObjectWithNativeArrayOfBigDecimal> l = odb.GetObjects<ObjectWithNativeArrayOfBigDecimal>();
				ObjectWithNativeArrayOfBigDecimal owna2 = l.GetFirst();
				AssertEquals(owna.GetName(), owna2.GetName());
				for (int i = 0; i < size; i++)
				{
					AssertEquals(owna.GetNumbers()[i], owna2.GetNumbers()[i]);
				}
				odb.Close();
				odb = null;
			}
			catch (System.Exception e)
			{
				if (odb != null)
				{
					odb.Rollback();
					odb = null;
				}
				throw;
			}
			finally
			{
				if (odb != null)
				{
					odb.Close();
				}
				DeleteBase("array1.neodatis");
			}
		}
		public SumAction(string attributeName, string alias) : base(attributeName, alias, 
			false)
		{
			sum = new System.Decimal(0);
		}
		public MinValueAction(string attributeName, string alias) : base(attributeName, alias
			, false)
		{
			this.minValue = new System.Decimal(long.MaxValue);
			this.oidOfMinValues = null;
		}
Exemple #55
0
		public virtual void SetPrice(System.Decimal price)
		{
			this.price = price;
		}
Exemple #56
0
 public void UnaryConstructorTest5()
 {
     UnaryOperators op = new UnaryOperators(); // TODO: Initialize to an appropriate value
     Decimal expression = new Decimal(); // TODO: Initialize to an appropriate value
     Unary target = new Unary(op, expression);
     Assert.Inconclusive("TODO: Implement code to verify target");
 }
		/// <exception cref="System.Exception"></exception>
		public virtual void TestBigInteger()
		{
			System.Decimal bd = new System.Decimal("-128451");
			NeoDatis.Odb.Core.Layers.Layer3.Engine.IFileSystemInterface fsi = new NeoDatis.Odb.Impl.Core.Layers.Layer3.Engine.LocalFileSystemInterface
				("data", new NeoDatis.Odb.Core.Mock.MockSession("test"), NeoDatis.Odb.Test.ODBTest
				.Directory + "testBigDecimal.neodatis", true, true, NeoDatis.Odb.OdbConfiguration
				.GetDefaultBufferSizeForData());
			fsi.SetWritePosition(0, false);
			fsi.WriteBigInteger(bd, false);
			fsi.Close();
			fsi = new NeoDatis.Odb.Impl.Core.Layers.Layer3.Engine.LocalFileSystemInterface("data"
				, new NeoDatis.Odb.Core.Mock.MockSession("test"), NeoDatis.Odb.Test.ODBTest.Directory
				 + "testBigDecimal.neodatis", false, false, NeoDatis.Odb.OdbConfiguration.GetDefaultBufferSizeForData
				());
			fsi.SetReadPosition(0);
			System.Decimal bd2 = fsi.ReadBigInteger();
			AssertEquals(bd, bd2);
			fsi.Close();
			DeleteBase("testBigDecimal.neodatis");
		}