Пример #1
0
        /**
         * some advance stuff
         */
        public string AdvancedStuff()
        {
            //create a new ProxomoAPI object to handle the CRUD
            ProxomoApi api = Prox.api;
            string result = "";

            result += "Adding first person: Success</br>";
            PersonLogin pl = new PersonLogin();
            try
            {
                pl = api.SecurityPersonCreate("zxc", "zxc", "admin");
            }
            catch { }

            Person p = null;
            if (pl.PersonID == null)
            {
                UserToken ut = api.SecurityPersonAuthenticate("zxc", "zxc");
                p = api.PersonGet(ut.PersonID);
            }
            else
                p = api.PersonGet(pl.PersonID);

            p = api.PersonGet(p.ID);

            Person p2 = CreatePerson2(api);
            UpdatePerson1(p, api);

            //friend sample code
            FriendSample(api, p, p2);

            NotificationSample(api, p);

            //check friendship
            var t1 = api.FriendsGet(p.ID);
            result += "Person " + p.ID + " has " + t1.Count + " friend(s)";
            return result;
        }
Пример #2
0
        /**
         * Create the 2nd person
         */
        private Person CreatePerson2(ProxomoApi api)
        {
            PersonLogin pl = new PersonLogin();
            try
            {
                pl = api.SecurityPersonCreate("abc", "abc", "admin");
            }
            catch { }

            Person p = null;
            if (pl.PersonID == null)
            {
                UserToken ut = api.SecurityPersonAuthenticate("abc", "abc");
                p = api.PersonGet(ut.PersonID);
            }
            else
                p = api.PersonGet(pl.PersonID);
            return p;
        }
Пример #3
0
        public string PersonAdd()
        {
            ProxomoApi api = Prox.api;
            PersonLogin pl = new PersonLogin();
            try
            {
                pl = api.SecurityPersonCreate("qwe", "qwe", "admin");
            }
            catch { }

            Person p = null;
            if (pl.PersonID == null)
            {
                UserToken ut = api.SecurityPersonAuthenticate("qwe", "qwe");
                p = api.PersonGet(ut.PersonID);
            }
            else
                p = api.PersonGet(pl.PersonID);
            return p.UserName;
        }