public void Update(char VALUE = '0') { //Load all the info from the vairables saved if (VALUE == 'D') { Console.WriteLine("\nPARTY MAKER FORM: Updating Search Text"); Console.WriteLine("\nPARTY MAKER FORM: Value of viewBy: " + viewBy); txtbxSearch.Text = "Search by Username"; txtbxSearch.ForeColor = Color.LightGray; if (viewBy == 'V') { Console.WriteLine("\nPARTY MAKER FORM: Entered as Viewer"); txtPartyName.Enabled = false; btnSave.Visible = false; btnAdd2Pt.Visible = false; btnRemovePt.Visible = false; lblAddUser.Enabled = false; txtbxSearch.Enabled = false; btnDeleteParty.Enabled = false; btnSelectChar.Visible = false; btnLoadParty.Visible = true; } else { if (ConnectVariables.GetRoleViewAs() == "Dungeon Master") { Console.WriteLine("\nPARTY MAKER FORM: Entered as DM"); txtPartyName.Enabled = true; btnSave.Visible = true; btnAdd2Pt.Visible = true; btnRemovePt.Visible = true; lblAddUser.Enabled = true; txtbxSearch.Enabled = true; btnDeleteParty.Enabled = true; btnSelectChar.Visible = false; btnLoadParty.Visible = false; } else if (ConnectVariables.GetRoleViewAs() == "Player") { Console.WriteLine("\nPARTY MAKER FORM: Entered as Player"); txtPartyName.Enabled = false; btnSave.Visible = true; btnAdd2Pt.Visible = false; btnRemovePt.Visible = false; lblAddUser.Enabled = false; txtbxSearch.Enabled = false; btnDeleteParty.Enabled = false; btnSelectChar.Visible = true; btnLoadParty.Visible = true; } } } else if (VALUE == 'V') { viewBy = 'V'; } else if (VALUE == 'N') { viewBy = 'N'; } else if (VALUE == 'L') { dbListCharList.Rows.Clear(); dbListPartyList.Rows.Clear(); txtPartyName.Text = ""; } else if (VALUE == 'P') { ConnectDataBases.UpdatePartyAmount(); } else if (VALUE == 'R') { LoadForm(); } else if (VALUE == 'S') { string role = ConnectVariables.GetRoleViewAs(); string playerID1 = "", playerID2 = "", playerID3 = "", playerID4 = "", playerID5 = "", playerID6 = "", charID1 = "", charID2 = "", charID3 = "", charID4 = "", charID5 = "", charID6 = "", userID = ConnectVariables.GetLoggedInUsernameAs(), partyID = ConnectVariables.GetPartyIDDP(), partyName = txtPartyName.Text; ConnectVariables.SetPartyNameDP(partyName); userID = ConnectDataBases.GetUserId(userID); int pInt = dbListPartyList.Rows.Count, cInt = dbListCharList.Rows.Count; Console.WriteLine("\nPARTY MAKER FORM: pInt Value: " + pInt); Console.WriteLine("\nPARTY MAKER FORM: cInt Value: " + cInt); if (role == "Dungeon Master") { if (txtPartyName.Text == "") { MessageBox.Show("Please fill out all input before saving."); } else { if (pInt > 0) { switch (pInt) { case 1: { playerID1 = ConnectDataBases.GetUserId(dbListPartyList.Rows[0].Cells[0].Value.ToString()); playerID2 = ""; playerID3 = ""; playerID4 = ""; playerID5 = ""; playerID6 = ""; break; } case 2: { playerID1 = ConnectDataBases.GetUserId(dbListPartyList.Rows[0].Cells[0].Value.ToString()); playerID2 = ConnectDataBases.GetUserId(dbListPartyList.Rows[1].Cells[0].Value.ToString()); playerID3 = ""; playerID4 = ""; playerID5 = ""; playerID6 = ""; break; } case 3: { playerID1 = ConnectDataBases.GetUserId(dbListPartyList.Rows[0].Cells[0].Value.ToString()); playerID2 = ConnectDataBases.GetUserId(dbListPartyList.Rows[1].Cells[0].Value.ToString()); playerID3 = ConnectDataBases.GetUserId(dbListPartyList.Rows[2].Cells[0].Value.ToString()); playerID4 = ""; playerID5 = ""; playerID6 = ""; break; } case 4: { playerID1 = ConnectDataBases.GetUserId(dbListPartyList.Rows[0].Cells[0].Value.ToString()); playerID2 = ConnectDataBases.GetUserId(dbListPartyList.Rows[1].Cells[0].Value.ToString()); playerID3 = ConnectDataBases.GetUserId(dbListPartyList.Rows[2].Cells[0].Value.ToString()); playerID4 = ConnectDataBases.GetUserId(dbListPartyList.Rows[3].Cells[0].Value.ToString()); playerID5 = ""; playerID6 = ""; break; } case 5: { playerID1 = ConnectDataBases.GetUserId(dbListPartyList.Rows[0].Cells[0].Value.ToString()); playerID2 = ConnectDataBases.GetUserId(dbListPartyList.Rows[1].Cells[0].Value.ToString()); playerID3 = ConnectDataBases.GetUserId(dbListPartyList.Rows[2].Cells[0].Value.ToString()); playerID4 = ConnectDataBases.GetUserId(dbListPartyList.Rows[3].Cells[0].Value.ToString()); playerID5 = ConnectDataBases.GetUserId(dbListPartyList.Rows[4].Cells[0].Value.ToString()); playerID6 = ""; break; } case 6: { playerID1 = ConnectDataBases.GetUserId(dbListPartyList.Rows[0].Cells[0].Value.ToString()); playerID2 = ConnectDataBases.GetUserId(dbListPartyList.Rows[1].Cells[0].Value.ToString()); playerID3 = ConnectDataBases.GetUserId(dbListPartyList.Rows[2].Cells[0].Value.ToString()); playerID4 = ConnectDataBases.GetUserId(dbListPartyList.Rows[3].Cells[0].Value.ToString()); playerID5 = ConnectDataBases.GetUserId(dbListPartyList.Rows[4].Cells[0].Value.ToString()); playerID6 = ConnectDataBases.GetUserId(dbListPartyList.Rows[5].Cells[0].Value.ToString()); break; } } } if (cInt > 0) { switch (cInt) { case 1: { charID1 = ConnectDataBases.GetUserId(dbListCharList.Rows[0].Cells[0].Value.ToString()); charID2 = ""; charID3 = ""; charID4 = ""; charID5 = ""; charID6 = ""; break; } case 2: { charID1 = ConnectDataBases.GetUserId(dbListCharList.Rows[0].Cells[0].Value.ToString()); charID2 = ConnectDataBases.GetUserId(dbListCharList.Rows[1].Cells[0].Value.ToString()); charID3 = ""; charID4 = ""; charID5 = ""; charID6 = ""; break; } case 3: { charID1 = ConnectDataBases.GetUserId(dbListCharList.Rows[0].Cells[0].Value.ToString()); charID2 = ConnectDataBases.GetUserId(dbListCharList.Rows[1].Cells[0].Value.ToString()); charID3 = ConnectDataBases.GetUserId(dbListCharList.Rows[2].Cells[0].Value.ToString()); charID4 = ""; charID5 = ""; charID6 = ""; break; } case 4: { charID1 = ConnectDataBases.GetUserId(dbListCharList.Rows[0].Cells[0].Value.ToString()); charID2 = ConnectDataBases.GetUserId(dbListCharList.Rows[1].Cells[0].Value.ToString()); charID3 = ConnectDataBases.GetUserId(dbListCharList.Rows[2].Cells[0].Value.ToString()); charID4 = ConnectDataBases.GetUserId(dbListCharList.Rows[3].Cells[0].Value.ToString()); charID5 = ""; charID6 = ""; break; } case 5: { charID1 = ConnectDataBases.GetUserId(dbListCharList.Rows[0].Cells[0].Value.ToString()); charID2 = ConnectDataBases.GetUserId(dbListCharList.Rows[1].Cells[0].Value.ToString()); charID3 = ConnectDataBases.GetUserId(dbListCharList.Rows[2].Cells[0].Value.ToString()); charID4 = ConnectDataBases.GetUserId(dbListCharList.Rows[3].Cells[0].Value.ToString()); charID5 = ConnectDataBases.GetUserId(dbListCharList.Rows[4].Cells[0].Value.ToString()); charID6 = ""; break; } case 6: { charID1 = ConnectDataBases.GetUserId(dbListCharList.Rows[0].Cells[0].Value.ToString()); charID2 = ConnectDataBases.GetUserId(dbListCharList.Rows[1].Cells[0].Value.ToString()); charID3 = ConnectDataBases.GetUserId(dbListCharList.Rows[2].Cells[0].Value.ToString()); charID4 = ConnectDataBases.GetUserId(dbListCharList.Rows[3].Cells[0].Value.ToString()); charID5 = ConnectDataBases.GetUserId(dbListCharList.Rows[4].Cells[0].Value.ToString()); charID6 = ConnectDataBases.GetUserId(dbListCharList.Rows[5].Cells[0].Value.ToString()); break; } } } ConnectDataBases.UpdateParty(pInt, cInt, userID, partyID, partyName, playerID1, playerID2, playerID3, playerID4, playerID5, playerID6, charID1, charID2, charID3, charID4, charID5, charID6); ConnectVariables.SetPlayer1IDDP(playerID1); ConnectVariables.SetPlayer2IDDP(playerID2); ConnectVariables.SetPlayer3IDDP(playerID3); ConnectVariables.SetPlayer4IDDP(playerID4); ConnectVariables.SetPlayer5IDDP(playerID5); ConnectVariables.SetPlayer6IDDP(playerID6); ConnectVariables.SetChar1IDDP(charID1); ConnectVariables.SetChar2IDDP(charID2); ConnectVariables.SetChar3IDDP(charID3); ConnectVariables.SetChar4IDDP(charID4); ConnectVariables.SetChar5IDDP(charID5); ConnectVariables.SetChar6IDDP(charID6); } } else if (role == "Player") { if (cInt > 0) { switch (cInt) { case 1: { charID1 = ConnectDataBases.GetUserId(dbListCharList.Rows[0].Cells[0].Value.ToString()); charID2 = ""; charID3 = ""; charID4 = ""; charID5 = ""; charID6 = ""; break; } case 2: { charID1 = ConnectDataBases.GetUserId(dbListCharList.Rows[0].Cells[0].Value.ToString()); charID2 = ConnectDataBases.GetUserId(dbListCharList.Rows[1].Cells[0].Value.ToString()); charID3 = ""; charID4 = ""; charID5 = ""; charID6 = ""; break; } case 3: { charID1 = ConnectDataBases.GetUserId(dbListCharList.Rows[0].Cells[0].Value.ToString()); charID2 = ConnectDataBases.GetUserId(dbListCharList.Rows[1].Cells[0].Value.ToString()); charID3 = ConnectDataBases.GetUserId(dbListCharList.Rows[2].Cells[0].Value.ToString()); charID4 = ""; charID5 = ""; charID6 = ""; break; } case 4: { charID1 = ConnectDataBases.GetUserId(dbListCharList.Rows[0].Cells[0].Value.ToString()); charID2 = ConnectDataBases.GetUserId(dbListCharList.Rows[1].Cells[0].Value.ToString()); charID3 = ConnectDataBases.GetUserId(dbListCharList.Rows[2].Cells[0].Value.ToString()); charID4 = ConnectDataBases.GetUserId(dbListCharList.Rows[3].Cells[0].Value.ToString()); charID5 = ""; charID6 = ""; break; } case 5: { charID1 = ConnectDataBases.GetUserId(dbListCharList.Rows[0].Cells[0].Value.ToString()); charID2 = ConnectDataBases.GetUserId(dbListCharList.Rows[1].Cells[0].Value.ToString()); charID3 = ConnectDataBases.GetUserId(dbListCharList.Rows[2].Cells[0].Value.ToString()); charID4 = ConnectDataBases.GetUserId(dbListCharList.Rows[3].Cells[0].Value.ToString()); charID5 = ConnectDataBases.GetUserId(dbListCharList.Rows[4].Cells[0].Value.ToString()); charID6 = ""; break; } case 6: { charID1 = ConnectDataBases.GetUserId(dbListCharList.Rows[0].Cells[0].Value.ToString()); charID2 = ConnectDataBases.GetUserId(dbListCharList.Rows[1].Cells[0].Value.ToString()); charID3 = ConnectDataBases.GetUserId(dbListCharList.Rows[2].Cells[0].Value.ToString()); charID4 = ConnectDataBases.GetUserId(dbListCharList.Rows[3].Cells[0].Value.ToString()); charID5 = ConnectDataBases.GetUserId(dbListCharList.Rows[4].Cells[0].Value.ToString()); charID6 = ConnectDataBases.GetUserId(dbListCharList.Rows[5].Cells[0].Value.ToString()); break; } } } ConnectDataBases.UpdateParty(pInt, cInt, userID, partyID, partyName, playerID1, playerID2, playerID3, playerID4, playerID5, playerID6, charID1, charID2, charID3, charID4, charID5, charID6); ConnectVariables.SetPlayer1IDDP(playerID1); ConnectVariables.SetPlayer2IDDP(playerID2); ConnectVariables.SetPlayer3IDDP(playerID3); ConnectVariables.SetPlayer4IDDP(playerID4); ConnectVariables.SetPlayer5IDDP(playerID5); ConnectVariables.SetPlayer6IDDP(playerID6); ConnectVariables.SetChar1IDDP(charID1); ConnectVariables.SetChar2IDDP(charID2); ConnectVariables.SetChar3IDDP(charID3); ConnectVariables.SetChar4IDDP(charID4); ConnectVariables.SetChar5IDDP(charID5); ConnectVariables.SetChar6IDDP(charID6); } } }