示例#1
0
        public static void CreateUser(VkUser user, VkUser origin)
        {
            NeoUser db_user = new NeoUser()
            {
                city_id = user.city,
                name    = $"{user.first_name} {user.last_name}",
                photo   = user.photo_50,
                sex     = user.sex,
                vk_id   = user.uid
            };

            if (!IsExist(user))
            {
                Client.Connect();
                Client.Cypher
                .Create("(user:VkMobile {newUser})")
                .WithParam("newUser", db_user)
                .ExecuteWithoutResults();
            }
            if (!IsRelation(user, origin))
            {
                CreateRelation(user, origin);
            }
            if (!IsRelation(origin, user))
            {
                CreateRelation(origin, user);
            }
        }
        public static void Menu(string e, MongoUser m, NeoUser n)
        {
            Console.WriteLine("Do you want to:\n 1-Find new friend \n " +
                              "2-Write a post\n" +
                              "3-Look over s-bodies post\n" +
                              "4-Go out");
            var x = Console.ReadLine();

            switch (x)
            {
            case "1":
                Console.WriteLine("Write name of searched person ");
                string N = Console.ReadLine();
                Console.WriteLine("Write surname now");
                string S = Console.ReadLine();
                if (n.Relationship == true)
                {
                    Console.WriteLine("There is relationship");
                }
                else
                {
                    Console.WriteLine("There is not relationship");
                }
                Console.WriteLine("The lenght is", n.PathBetweenID(e, S));

                m.ToFollow(N, S, e);
                n.Follow(e, S);
                Menu(e, m, n);

                break;

            case "3":
                Console.WriteLine("Write name of searched person ");
                N = Console.ReadLine();
                Console.WriteLine("Write surname now");
                S = Console.ReadLine();
                m.PostReaction(N, S, e);
                Menu(e, m, n);
                break;

            case "2":
                m.CreatePost(e);
                Menu(e, m, n);
                break;

            case "4":
                Console.WriteLine("Bye:(");
                Thread.Sleep(1000);
                System.Environment.Exit(20);
                break;
            }
        }
示例#3
0
            public static void Menu(string e, MongoUser m, NeoUser n, CassandraUser c)
            {
                Console.WriteLine("Do you want to:\n 1 Find new friend \n " +
                                  "2-Write a post\n" +
                                  "3-Look over s-bodies post\n" +
                                  "4-Go out");
                var x = Console.ReadLine();

                switch (x)
                {
                case "1":
                    Console.WriteLine("Write FirstName of searched person ");
                    string FN = Console.ReadLine();
                    Console.WriteLine("Write LastName");
                    string LN = Console.ReadLine();
                    if (n.Relationship == true)
                    {
                        Console.WriteLine("There is relationship");
                    }
                    else
                    {
                        Console.WriteLine("There is not relationship");
                    }
                    Console.WriteLine("The lenght is", n.PathBetweenID(e, LN));
                    m.ToFollow(FN, LN, e);
                    n.Follow(e, LN);
                    Menu(e, m, n, c);

                    break;

                case "2":
                    ISession session;
                    c.NewPost(session);
                    break;

                case "3":
                    Console.WriteLine("Write FirstName of searched person ");
                    N = Console.ReadLine();
                    Console.WriteLine("Write LastName");
                    S = Console.ReadLine();
                    m.PostReaction(N, S, e);
                    Menu(e, m, n);
                    break;

                case "4":
                    Console.WriteLine("Bye:(");
                    Thread.Sleep(1000);
                    System.Environment.Exit(20);
                    break;
                }
            }