void taxes::OnButton2Click(wxCommandEvent& event) { if (ListBox1->GetSelection() != wxNOT_FOUND) { if (!TextCtrl1->IsEmpty()) { // int selected = ListBox1 -> GetSelection(); double tax_rate; TextCtrl2 -> GetValue().ToDouble(&tax_rate); mysqlpp::Query query = conn_taxes -> query(); query << "UPDATE `taxes` SET `name` = '"<<wx2std(TextCtrl1->GetValue(), wxConvUI)<<"', `value` = '" << tax_rate << "' WHERE `taxes`.`id` = "<< tax_ids[ListBox1 -> GetSelection()] <<" LIMIT 1;"; query.execute(); fill_all(); TextCtrl2->Clear(); TextCtrl1->Clear(); // ListBox1 -> SetSelection(selected); } } }
void taxes::OnButton1Click(wxCommandEvent& event) { // if (ListBox1->GetSelection() != wxNOT_FOUND) if (!TextCtrl1->IsEmpty()) { int exist=0; for (unsigned int i = 0; i<ListBox1->GetCount(); i++) { if (TextCtrl1->GetValue() == ListBox1->GetString(i)) { wxMessageBox(_("This TAX group already exists.")); exist = 1; i=ListBox1->GetCount(); } } if (exist == 0) { double tax_rate; TextCtrl2 -> GetValue().ToDouble(&tax_rate); mysqlpp::Query query = conn_taxes -> query(); query << "INSERT INTO `taxes` (`id`, `name`, `value`) VALUES (NULL, '"<< wx2std(TextCtrl1->GetValue(), wxConvUI) <<"', '"<< tax_rate <<"')"; query.execute(); fill_all(); TextCtrl2->Clear(); TextCtrl1->Clear(); } } }
void taxes::OnButton3Click(wxCommandEvent& event) { if (ListBox1->GetSelection() != wxNOT_FOUND) { mysqlpp::Query query = conn_taxes -> query(); query << "DELETE FROM `taxes` WHERE `taxes`.`id` = " << tax_ids[ListBox1 -> GetSelection()]; query.execute(); fill_all(); } }
int main(int argc, char **argv) { char *filename; FILE *fd; int left = (9*9)*9; int count=0; if (argc == 2) { filename = argv[1]; } else { filename = "fields.sud"; } bf_backups = malloc(sizeof(struct bf_backups)); if (!(fd = fopen(filename, "r"))) { printf("error opening file\n"); exit(1); } if(readfield(fd)) { printf("error reading field\n"); exit(1); } if (initialize()) exit(1); fill_all(); check_filled(); printfield(wfield, 1); bruteforced = 0; /* main loop */ while (left > 0) { check_validity(); solve_run(&count); check_validity(); left = get_left(); count++; } if (final_check()) { winprintf(wtext, "\n\rSolved successfully\n\r"); } else { winprintf(wtext, "\n\rThere are still some errors\n\r"); } printfield(wfield, 1); press_any_key(); endwin(); return(0); }