Esempio n. 1
0
        private void voterSignInButton_Click(object sender, EventArgs e)
        {
            VoterLogin aVoterLogin = new VoterLogin();

            aVoterLogin.VoterID       = voterIDTextBox.Text;
            aVoterLogin.VoterPassword = voterPasswordTextBox.Text;

            if (voterIDTextBox.Text == "" || voterPasswordTextBox.Text == "")
            {
                MessageBox.Show("Please fill up required the field");
            }
            else
            {
                LoginManager aLoginManager        = new LoginManager();
                bool         voterLoginPermission = aLoginManager.GivePermitToVoterToLogin(aVoterLogin);
                if (voterLoginPermission)
                {
                    Hide();
                    CastVoteUI aCastVoteUi = new CastVoteUI(aVoterLogin.VoterID);
                    aCastVoteUi.Show();
                }
                else
                {
                    MessageBox.Show("Invalid username or password");
                }
            }
        }
Esempio n. 2
0
        public VoterLogin CheckVoterLoginInfo(string voterID, string voterPassword)
        {
            aSqlConnection.Open();
            string        query       = "SELECT * FROM t_voter WHERE voter_id = '" + voterID + "' and voter_password ='******' ";
            SqlCommand    aCommand    = new SqlCommand(query, aSqlConnection);
            SqlDataReader aReader     = aCommand.ExecuteReader();
            VoterLogin    aVoterLogin = new VoterLogin();

            while (aReader.Read())
            {
                aVoterLogin.VoterID       = aReader["voter_id"].ToString();
                aVoterLogin.VoterPassword = aReader["voter_password"].ToString();
            }
            aSqlConnection.Close();
            return(aVoterLogin);
        }
Esempio n. 3
0
        public bool GivePermitToVoterToLogin(DAL.DAO.VoterLogin aVoterLogin)
        {
            LoginGateway aLoginGateway = new LoginGateway();

            aLoginGateway.ConfirmConnection();
            VoterLogin bVoterLogin = new VoterLogin();

            bVoterLogin = aLoginGateway.CheckVoterLoginInfo(aVoterLogin.VoterID, aVoterLogin.VoterPassword);

            if (bVoterLogin.VoterID == aVoterLogin.VoterID && bVoterLogin.VoterPassword == aVoterLogin.VoterPassword)
            {
                return(true);
            }
            return(false);

            //bool permitMessage = aLoginGateway.CheckVoterLoginInfo(aVoterLogin);
            //return permitMessage;
        }