private void fill_numupdown(GroupBox box, int anzahl, string nameUD, string fieldname, string tableuser, string table) { //GroupBox box = (GroupBox)tabPage_Abwehr.Controls[nameBox]; ClashDatabase db = new ClashDatabase(); for (int i = 1; i <= anzahl; i++) { NumericUpDown cnt = (NumericUpDown)box.Controls[nameUD + i + "_lvl"]; try { cnt.Value = Convert.ToInt32(db.db_select(con_string, "SELECT " + fieldname + i + "_lv from " + tableuser).ElementAt(0)); if (nameUD != "mauer") { kosten_gesamt += Convert.ToInt32(db.db_select(con_string, "SELECT SUM(Kosten) AS 'GES' FROM \"" + table + "\" WHERE Level > " + cnt.Value.ToString()).ElementAt(0)); } } catch (Exception d) { cnt.Value = 0; } } }
//kanone1_lv 7 //bogenturm1_lv 8 //moerser1_lv 3 //luftabwehr1_lv 4 //luftsweeper1_lv 2 //bombenturm1_lv 2 //magierturm1_lv 5 //tesla1_lv 4 //xbogen1_lv 3 //infernoturm1_lv 2 //eagle1_lv 1 //mauern1_lv 12 private void Update_Usertable() { ClashDatabase db = new ClashDatabase(); db.db_insert(con_string, "INSERT INTO user_abwehr_lv(u_id) VALUES(" + label_uid.Text + ")"); //kanone1_lv 7 db.db_update(con_string, "UPDATE user_abwehr_lv SET kanone1_lv =" + kanon1_lvl.Value + ",kanone2_lv=" + kanon2_lvl.Value + ",kanone3_lv=" + kanon3_lvl.Value + ",kanone4_lv=" + kanon4_lvl.Value + ",kanone5_lv=" + kanon5_lvl.Value + ",kanone6_lv=" + kanon6_lvl.Value + ",kanone7_lv=" + kanon7_lvl.Value, "WHERE u_id = " + label_uid.Text); //bogenturm1_lv 8 db.db_update(con_string, "UPDATE user_abwehr_lv SET bogenturm1_lv =" + bogen1_lvl.Value + ",bogenturm2_lv=" + bogen2_lvl.Value + ",bogenturm3_lv=" + bogen3_lvl.Value + ",bogenturm4_lv=" + bogen4_lvl.Value + ",bogenturm5_lv=" + bogen5_lvl.Value + ",bogenturm6_lv=" + bogen6_lvl.Value + ",bogenturm7_lv=" + bogen7_lvl.Value + ",bogenturm8_lv=" + bogen8_lvl.Value, "WHERE u_id = " + label_uid.Text); //moerser1_lv 3 db.db_update(con_string, "UPDATE user_abwehr_lv SET moerser1_lv =" + moerser1_lvl.Value + ",moerser2_lv=" + moerser2_lvl.Value + ",moerser3_lv=" + moerser3_lvl.Value, "WHERE u_id = " + label_uid.Text); //luftabwehr1_lv 4 db.db_update(con_string, "UPDATE user_abwehr_lv SET luftabwehr1_lv =" + luftabwehr1_lvl.Value + ",luftabwehr2_lv=" + luftabwehr2_lvl.Value + ",luftabwehr3_lv=" + luftabwehr3_lvl.Value + ",luftabwehr4_lv=" + luftabwehr4_lvl.Value, "WHERE u_id = " + label_uid.Text); //luftsweeper1_lv 2 db.db_update(con_string, "UPDATE user_abwehr_lv SET luftsweeper1_lv =" + luftsweeper1_lvl.Value + ",luftsweeper2_lv=" + luftsweeper2_lvl.Value, "WHERE u_id = " + label_uid.Text); //bombenturm1_lv 2 db.db_update(con_string, "UPDATE user_abwehr_lv SET bombenturm1_lv =" + bombenturm1_lvl.Value + ",bombenturm2_lv=" + bombenturm2_lvl.Value, "WHERE u_id = " + label_uid.Text); //magierturm1_lv 5 db.db_update(con_string, "UPDATE user_abwehr_lv SET magierturm1_lv =" + magierturm1_lvl.Value + ",magierturm2_lv=" + magierturm2_lvl.Value + ",magierturm3_lv=" + magierturm3_lvl.Value + ",magierturm4_lv=" + magierturm4_lvl.Value + ",magierturm5_lv=" + magierturm5_lvl.Value, "WHERE u_id = " + label_uid.Text); //tesla1_lv 4 db.db_update(con_string, "UPDATE user_abwehr_lv SET tesla1_lv =" + tesla1_lvl.Value + ",tesla2_lv=" + tesla2_lvl.Value + ",tesla3_lv=" + tesla3_lvl.Value + ",tesla4_lv=" + tesla4_lvl.Value, "WHERE u_id = " + label_uid.Text); //xbogen1_lv 3 db.db_update(con_string, "UPDATE user_abwehr_lv SET xbogen1_lv =" + xbogen1_lvl.Value + ",xbogen2_lv=" + xbogen2_lvl.Value + ",xbogen3_lv=" + xbogen3_lvl.Value, "WHERE u_id = " + label_uid.Text); //infernoturm1_lv 2 db.db_update(con_string, "UPDATE user_abwehr_lv SET infernoturm1_lv =" + inferno1_lvl.Value + ",infernoturm2_lv=" + inferno2_lvl.Value, "WHERE u_id = " + label_uid.Text); //eagle1_lv 1 db.db_update(con_string, "UPDATE user_abwehr_lv SET eagle1_lv =" + eagle1_lvl.Value + "WHERE u_id = " + label_uid.Text); //mauern1_lv 1-12 db.db_update(con_string, "UPDATE user_abwehr_lv SET mauern1_lv =" + mauer1_lvl.Value + ",mauern2_lv=" + mauer2_lvl.Value + ",mauern3_lv=" + mauer3_lvl.Value + ",mauern4_lv=" + mauer4_lvl.Value + ",mauern5_lv=" + mauer5_lvl.Value + ",mauern6_lv=" + mauer6_lvl.Value + ",mauern7_lv=" + mauer7_lvl.Value + ",mauern8_lv=" + mauer8_lvl.Value + ",mauern9_lv=" + mauer9_lvl.Value + ",mauern10_lv=" + mauer10_lvl.Value + ",mauern11_lv=" + mauer11_lvl.Value + ",mauern12_lv=" + mauer12_lvl.Value, "WHERE u_id = " + label_uid.Text); //bomben1_lv db.db_update(con_string, "UPDATE user_fallen_lv SET bombe1_lv =" + bombe1_lvl.Value + ",bombe2_lv=" + bombe2_lvl.Value + ",bombe3_lv=" + bombe3_lvl.Value + ",bombe4_lv=" + bombe4_lvl.Value + ",bombe5_lv=" + bombe5_lvl.Value + ",bombe6_lv=" + bombe6_lvl.Value, "WHERE u_id = " + label_uid.Text); //bigbomb1_lv db.db_update(con_string, "UPDATE user_fallen_lv SET bigbomb1_lv =" + bigbomb1_lvl.Value + ",bigbomb2_lv=" + bigbomb2_lvl.Value + ",bigbomb3_lv=" + bigbomb3_lvl.Value + ",bigbomb4_lv=" + bigbomb4_lvl.Value + ",bigbomb5_lv=" + bigbomb5_lvl.Value, "WHERE u_id = " + label_uid.Text); //sprungfeder1_lv db.db_update(con_string, "UPDATE user_fallen_lv SET sprungfeder1_lv =" + sprungfeder1_lvl.Value + ",sprungfeder2_lv=" + sprungfeder2_lvl.Value + ",sprungfeder3_lv=" + sprungfeder3_lvl.Value + ",sprungfeder4_lv=" + sprungfeder4_lvl.Value + ",sprungfeder5_lv=" + sprungfeder5_lvl.Value + ",sprungfeder6_lv=" + sprungfeder6_lvl.Value, "WHERE u_id = " + label_uid.Text); //targetluftbombe1_lv db.db_update(con_string, "UPDATE user_fallen_lv SET targetluftbombe1_lv =" + targetluftbombe1_lvl.Value + ",targetluftbombe2_lv=" + targetluftbombe2_lvl.Value + ",targetluftbombe3_lv=" + targetluftbombe3_lvl.Value + ",targetluftbombe4_lv=" + targetluftbombe4_lvl.Value + ",targetluftbombe5_lv=" + targetluftbombe5_lvl.Value, "WHERE u_id = " + label_uid.Text); //luftbombe1_lv db.db_update(con_string, "UPDATE user_fallen_lv SET luftbombe1_lv =" + luftbombe1_lvl.Value + ",luftbombe2_lv=" + luftbombe2_lvl.Value + ",luftbombe3_lv=" + luftbombe3_lvl.Value + ",luftbombe4_lv=" + luftbombe4_lvl.Value + ",luftbombe5_lv=" + luftbombe5_lvl.Value, "WHERE u_id = " + label_uid.Text); //skelettfalle1_lv db.db_update(con_string, "UPDATE user_fallen_lv SET skelettfalle1_lv =" + skelettfalle1_lvl.Value + ",skelettfalle2_lv=" + skelettfalle2_lvl.Value + ",skelettfalle3_lv=" + skelettfalle3_lvl.Value, "WHERE u_id = " + label_uid.Text); //armeelager1_lv db.db_update(con_string, "UPDATE user_armee_lv SET armeelager1_lv =" + armeelager1_lvl.Value + ",armeelager2_lv=" + armeelager2_lvl.Value + ",armeelager3_lv=" + armeelager3_lvl.Value + ",armeelager4_lv=" + armeelager4_lvl.Value, "WHERE user_id = " + label_uid.Text); //baracke1_lv db.db_update(con_string, "UPDATE user_armee_lv SET baracke1_lv =" + baracke1_lvl.Value + ",baracke2_lv=" + baracke2_lvl.Value + ",baracke3_lv=" + baracke3_lvl.Value + ",baracke4_lv=" + baracke4_lvl.Value, "WHERE user_id = " + label_uid.Text); //dunklebaracke1_lv db.db_update(con_string, "UPDATE user_armee_lv SET dunklebaracke1_lv =" + dunklebaracke1_lvl.Value + ",dunklebaracke2_lv=" + dunklebaracke2_lvl.Value, "WHERE user_id = " + label_uid.Text); //labor1_lv db.db_update(con_string, "UPDATE user_armee_lv SET labor1_lv =" + labor1_lvl.Value + "WHERE user_id = " + label_uid.Text); //zauberfabrik1_lv db.db_update(con_string, "UPDATE user_armee_lv SET zauberspruchfabrik1_lv =" + zauberfabrik1_lvl.Value + "WHERE user_id = " + label_uid.Text); //dunklezauberfabrik1_lv db.db_update(con_string, "UPDATE user_armee_lv SET dunklezauberspruchfabrik1_lv =" + darkzauberfabrik1_lvl.Value + "WHERE user_id = " + label_uid.Text); //bk1_lv db.db_update(con_string, "UPDATE user_helden_lv SET barbarenkoenig1_lv =" + bk1_lvl.Value + "WHERE user_id = " + label_uid.Text); //aq1_lv db.db_update(con_string, "UPDATE user_helden_lv SET bogenkoenigin1_lv =" + aq1_lvl.Value + "WHERE user_id = " + label_uid.Text); //gw1_lv db.db_update(con_string, "UPDATE user_helden_lv SET großerWaechter1_lv =" + gw1_lvl.Value + "WHERE user_id = " + label_uid.Text); //haupthaus1_lv db.db_update(con_string, "UPDATE user_produktion_lv SET haupthaus1_lv =" + haupthaus1_lvl.Value + "WHERE user_id = " + label_uid.Text); //goldmine1_lv db.db_update(con_string, "UPDATE user_produktion_lv SET goldmine1_lv =" + goldmine1_lvl.Value + ",goldmine2_lv=" + goldmine2_lvl.Value + ",goldmine3_lv=" + goldmine3_lvl.Value + ",goldmine4_lv=" + goldmine4_lvl.Value + ",goldmine5_lv=" + goldmine5_lvl.Value + ",goldmine6_lv=" + goldmine6_lvl.Value + ",goldmine7_lv=" + goldmine7_lvl.Value, "WHERE user_id = " + label_uid.Text); //elixiersammler1_lv db.db_update(con_string, "UPDATE user_produktion_lv SET elixiersammler1_lv =" + elixiersammler1_lvl.Value + ",elixiersammler2_lv=" + elixiersammler2_lvl.Value + ",elixiersammler3_lv=" + elixiersammler3_lvl.Value + ",elixiersammler4_lv=" + elixiersammler4_lvl.Value + ",elixiersammler5_lv=" + elixiersammler5_lvl.Value + ",elixiersammler6_lv=" + elixiersammler6_lvl.Value + ",elixiersammler7_lv=" + elixiersammler7_lvl.Value, "WHERE user_id = " + label_uid.Text); //clanfestung1_lv db.db_update(con_string, "UPDATE user_produktion_lv SET clanfestung1_lv =" + Clanfestung1_lvl.Value + "WHERE user_id = " + label_uid.Text); //dunklerElixierBohrer1_lv db.db_update(con_string, "UPDATE user_produktion_lv SET dunklerelixierbohrer1_lv =" + darkElixierBohrer1_lvl.Value + ",dunklerelixierbohrer2_lv=" + darkElixierBohrer2_lvl.Value + ",dunklerelixierbohrer3_lv=" + darkElixierBohrer3_lvl.Value, "WHERE user_id = " + label_uid.Text); //goldlager1_lv db.db_update(con_string, "UPDATE user_produktion_lv SET goldlager1_lv =" + goldlager1_lvl.Value + ",goldlager2_lv=" + goldlager2_lvl.Value + ",goldlager3_lv=" + goldlager3_lvl.Value + ",goldlager4_lv=" + goldlager4_lvl.Value, "WHERE user_id = " + label_uid.Text); //elixierlager1_lv db.db_update(con_string, "UPDATE user_produktion_lv SET elixierlager1_lv =" + Elixierlager1_lvl.Value + ",elixierlager2_lv=" + Elixierlager2_lvl.Value + ",elixierlager3_lv=" + Elixierlager3_lvl.Value + ",elixierlager4_lv=" + Elixierlager4_lvl.Value, "WHERE user_id = " + label_uid.Text); //dunklesElixierlager1_lv db.db_update(con_string, "UPDATE user_produktion_lv SET dunkleselixierlager1_lv =" + darkElixierLager1_lvl.Value + "WHERE user_id = " + label_uid.Text); }