Exemplo n.º 1
0
        public List<Candidate> loadAuditors()
        {
            //get id of candidate whose Position is president
            List<double> pres_can_ids = new List<double>();
            List<Candidate> ret_val = new List<Candidate>();
            string sql = "SELECT * FROM `aclcsscvotingsystem`.`tbl_position` " +
                         "WHERE pos_name='Auditor';";
            double auditor_id = 0d;
            GLOBAL_VARS.db.execute(sql);
            if (GLOBAL_VARS.db.reader.HasRows)
            {
                GLOBAL_VARS.db.reader.Read();
                auditor_id = Convert.ToDouble(GLOBAL_VARS.db.reader["pos_id"].ToString());
            }
            GLOBAL_VARS.db.reader.Close();

            //load all presidents candidate
            sql = "SELECT * FROM `aclcsscvotingsystem`.`tbl_candidate` " +
                  "WHERE pos_id=" + auditor_id + " ORDER BY pty_id ASC;";
            GLOBAL_VARS.db.execute(sql);
            if (GLOBAL_VARS.db.reader.HasRows)
            {
                while (GLOBAL_VARS.db.reader.Read())
                {
                    pres_can_ids.Add(Convert.ToDouble(GLOBAL_VARS.db.reader["can_id"].ToString()));
                }
            }
            GLOBAL_VARS.db.reader.Close();

            //loop and load then return list of President Candidate object
            foreach (double pres_can_id in pres_can_ids)
            {
                Candidate c = new Candidate();
                c.loadCandidate(pres_can_id);
                ret_val.Add(c);
            }
            return ret_val;
        }
