Exemplo n.º 1
0
 public InternetToDataBase(UserToCreate user, IApi VkClient)
 {
     vkClient = VkClient;
     this.token = user.token;
     this.URL = "https://vk.com/id" + user.vk_id;
     this.user = user;
 }
Exemplo n.º 2
0
        public void Update(UserToCreate user)
        {
            dbMaster.OpenConnection();
            try
            {
                MySqlCommand command = dbMaster.GetConnection().CreateCommand();
                command.CommandText = "UPDATE Users SET status = 1 WHERE vk_id = @idUser";
                command.Parameters.AddWithValue("@idUser", user.vk_id);

                command.ExecuteNonQuery();

            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            dbMaster.CloseConnection();
        }
Exemplo n.º 3
0
 public void Insert(UserToCreate user)
 {
     dbMaster.OpenConnection();
     try
     {
         MySqlCommand command = dbMaster.GetConnection().CreateCommand();
         command.CommandText = "INSERT INTO userstokens (id_user, token) "
                  + "VALUES ((SELECT id FROM Users WHERE id_vk = @vkid), @token)";
         command.Parameters.AddWithValue("@vkid", user.vk_id);
         command.Parameters.AddWithValue("@token", user.token);
         command.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
     dbMaster.CloseConnection();
 }