Esempio n. 1
0
        public static bool DeleteBidsByUserId(int id)
        {
            prop1       = new GetProp();
            prop1.Prop1 = id.ToString();
            var JSON = Get(ActionDeleteBid);

            return(Equals(JSON, "done"));
        }
Esempio n. 2
0
        public async Task GetProp_String()
        {
            /*
             * GETPROP (d s -- ?)
             *
             * Gets the value of a given property, and puts it on the stack.
             * This can return a lock, a string, a dbref, or an integer, depending on the type of the property.
             * Permissions are the same as those for GETPROPSTR. This primitive returns 0 if no such property exists,
             * of if it is a valueless propdir.
             */

            var testObj = ThingRepository.Instance.Make <Thing>();

            // Set the property up
            {
                var stack = new Stack <ForthDatum>(new[] {
                    new ForthDatum(testObj.id),
                    new ForthDatum("propName"),
                    new ForthDatum("propValue1"),
                    new ForthDatum(123)
                });
                var parameters = new ForthPrimativeParameters(null, stack.ClonePreservingOrder(), null, Dbref.NOT_FOUND, Dbref.NOT_FOUND, Dbref.NOT_FOUND, null, null, null, null, default);
                var result1    = await AddProp.ExecuteAsync(parameters);

                Assert.NotNull(result1);
                Assert.IsTrue(result1.IsSuccessful);

                Assert.NotNull(testObj.properties);
                Assert.AreEqual(1, testObj.properties.Count);
                Assert.IsTrue(testObj.properties.ContainsKey("propName"));
                var prop = testObj.properties["propName"];
                Assert.NotNull(prop);
                Assert.AreEqual("propName", prop.Name);
                Assert.AreEqual(PropertyType.String, prop.Type);
                Assert.AreEqual("propValue1", prop.Value);
            }

            // Now get
            {
                var stack = new Stack <ForthDatum>(new[] {
                    new ForthDatum(testObj.id),
                    new ForthDatum("propName")
                });

                var local      = stack.ClonePreservingOrder();
                var parameters = new ForthPrimativeParameters(null, local, null, Dbref.NOT_FOUND, Dbref.NOT_FOUND, Dbref.NOT_FOUND, null, null, null, null, default);
                var result     = await GetProp.ExecuteAsync(parameters);

                Assert.NotNull(result);
                Assert.IsTrue(result.IsSuccessful, result.Reason);

                Assert.AreEqual(1, local.Count);
                var pop = local.Pop();
                Assert.AreEqual(DatumType.String, pop.Type);
                Assert.AreEqual("propValue1", pop.Value);
            }
        }
Esempio n. 3
0
        public static bool AddBidsByUserId(int idcat, string title, string text, string adress, string tel, string nameUser)
        {
            prop1       = new GetProp();
            prop1.Prop1 = title;
            prop1.Prop2 = text;
            prop1.Prop3 = idcat.ToString();
            prop1.Prop4 = adress;
            prop1.Prop5 = tel;
            prop1.Prop6 = nameUser;
            var JSON = Get(ActionAddBid);

            return(Equals(JSON, "done"));
        }