Exemplo n.º 2
0
        private void frmBallot_Load(object sender, EventArgs e)
        {
            this.Location = new Point(this.Left, 0);
            Candidate can;
            List<Candidate> presidents = new List<Candidate>();
            List<Candidate> vpresidents = new List<Candidate>();
            List<Candidate> secretaries = new List<Candidate>();
            List<Candidate> auditors = new List<Candidate>();
            List<Candidate> treasurers = new List<Candidate>();
            List<Candidate> senators = new List<Candidate>();
            List<Candidate> representatives = new List<Candidate>();

            //presidents
            can = new Candidate();
            presidents = can.loadPresidents();
            Candidate p1 = presidents[0];
            rbPres1.Text = p1.s.lname + ", " + p1.s.fname + " " + p1.s.mname + ".";
            lblPress1.Text = p1.pty.pty_name;
            presidentSal.ImageLocation = @"C:\Users\rodz\Desktop\images\" + p1.img.img_image;

            Candidate p2 = presidents[1];
            rbPres2.Text = p2.s.lname + ", " + p2.s.fname + " " + p2.s.mname + ".";
            lblPres2.Text = p2.pty.pty_name;
            prisedentSiam.ImageLocation = @"C:\Users\rodz\Desktop\images\" + p2.img.img_image;

            //vice presidents
            can = new Candidate();
            vpresidents = can.loadVicePresidents();
            Candidate vp1 = vpresidents[0];
            rbVpres1.Text = vp1.s.lname + ", " + vp1.s.fname + " " + vp1.s.mname + ".";
            lblVpres1.Text = vp1.pty.pty_name;
            vpresidentSal.ImageLocation = @"C:\Users\rodz\Desktop\images\" + vp1.img.img_image;

            Candidate vp2 = vpresidents[1];
            rbVpres2.Text = vp2.s.lname + ", " + vp2.s.fname + " " + vp2.s.mname + ".";
            lblVpres2.Text = vp2.pty.pty_name;
            vpresidentSiam.ImageLocation = @"C:\Users\rodz\Desktop\images\" + vp2.img.img_image;

            //auditor
            can = new Candidate();
            auditors = can.loadAuditors();
            Candidate au1 = auditors[0];
            rbAuditor1.Text = au1.s.lname + ", " + au1.s.fname + " " + au1.s.mname + ".";
            lblAuditor1.Text = au1.pty.pty_name;
            auditorSal.ImageLocation = @"C:\Users\rodz\Desktop\images\" + au1.img.img_image;

            Candidate au2 = auditors[1];
            rbAuditor2.Text = au2.s.lname + ", " + au2.s.fname + " " + au2.s.mname + ".";
            lblAuditor2.Text = au2.pty.pty_name;
            auditorSiam.ImageLocation = @"C:\Users\rodz\Desktop\images\" + au2.img.img_image;

            //secretary
            can = new Candidate();
            secretaries = can.loadSecretaries();
            Candidate sec1 = secretaries[0];
            rbSecretary1.Text = sec1.s.lname + ", " + sec1.s.fname + " " + sec1.s.mname + ".";
            lblSecretary1.Text = sec1.pty.pty_name;
            secretarySal.ImageLocation = @"C:\Users\rodz\Desktop\images\" + sec1.img.img_image;

            Candidate sec2 = secretaries[1];
            rbSecretary2.Text = sec2.s.lname + ", " + sec2.s.fname + " " + sec2.s.mname + ".";
            lblSecretary2.Text = sec2.pty.pty_name;
            secretarySiam.ImageLocation = @"C:\Users\rodz\Desktop\images\" + sec2.img.img_image;

            //treasurer
            can = new Candidate();
            treasurers = can.loadTreasurers();
            Candidate tres1 = treasurers[0];
            rbTreasurer1.Text = tres1.s.lname + ", " + tres1.s.fname + " " + tres1.s.mname + ".";
            lblTreasurer1.Text = tres1.pty.pty_name;
            treasurerSal.ImageLocation = @"C:\Users\rodz\Desktop\images\" + tres1.img.img_image;

            Candidate tres2 = treasurers[1];
            rbTreasurer2.Text = tres2.s.lname + ", " + tres2.s.fname + " " + tres2.s.mname + ".";
            lblTreasurer2.Text = tres2.pty.pty_name;
            treasurerSiam.ImageLocation = @"C:\Users\rodz\Desktop\images\" + tres2.img.img_image;

            //senators
            can = new Candidate();
            senators = can.loadSenators();
            Candidate salSenator1 = senators[0];
            chkSalSen1.Text = salSenator1.s.lname + ", " + salSenator1.s.fname + " " + salSenator1.s.mname + ".";
            lblSalSen1.Text = salSenator1.pty.pty_name;
            senatorSal1.ImageLocation = @"C:\Users\rodz\Desktop\images\" + salSenator1.img.img_image;

            Candidate salSenator2= senators[1];
            chkSalSen2.Text = salSenator2.s.lname + ", " + salSenator2.s.fname + " " + salSenator2.s.mname + ".";
            lblSalSen2.Text = salSenator2.pty.pty_name;
            senatorSal2.ImageLocation = @"C:\Users\rodz\Desktop\images\" + salSenator2.img.img_image;

            Candidate salSenator3 = senators[2];
            chkSalSen3.Text = salSenator3.s.lname + ", " + salSenator3.s.fname + " " + salSenator3.s.mname + ".";
            lblSalSen3.Text = salSenator3.pty.pty_name;
            senatorSal3.ImageLocation = @"C:\Users\rodz\Desktop\images\" + salSenator3.img.img_image;

            Candidate salSenator4 = senators[3];
            chkSalSen4.Text = salSenator4.s.lname + ", " + salSenator4.s.fname + " " + salSenator4.s.mname + ".";
            lblSalSen4.Text = salSenator4.pty.pty_name;
            senatorSal4.ImageLocation = @"C:\Users\rodz\Desktop\images\" + salSenator4.img.img_image;

            Candidate salSenator5 = senators[4];
            chkSalSen5.Text = salSenator5.s.lname + ", " + salSenator5.s.fname + " " + salSenator5.s.mname + ".";
            lblSalSen5.Text = salSenator5.pty.pty_name;
            senatorSal5.ImageLocation = @"C:\Users\rodz\Desktop\images\" + salSenator5.img.img_image;

            Candidate salSenator6 = senators[5];
            chkSalSen6.Text = salSenator6.s.lname + ", " + salSenator6.s.fname + " " + salSenator6.s.mname + ".";
            lblSalSen6.Text = salSenator6.pty.pty_name;
            senatorSal6.ImageLocation = @"C:\Users\rodz\Desktop\images\" + salSenator6.img.img_image;

            //============================================ start of siam senators ======================================
            Candidate siamSenator1 = senators[6];
            chkSiamSen1.Text = siamSenator1.s.lname + ", " + siamSenator1.s.fname + " " + siamSenator1.s.mname + ".";
            lblSiamSen1.Text = siamSenator1.pty.pty_name;
            senatorSiam1.ImageLocation = @"C:\Users\rodz\Desktop\images\" + siamSenator1.img.img_image;

            Candidate siamSenator2 = senators[7];
            chkSiamSen2.Text = siamSenator2.s.lname + ", " + siamSenator2.s.fname + " " + siamSenator2.s.mname + ".";
            lblSiamSen2.Text = siamSenator2.pty.pty_name;
            senatorSiam2.ImageLocation = @"C:\Users\rodz\Desktop\images\" + siamSenator2.img.img_image;

            Candidate siamSenator3 = senators[8];
            chkSiamSen3.Text = siamSenator3.s.lname + ", " + siamSenator3.s.fname + " " + siamSenator3.s.mname + ".";
            lblSiamSen3.Text = siamSenator3.pty.pty_name;
            senatorSiam3.ImageLocation = @"C:\Users\rodz\Desktop\images\" + siamSenator3.img.img_image;

            Candidate siamSenator4 = senators[9];
            chkSiamSen4.Text = siamSenator4.s.lname + ", " + siamSenator4.s.fname + " " + siamSenator4.s.mname + ".";
            lblSiamSen4.Text = siamSenator4.pty.pty_name;
            senatorSiam4.ImageLocation = @"C:\Users\rodz\Desktop\images\" + siamSenator4.img.img_image;

            Candidate siamSenator5 = senators[10];
            chkSiamSen5.Text = siamSenator5.s.lname + ", " + siamSenator5.s.fname + " " + siamSenator5.s.mname + ".";
            lblSiamSen5.Text = siamSenator5.pty.pty_name;
            senatorSiam5.ImageLocation = @"C:\Users\rodz\Desktop\images\" + siamSenator5.img.img_image;

            Candidate siamSenator6 = senators[11];
            chkSiamSen6.Text = siamSenator6.s.lname + ", " + siamSenator6.s.fname + " " + siamSenator6.s.mname + ".";
            lblSiamSen6.Text = siamSenator6.pty.pty_name;
            senatorSiam6.ImageLocation = @"C:\Users\rodz\Desktop\images\" + siamSenator6.img.img_image;
        }