Exemplo n.º 1
0
        public void LoadForm()
        {
            txtPartyName.Text        = ConnectVariables.GetPartyNameDP();
            txtPartyCreatorName.Text = ConnectDataBases.GetUsername(ConnectVariables.GetPartyOwnerIDDP());


            ConnectDataBases.GetPartyPlayerAmnt();
            ConnectDataBases.GetPartyCharacterAmnt();
            int pInt = Int32.Parse(ConnectVariables.GetPlayerAmntDP()), cInt = Int32.Parse(ConnectVariables.GetCharacterAmntDP()), rowIndex = 0;

            Console.WriteLine("\nPARTY MAKER FORM: pInt Value: " + pInt);
            Console.WriteLine("\nPARTY MAKER FORM: cInt Value: " + cInt);
            if (pInt > 0)
            {
                switch (pInt)
                {
                case 1:
                {
                    rowIndex = dbListPartyList.Rows.Add();
                    dbListPartyList.Rows[rowIndex].Cells[0].Value = ConnectDataBases.GetUsername(ConnectVariables.GetPlayer1IDDP());
                    break;
                }

                case 2:
                {
                    rowIndex = dbListPartyList.Rows.Add();
                    dbListPartyList.Rows[rowIndex].Cells[0].Value = ConnectDataBases.GetUsername(ConnectVariables.GetPlayer1IDDP());
                    rowIndex += dbListPartyList.Rows.Add();
                    dbListPartyList.Rows[rowIndex].Cells[0].Value = ConnectDataBases.GetUsername(ConnectVariables.GetPlayer2IDDP());
                    break;
                }

                case 3:
                {
                    rowIndex = dbListPartyList.Rows.Add();
                    dbListPartyList.Rows[rowIndex].Cells[0].Value = ConnectDataBases.GetUsername(ConnectVariables.GetPlayer1IDDP());
                    rowIndex = dbListPartyList.Rows.Add();
                    dbListPartyList.Rows[rowIndex].Cells[0].Value = ConnectDataBases.GetUsername(ConnectVariables.GetPlayer2IDDP());
                    rowIndex = dbListPartyList.Rows.Add();
                    dbListPartyList.Rows[rowIndex].Cells[0].Value = ConnectDataBases.GetUsername(ConnectVariables.GetPlayer3IDDP());
                    break;
                }

                case 4:
                {
                    rowIndex = dbListPartyList.Rows.Add();
                    dbListPartyList.Rows[rowIndex].Cells[0].Value = ConnectDataBases.GetUsername(ConnectVariables.GetPlayer1IDDP());
                    rowIndex = dbListPartyList.Rows.Add();
                    dbListPartyList.Rows[rowIndex].Cells[0].Value = ConnectDataBases.GetUsername(ConnectVariables.GetPlayer2IDDP());
                    rowIndex = dbListPartyList.Rows.Add();
                    dbListPartyList.Rows[rowIndex].Cells[0].Value = ConnectDataBases.GetUsername(ConnectVariables.GetPlayer3IDDP());
                    rowIndex = dbListPartyList.Rows.Add();
                    dbListPartyList.Rows[rowIndex].Cells[0].Value = ConnectDataBases.GetUsername(ConnectVariables.GetPlayer4IDDP());
                    break;
                }

                case 5:
                {
                    rowIndex = dbListPartyList.Rows.Add();
                    dbListPartyList.Rows[rowIndex].Cells[0].Value = ConnectDataBases.GetUsername(ConnectVariables.GetPlayer1IDDP());
                    rowIndex = dbListPartyList.Rows.Add();
                    dbListPartyList.Rows[rowIndex].Cells[0].Value = ConnectDataBases.GetUsername(ConnectVariables.GetPlayer2IDDP());
                    rowIndex = dbListPartyList.Rows.Add();
                    dbListPartyList.Rows[rowIndex].Cells[0].Value = ConnectDataBases.GetUsername(ConnectVariables.GetPlayer3IDDP());
                    rowIndex = dbListPartyList.Rows.Add();
                    dbListPartyList.Rows[rowIndex].Cells[0].Value = ConnectDataBases.GetUsername(ConnectVariables.GetPlayer4IDDP());
                    rowIndex = dbListPartyList.Rows.Add();
                    dbListPartyList.Rows[rowIndex].Cells[0].Value = ConnectDataBases.GetUsername(ConnectVariables.GetPlayer5IDDP());
                    break;
                }

                case 6:
                {
                    rowIndex = dbListPartyList.Rows.Add();
                    dbListPartyList.Rows[rowIndex].Cells[0].Value = ConnectDataBases.GetUsername(ConnectVariables.GetPlayer1IDDP());
                    rowIndex = dbListPartyList.Rows.Add();
                    dbListPartyList.Rows[rowIndex].Cells[0].Value = ConnectDataBases.GetUsername(ConnectVariables.GetPlayer2IDDP());
                    rowIndex = dbListPartyList.Rows.Add();
                    dbListPartyList.Rows[rowIndex].Cells[0].Value = ConnectDataBases.GetUsername(ConnectVariables.GetPlayer3IDDP());
                    rowIndex = dbListPartyList.Rows.Add();
                    dbListPartyList.Rows[rowIndex].Cells[0].Value = ConnectDataBases.GetUsername(ConnectVariables.GetPlayer4IDDP());
                    rowIndex = dbListPartyList.Rows.Add();
                    dbListPartyList.Rows[rowIndex].Cells[0].Value = ConnectDataBases.GetUsername(ConnectVariables.GetPlayer5IDDP());
                    rowIndex = dbListPartyList.Rows.Add();
                    dbListPartyList.Rows[rowIndex].Cells[0].Value = ConnectDataBases.GetUsername(ConnectVariables.GetPlayer6IDDP());
                    break;
                }
                }
            }
            if (cInt > 0)
            {
                switch (cInt)
                {
                case 1:
                {
                    rowIndex = dbListCharList.Rows.Add();
                    dbListCharList.Rows[rowIndex].Cells[0].Value = ConnectDataBases.GetUsername(ConnectVariables.GetChar1IDDP());
                    break;
                }

                case 2:
                {
                    rowIndex = dbListCharList.Rows.Add();
                    dbListCharList.Rows[rowIndex].Cells[0].Value = ConnectDataBases.GetUsername(ConnectVariables.GetChar1IDDP());
                    rowIndex = dbListCharList.Rows.Add();
                    dbListCharList.Rows[rowIndex].Cells[0].Value = ConnectDataBases.GetUsername(ConnectVariables.GetChar2IDDP());
                    break;
                }

                case 3:
                {
                    rowIndex = dbListCharList.Rows.Add();
                    dbListCharList.Rows[rowIndex].Cells[0].Value = ConnectDataBases.GetUsername(ConnectVariables.GetChar1IDDP());
                    rowIndex = dbListCharList.Rows.Add();
                    dbListCharList.Rows[rowIndex].Cells[0].Value = ConnectDataBases.GetUsername(ConnectVariables.GetChar2IDDP());
                    rowIndex = dbListCharList.Rows.Add();
                    dbListCharList.Rows[rowIndex].Cells[0].Value = ConnectDataBases.GetUsername(ConnectVariables.GetChar3IDDP());
                    break;
                }

                case 4:
                {
                    rowIndex = dbListCharList.Rows.Add();
                    dbListCharList.Rows[rowIndex].Cells[0].Value = ConnectDataBases.GetUsername(ConnectVariables.GetChar1IDDP());
                    rowIndex = dbListCharList.Rows.Add();
                    dbListCharList.Rows[rowIndex].Cells[0].Value = ConnectDataBases.GetUsername(ConnectVariables.GetChar2IDDP());
                    rowIndex = dbListCharList.Rows.Add();
                    dbListCharList.Rows[rowIndex].Cells[0].Value = ConnectDataBases.GetUsername(ConnectVariables.GetChar3IDDP());
                    rowIndex = dbListCharList.Rows.Add();
                    dbListCharList.Rows[rowIndex].Cells[0].Value = ConnectDataBases.GetUsername(ConnectVariables.GetChar4IDDP());
                    break;
                }

                case 5:
                {
                    rowIndex = dbListCharList.Rows.Add();
                    dbListCharList.Rows[rowIndex].Cells[0].Value = ConnectDataBases.GetUsername(ConnectVariables.GetChar1IDDP());
                    rowIndex = dbListCharList.Rows.Add();
                    dbListCharList.Rows[rowIndex].Cells[0].Value = ConnectDataBases.GetUsername(ConnectVariables.GetChar2IDDP());
                    rowIndex = dbListCharList.Rows.Add();
                    dbListCharList.Rows[rowIndex].Cells[0].Value = ConnectDataBases.GetUsername(ConnectVariables.GetChar3IDDP());
                    rowIndex = dbListCharList.Rows.Add();
                    dbListCharList.Rows[rowIndex].Cells[0].Value = ConnectDataBases.GetUsername(ConnectVariables.GetChar4IDDP());
                    rowIndex = dbListCharList.Rows.Add();
                    dbListCharList.Rows[rowIndex].Cells[0].Value = ConnectDataBases.GetUsername(ConnectVariables.GetChar5IDDP());
                    break;
                }

                case 6:
                {
                    rowIndex = dbListCharList.Rows.Add();
                    dbListCharList.Rows[rowIndex].Cells[0].Value = ConnectDataBases.GetUsername(ConnectVariables.GetChar1IDDP());
                    rowIndex = dbListCharList.Rows.Add();
                    dbListCharList.Rows[rowIndex].Cells[0].Value = ConnectDataBases.GetUsername(ConnectVariables.GetChar2IDDP());
                    rowIndex = dbListCharList.Rows.Add();
                    dbListCharList.Rows[rowIndex].Cells[0].Value = ConnectDataBases.GetUsername(ConnectVariables.GetChar3IDDP());
                    rowIndex = dbListCharList.Rows.Add();
                    dbListCharList.Rows[rowIndex].Cells[0].Value = ConnectDataBases.GetUsername(ConnectVariables.GetChar4IDDP());
                    rowIndex = dbListCharList.Rows.Add();
                    dbListCharList.Rows[rowIndex].Cells[0].Value = ConnectDataBases.GetUsername(ConnectVariables.GetChar5IDDP());
                    rowIndex = dbListCharList.Rows.Add();
                    dbListCharList.Rows[rowIndex].Cells[0].Value = ConnectDataBases.GetUsername(ConnectVariables.GetChar6IDDP());
                    break;
                }
                }
            }
        }
