Exemplo n.º 1
0
        // iterate through every candidate in the candidate table to determine if
        // candidate with the parameters (email and password) exists in the system
        public bool Login(string email, string password)
        {
            foreach (CandidateViewModel candidate in dataGatewayCandidate.SelectAll())
            {
                // candidate is found in the table, candidate login is valid
                if (candidate.Email.Equals(email) && candidate.Password.Equals(password))
                {
                    currentCandidate             = new Candidate();
                    currentCandidate.hasVoted    = candidate.HasVoted;
                    currentCandidate.candidateID = candidate.CandidateID;
                    return(true);
                }
            }

            // candidate is not found in the table, candidate login is NOT valid
            return(false);
        }
Exemplo n.º 2
0
 // empty constructor to initilize null singleton
 public CampaignDate()
 {
     foreach (CampaignDateViewModel campaign in dataGatewayCampaign.SelectAll())
     {
         startDate  = campaign.StartDate;
         endDate    = campaign.EndDate;
         campaignID = campaign.CampaignID;
     }
 }
Exemplo n.º 3
0
        // iterate through the Voter table to determine if Voter's login (email and password parameters)
        // are valid
        public bool Login(string email, string password)
        {
            foreach (VoterViewModel voter in dataGatewayVoter.SelectAll())
            {
                // Voter is found in the table, Voter's login is valid!
                if (voter.Email.Equals(email) && voter.Password.Equals(password))
                {
                    currentVoter          = new Voter();
                    currentVoter.voterID  = voter.VoterID;
                    currentVoter.hasVoted = voter.HasVoted;
                    return(true);
                }
            }

            // Voter is not found in the table, user's login is NOT valid!
            return(false);
        }
Exemplo n.º 4
0
        // valiate Admin's login
        public bool Login(string email, string password)
        {
            // iterate through every admin in the table
            foreach (AdminViewModel admin in dataGatewayAdmin.SelectAll())
            {
                // if email and password matches an Admin found in the table, admin's login is valid!
                if (admin.Email.Equals(email) && admin.Password.Equals(password))
                {
                    currentAdmin          = new Admin();
                    currentAdmin.hasVoted = admin.HasVoted;
                    currentAdmin.adminID  = admin.AdminID;
                    return(true);
                }
            }

            // else, admin's login is invalid!
            return(false);
        }
 public IEnumerable <CandidateProfileViewModel> ViewAllProfiles()
 {
     return(dataGatewayCandidateProfile.SelectAll());
 }
Exemplo n.º 6
0
 virtual public ActionResult Index(int?id)
 {
     return(View(dataGateway.SelectAll()));
 }
Exemplo n.º 7
0
 public IEnumerable <RalliesViewModel> ViewAllRallies()
 {
     return(dataGatewayRallies.SelectAll());
 }