private void sendingTimer_Tick(object sender, EventArgs e) { AllegroRestAPIClass restAPI = new AllegroRestAPIClass(clientIdTextBox.Text, clientSecretTextBox.Text, login); ManageOrdersClass manageOrders = new ManageOrdersClass(login); manageOrders.ordersToDB(restAPI.getOrders()); manageOrders.sendNewOrdersFromList(); }
private void downloadAuctionsButton_Click(object sender, EventArgs e) { //RestAPI request string clientID = DB.singleDsToString(DB.selectFromDB("SELECT value FROM temporary_data_" + login + " WHERE name = 'client_id'")); string clientSecret = DB.singleDsToString(DB.selectFromDB("SELECT value FROM temporary_data_" + login + " WHERE name = 'client_secret'")); AllegroRestAPIClass restAPI = new AllegroRestAPIClass(clientID, clientSecret, login); offersToListView(restAPI.getOffers()); }
//Authorization private void authorizeButton_Click(object sender, EventArgs e) { AllegroRestAPIClass restAPI = new AllegroRestAPIClass(clientIdTextBox.Text, clientSecretTextBox.Text, login); if (clientIdTextBox.Text == "") { if (clientSecretTextBox.Text == "") { MessageBox.Show("Wypełnij wszystkie pola"); return; } MessageBox.Show("Wypełnij wszystkie pola"); return; } else if (clientSecretTextBox.Text == "") { MessageBox.Show("Wypełnij wszystkie pola"); return; } //Save details if (saveDetailsCheckBox.Checked == true) { DB.executeDB("UPDATE users SET client_id = '" + clientIdTextBox.Text + "', client_secret = '" + clientSecretTextBox.Text + "' WHERE login = '******'"); } else { DB.executeDB("UPDATE users SET client_id = '', client_secret = '' WHERE login = '******'"); } //Add temporary data to DB DB.executeDB("INSERT INTO temporary_data_" + login + " (name, value) VALUES ('client_id', '" + clientIdTextBox.Text + "')"); DB.executeDB("INSERT INTO temporary_data_" + login + " (name, value) VALUES ('client_secret', '" + clientSecretTextBox.Text + "')"); //Execute connection method restAPI.auth(); }