Exemplo n.º 2
0
        public void Update(char VALUE = '0')
        {
            if (VALUE == 'C')
            {
                Update('L');
                maxPages = maxPartyIndex / 10;
                rowIndex = 0;
                // Updates index page
                if (pages < 0)
                {
                    currentPartyIndex = 0;
                }
                else if (pages == maxPages)
                {
                    currentPartyIndex = rowIndex + pages * 10;
                }
                else
                {
                    currentPartyIndex = rowIndex + pages * 10;
                }

                for (int i = currentPartyIndex; i < maxPartyIndex && rowIndex <= 9; i++)
                {
                    rowIndex = dbListPartiesList.Rows.Add();
                    ConnectDataBases.GetParty(i + 1, searchFor);

                    //CREATE CV FOR PARTIES
                    dbListPartiesList.Rows[rowIndex].Cells[0].Value = ConnectDataBases.GetPartyName(ConnectVariables.GetPartyIDDP());
                    dbListPartiesList.Rows[rowIndex].Cells[1].Value = ConnectDataBases.GetUsername(ConnectVariables.GetPartyOwnerIDDP());
                    dbListPartiesList.Rows[rowIndex].Cells[2].Value = ConnectVariables.GetPartyIDDP();
                    dbListPartiesList.Rows[rowIndex].Cells[3].Value = ConnectVariables.GetPartyOwnerIDDP();
                    currentPartyIndex = i;
                    Console.WriteLine("\n''PARTY LIST FORM: Party Name: " + ConnectDataBases.GetPartyName(ConnectVariables.GetPartyIDDP()));
                    Console.WriteLine("  Party owner Username: "******"  Current Page Index: " + pages);
                    Console.WriteLine("  Max Page Index: " + maxPages);
                    Console.WriteLine("  Row Index: " + rowIndex);
                    Console.WriteLine("  Current Party Index: " + currentPartyIndex);
                    Console.WriteLine("''Max Party Index: " + maxPartyIndex);
                }
                //Button Updates to page
                Update('O');
            }
            else if (VALUE == 'L')
            {
                dbListPartiesList.Rows.Clear();
                dbListPlayersCharactersList.Rows.Clear();
            }
            else if (VALUE == 'O')//update buttons
            {
                if (pages <= 0)
                {
                    pages = 0;
                    btnPrevious.Enabled = false;
                    btnNext.Enabled     = true;
                }
                else if (pages == maxPages)
                {
                    btnNext.Enabled     = false;
                    btnPrevious.Enabled = true;
                }
                else
                {
                    btnPrevious.Enabled = true;
                    btnNext.Enabled     = true;
                }
            }
            else if (VALUE == 'A')
            {
                maxPartyIndex = ConnectDataBases.GetAllParties();
                searchFor     = 'A';
            }
            else if (VALUE == 'Z')
            {
                maxPartyIndex = ConnectDataBases.GetUsersPartyAmount();
                searchFor     = 'Z';
            }
            else if (VALUE == 'P')//Last Page
            {
                pages -= 1;
                Update('C');
            }
            else if (VALUE == 'N')//Next Page
            {
                pages += 1;
                Update('C');
            }
        }