Esempio n. 1
0
        void MenuWindow(int windowID)
        {
            #region Display Selected Tab
            switch (SelectedTab)
            {
            case MenuTab.Visuals:
                VisualsTab.Tab();
                break;

            case MenuTab.Aimbot:
                AimbotTab.Tab();
                break;

            case MenuTab.Misc:
                MiscTab.Tab();
                break;

            case MenuTab.Weapons:
                WeaponsTab.Tab();
                break;

            case MenuTab.Settings:
                SettingsTab.Tab();
                break;

            case MenuTab.Players:
                PlayersTab.Tab();
                break;
            }
            #endregion

            GUI.DragWindow();
        }
Esempio n. 2
0
        private void btnRemoveEventFromPlayer_Click(object sender, EventArgs e)
        {
            List <Event> removeEvents = new List <Event>();

            for (int index = 0; index < dataGridViewCurrentPlayerEvents.SelectedRows.Count; ++index)
            {
                var selectedRow = dataGridViewCurrentPlayerEvents.SelectedRows[index];
                var rowEvent    = (Event)selectedRow.DataBoundItem;
                removeEvents.Add(rowEvent);
            }

            bool removedOne = false;

            foreach (var removeEvent in removeEvents)
            {
                Console.WriteLine(removeEvent.Id);
                if (PlayersTab.RemovelayerFromEvent(currentChangedPlayer.Id, removeEvent))
                {
                    removedOne = true;
                }
            }

            if (removedOne)
            {
                LoadEventManagementTabPlayer(currentChangedPlayer);
                clearFilterFormTextBoxes();
            }
        }
Esempio n. 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            List <Event> addEvents = new List <Event>();

            for (int index = 0; index < dataGridViewCurrentPlayerNewEvents.SelectedRows.Count; ++index)
            {
                var selectedRow = dataGridViewCurrentPlayerNewEvents.SelectedRows[index];
                var rowEvent    = (Event)selectedRow.DataBoundItem;
                addEvents.Add(rowEvent);
            }

            bool changedOne = false;

            foreach (var removeEvent in addEvents)
            {
                if (PlayersTab.AddPlayerToEvent(currentChangedPlayer.Id, removeEvent))
                {
                    changedOne = true;
                }
            }

            if (changedOne)
            {
                LoadEventManagementTabPlayer(currentChangedPlayer);
                clearFilterFormTextBoxes();
            }
        }
Esempio n. 4
0
        private void btnPlayerEdit_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(tbPlayerNumber.Text.Trim()))
            {
                MessageBox.Show("Invalid player number", "Invalid number", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            if (!Int32.TryParse(numericUpDownAge.Text, out var age))
            {
                MessageBox.Show("Please enter a valid age", "Invalid Age", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (String.IsNullOrEmpty(tbFirstName.Text.Trim()) || String.IsNullOrEmpty(tbLastName.Text.Trim()))
            {
                MessageBox.Show("Please enter both first name and last name.", "Invalid Name", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (String.IsNullOrEmpty(cbxDistrict.Text.Trim()))
            {
                MessageBox.Show("Please choose a valid district.", "Invalid District", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (String.IsNullOrEmpty(comboBoxEducationZones.Text.Trim()))
            {
                MessageBox.Show("Please choose a valid education zone.", "Invalid Education Zone", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (!Util.ValidHumanSexString(cbxGender.Text.Trim()))
            {
                MessageBox.Show("Please choose a valid gender.", "Invalid Gender", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                long     districtId = 0;
                District district   = DataBase.GetDistrictByName(cbxDistrict.Text);
                if (district != null)
                {
                    districtId = district.Id;
                }

                long   schoolId = 0;
                School school   = DataBase.GetSchool(cbxSchool.Text);
                if (school != null)
                {
                    schoolId = school.Id;
                }

                long          educationZoneId = 0;
                EducationZone zone            = DataBase.GetEducationZone(comboBoxEducationZones.Text);
                if (zone != null)
                {
                    educationZoneId = zone.Id;
                }

                string searchString   = tbPlayerNumber.Text.Trim();
                Player searchMe       = new Player(searchString);
                Player searchByNumber = DataBase.FindPlayerByNumber(searchMe);
                if (searchByNumber != null)
                {
                    Player newPlayer = new Player(searchByNumber.Id, tbPlayerNumber.Text, tbFirstName.Text, tbLastName.Text, age,
                                                  (byte)Util.SexStringToEnum(cbxGender.Text), schoolId, districtId, educationZoneId);

                    if (PlayersTab.SavePlayer(newPlayer))
                    {
                        LoadPlayerList();
                        statusViewer.Update("Player update successful!", Status.SUCCESS);
                    }
                }
            }
        }
Esempio n. 5
0
        private void btnAddPlayer_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(tbPlayerNumber.Text.Trim()))
            {
                MessageBox.Show("Invalid player number", "Invalid number", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            if (!Int32.TryParse(numericUpDownAge.Text, out var age))
            {
                MessageBox.Show("Please enter a valid age", "Invalid Age", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (String.IsNullOrEmpty(tbFirstName.Text.Trim()) || String.IsNullOrEmpty(tbLastName.Text.Trim()))
            {
                MessageBox.Show("Please enter both first name and last name.", "Invalid Name", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (String.IsNullOrEmpty(cbxDistrict.Text.Trim()))
            {
                MessageBox.Show("Please choose a valid district.", "Invalid District", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (String.IsNullOrEmpty(comboBoxEducationZones.Text.Trim()))
            {
                MessageBox.Show("Please choose a valid education zone.", "Invalid Education Zone", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (!Util.ValidHumanSexString(cbxGender.Text.Trim()))
            {
                MessageBox.Show("Please choose a valid gender.", "Invalid Gender", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                long     districtId = 0;
                District district   = DataBase.GetDistrictByName(cbxDistrict.Text);
                if (district != null)
                {
                    districtId = district.Id;
                }

                long   schoolId = 0;
                School school   = DataBase.GetSchool(cbxSchool.Text);
                if (school != null)
                {
                    schoolId = school.Id;
                }

                long          educationZoneId = 0;
                EducationZone zone            = DataBase.GetEducationZone(comboBoxEducationZones.Text);
                if (zone != null)
                {
                    educationZoneId = zone.Id;
                }

                Player newPlayer = new Player(0, tbPlayerNumber.Text, tbFirstName.Text, tbLastName.Text, age,
                                              (byte)Util.SexStringToEnum(cbxGender.Text), schoolId, districtId, educationZoneId);

                var result = PlayersTab.AddPlayer(newPlayer);
                if (result.Item1)
                {
                    statusViewer.Update("Player saved sucecssfully...!", Status.INFO);
                    LoadPlayerList();

                    if (checkBoxAddtoanEvent.Checked)
                    {
                        Player existingPlayer = DataBase.FindPlayerByNumber(newPlayer);
                        LoadEventManagementTabPlayer(existingPlayer);
                        CleanupPlayerTabTextBoxes();
                    }
                }
            }
        }