Esempio n. 1
0
        //private void LoadResultGridview()
        //{
        //    CandidateManager aCandidateManager = new CandidateManager();
        //    List<ManageCandidate> candidateList = new List<ManageCandidate>();
        //    candidateList = aCandidateManager.LoadCandidateGridview();

        //    int candidateSerialNumber = 1;
        //    foreach (var candidate in candidateList)
        //    {
        //        candidateListGridView.Rows.Add(candidateSerialNumber, candidate.CandidateName, candidate.CandidateSymbol,
        //            candidate.CandidatePassword, candidate.NumberOfVote);
        //        candidateSerialNumber++;
        //    }
        //}


        private void saveVoterButton_Click(object sender, EventArgs e)
        {
            aManageVoter.VoterID       = voterIDTextBox.Text;
            aManageVoter.VoterPassword = voterPasswordTextBox.Text;

            if (voterIDTextBox.Text != "" && voterPasswordTextBox.Text != "")
            {
                VoterManager aVoterManager      = new VoterManager();
                bool         confirmSaveMessage = aVoterManager.SaveVoter(aManageVoter);

                if (confirmSaveMessage)
                {
                    MessageBox.Show("New Voter Saved");
                    voterIDTextBox.Clear();
                    voterPasswordTextBox.Clear();
                    LoadVoterGridView();
                }
                else
                {
                    MessageBox.Show("This id is already exist");
                    voterIDTextBox.Clear();
                    voterPasswordTextBox.Clear();
                }
            }
            else
            {
                MessageBox.Show("Please Fill up the required field");
            }
        }
Esempio n. 2
0
        private void LoadVoterGridView()
        {
            VoterManager       aVoterManager = new VoterManager();
            List <ManageVoter> voterList     = new List <ManageVoter>();

            voterList = aVoterManager.LoadVoterGridview();
            int voterSerialNumber = 1;

            VoterListGridView.Rows.Clear();
            foreach (var voter in voterList)
            {
                VoterListGridView.Rows.Add(voterSerialNumber, voter.VoterID, voter.VoterPassword, voter.VotingStatus);
                voterSerialNumber++;
            }
        }
Esempio n. 3
0
        public void CastVoteUI_Load(object sender, EventArgs e)
        {
            StatusManager aStatusManager = new StatusManager();

            if (aStatusManager.CheckSystemStatus())
            {
                VoterManager           aVoterManager = new VoterManager();
                List <ManageCandidate> cList         = new List <ManageCandidate>();
                cList = aCandidateManager.LoadCandidateGridview();

                int slNo = 1;
                foreach (var candidate in cList)
                {
                    candidateListDataGridView.Rows.Add(slNo, candidate.CandidateName, candidate.CandidateSymbol);
                    slNo++;
                }

                bool chkVoteStatus = aVoterManager.CheckVoterVoteStatus(voterIDTextBox.Text);
                if (chkVoteStatus)
                {
                    castVoteButton.Enabled          = false;
                    castVoteButton.Text             = "Voted Already";
                    candidateSymbolComboBox.Enabled = false;
                }
                else
                {
                    List <ManageCandidate> candidatesList = new List <ManageCandidate>();
                    candidatesList = aCandidateManager.FillCombo();
                    candidateSymbolComboBox.DisplayMember = "CandidateSymbol";
                    candidateSymbolComboBox.DataSource    = candidatesList;
                }
            }
            else
            {
                castVoteButton.Text    = "SYSTEM IS OFFLINE";
                castVoteButton.Enabled = false;
                candidateSymbolComboBox.Hide();
            }
        }
Esempio n. 4
0
        private void deleteVoterButton_Click(object sender, EventArgs e)
        {
            if (deleteVoterTextBox.Text != "")
            {
                aManageVoter.DeleteVoter = deleteVoterTextBox.Text;
                VoterManager aVoterManager      = new VoterManager();
                bool         confirmDeleteVoter = aVoterManager.DeleteVoter(aManageVoter);

                if (confirmDeleteVoter)
                {
                    MessageBox.Show("Delete successfully");
                    deleteVoterTextBox.Clear();
                    LoadVoterGridView();
                }
                else
                {
                    MessageBox.Show("Can not be Deleted.\nError found while deleting the data.");
                }
            }
            else
            {
                MessageBox.Show("Empty field \nEnter Valid Voter ID to Delete");
            }
        }