private void btnChangePW_Click(object sender, EventArgs e) { string loggedInUsername = ConnectVariables.GetLoggedInUsernameAs(); ConnectDataBases.ResetPassword(loggedInUsername, txtNewPW.Text, txtConfirmNewPW.Text); }
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); } } }
public void Update(char VALUE = '0', string classText = "0") { Console.WriteLine("VALUE: " + VALUE); if (VALUE == 'M')//update button for creating characters { //FEATURES lblUsernameToPresent.Text = ConnectVariables.GetLoggedInUsernameAs(); txtCharName.Enabled = true; btnRaceOpt.Enabled = true; cmbGender.Enabled = true; btnClassOpt.Enabled = true; cmbElemental.Enabled = true; btnStrMinus.Enabled = true; btnStrPlus.Enabled = true; btnConMinus.Enabled = true; btnConPlus.Enabled = true; btnDexMinus.Enabled = true; btnDexPlus.Enabled = true; btnWisMinus.Enabled = true; btnWisPlus.Enabled = true; btnIntMinus.Enabled = true; btnIntPlus.Enabled = true; btnLukMin.Enabled = true; btnLukPlus.Enabled = true; cmbTalent1.Enabled = true; cmbTalent2.Enabled = true; cmbTalent3.Enabled = true; cmbQuirk1.Enabled = true; cmbQuirk2.Enabled = true; cmbQuirk3.Enabled = true; //CONTROLLS btnClear.Visible = true; btnSave.Visible = false; btnCreate.Visible = true; btnSelect.Visible = false; } else if (VALUE == 'L')//update button for loading characters you own { //FEATURES txtCharName.Enabled = true; btnRaceOpt.Enabled = true; cmbGender.Enabled = true; btnClassOpt.Enabled = true; cmbElemental.Enabled = true; btnStrMinus.Enabled = true; btnStrPlus.Enabled = true; btnConMinus.Enabled = true; btnConPlus.Enabled = true; btnDexMinus.Enabled = true; btnDexPlus.Enabled = true; btnWisMinus.Enabled = true; btnWisPlus.Enabled = true; btnIntMinus.Enabled = true; btnIntPlus.Enabled = true; btnLukMin.Enabled = true; btnLukPlus.Enabled = true; cmbTalent1.Enabled = true; cmbTalent2.Enabled = true; cmbTalent3.Enabled = true; cmbQuirk1.Enabled = true; cmbQuirk2.Enabled = true; cmbQuirk3.Enabled = true; //CONTROLLS btnClear.Visible = true; btnSave.Visible = true; btnCreate.Visible = false; btnSelect.Visible = false; } else if (VALUE == 'O')//update button for loading characters you dont own { //FEATURES txtCharName.Enabled = false; btnRaceOpt.Enabled = false; cmbGender.Enabled = false; btnClassOpt.Enabled = false; cmbElemental.Enabled = false; btnStrMinus.Enabled = false; btnStrPlus.Enabled = false; btnConMinus.Enabled = false; btnConPlus.Enabled = false; btnDexMinus.Enabled = false; btnDexPlus.Enabled = false; btnWisMinus.Enabled = false; btnWisPlus.Enabled = false; btnIntMinus.Enabled = false; btnIntPlus.Enabled = false; btnChaMinus.Enabled = false; btnChaPlus.Enabled = false; btnLukMin.Enabled = false; btnLukPlus.Enabled = false; cmbTalent1.Enabled = false; cmbTalent2.Enabled = false; cmbTalent3.Enabled = false; cmbQuirk1.Enabled = false; cmbQuirk2.Enabled = false; cmbQuirk3.Enabled = false; //CONTROLLS btnClear.Visible = false; btnSave.Visible = false; btnCreate.Visible = false; btnSelect.Visible = false; } else if (VALUE == 'R')//update race { Console.WriteLine("Updated Race"); lblRace.Text = char_Race; } else if (VALUE == 'C') { if (classText == "0") { Console.WriteLine("Updated Class"); Console.WriteLine("Class: " + char_Class); lblClass.Text = char_Class; } if (lblClass.Text == "Brute") { System.Console.WriteLine("Class Setting Image: " + lblClass.Text); Image image1 = Image.FromFile("BruteIcon.jpg"); picClassIcon.BackgroundImage = image1; System.Console.WriteLine("Class Set Image: " + lblClass.Text); } else if (lblClass.Text == "Guardsman") { Image image2 = Image.FromFile("GuardsmanIcon.jpg"); picClassIcon.BackgroundImage = image2; } else if (lblClass.Text == "Oracle") { Image image3 = Image.FromFile("OracleIcon.jpg"); picClassIcon.BackgroundImage = image3; } else if (lblClass.Text == "Archon") { Image image4 = Image.FromFile("ArchonIcon.jpg"); picClassIcon.BackgroundImage = image4; } else if (lblClass.Text == "Huntsman") { Image image5 = Image.FromFile("HuntsmanIcon.jpg"); picClassIcon.BackgroundImage = image5; } else if (lblClass.Text == "Reprobate") { Image image6 = Image.FromFile("ReprobateIcon.jpg"); picClassIcon.BackgroundImage = image6; } else if (lblClass.Text == "Reaper") { Image image7 = Image.FromFile("ReaperIcon.jpg"); picClassIcon.BackgroundImage = image7; } else if (lblClass.Text == "Caster") { Image image8 = Image.FromFile("CasterIcon.jpg"); picClassIcon.BackgroundImage = image8; } else if (lblClass.Text == "Elementalist") { Image image9 = Image.FromFile("ElementalistIcon.jpg"); picClassIcon.BackgroundImage = image9; } }//update class else if (VALUE == 'F')//Load Pre Existing Info For Characters { string c = "updateImage"; lblUsernameToPresent.Text = ConnectVariables.GetUsernameDP(); txtCharName.Text = ConnectVariables.GetCharNameDP(); lblRace.Text = ConnectVariables.GetCharRaceDP(); cmbGender.Text = ConnectVariables.GetCharGenderDP(); lblClass.Text = ConnectVariables.GetCharClassDP(); cmbElemental.Text = ConnectVariables.GetCharElementDP(); lblStr.Text = ConnectVariables.GetCharStrengthDP(); lblCon.Text = ConnectVariables.GetCharConstDP(); lblDex.Text = ConnectVariables.GetCharDexDP(); lblWis.Text = ConnectVariables.GetCharWisDP(); lblInt.Text = ConnectVariables.GetCharIntelDP(); lblCha.Text = ConnectVariables.GetCharCharismaDP(); lblLuk.Text = ConnectVariables.GetCharLuckDP(); lblBrawn.Text = ConnectVariables.GetCharBrawnDP(); lblHealth.Text = ConnectVariables.GetCharHealthDP(); lblNimble.Text = ConnectVariables.GetCharNimDP(); lblMemory.Text = ConnectVariables.GetCharMemDP(); lblClever.Text = ConnectVariables.GetCharCleverDP(); lblCharm.Text = ConnectVariables.GetCharCharmDP(); cmbTalent1.Text = ConnectVariables.GetCharTalDP1(); cmbTalent2.Text = ConnectVariables.GetCharTalDP2(); cmbTalent3.Text = ConnectVariables.GetCharTalDP3(); cmbQuirk1.Text = ConnectVariables.GetCharQuiDP1(); cmbQuirk2.Text = ConnectVariables.GetCharQuiDP2(); cmbQuirk3.Text = ConnectVariables.GetCharQuiDP3(); Update('C', c); } else if (VALUE == 'X') { lblUsernameToPresent.Text = ""; txtCharName.Text = ""; lblRace.Text = ""; cmbGender.Text = ""; lblClass.Text = ""; cmbElemental.Text = ""; lblStr.Text = ""; lblCon.Text = ""; lblDex.Text = ""; lblWis.Text = ""; lblInt.Text = ""; lblCha.Text = ""; lblLuk.Text = ""; lblBrawn.Text = ""; lblHealth.Text = ""; lblNimble.Text = ""; lblMemory.Text = ""; lblClever.Text = ""; lblCharm.Text = ""; cmbTalent1.Text = ""; cmbTalent2.Text = ""; cmbTalent3.Text = ""; cmbQuirk1.Text = ""; cmbQuirk2.Text = ""; cmbQuirk3.Text = ""; } Console.WriteLine("UPDATED CF FORM!"); }