Example #1
0
        //populate the group stats for the user
        private void populategroupNums()
        {
            GroupDB       gdb        = new GroupDB(db);
            List <int>    groupNums  = gdb.numineachgroup();
            List <string> groupNames = gdb.getgroupnames(); // use the correct group names set by the user

            GroupANum.Text = groupNames[0] + " : ";
            GroupBNum.Text = groupNames[1] + " : ";
            GroupCNum.Text = groupNames[2] + " : ";

            num1.Text = groupNums[0].ToString();
            Num2.Text = groupNums[1].ToString();
            Num3.Text = groupNums[2].ToString();

            if (groupNums[0] >= gdb.getANum())
            {
                num1.ForeColor = Color.Red;
            }
            else
            {
                num1.ForeColor = Color.LimeGreen;
            }
            if (groupNums[1] >= gdb.getBNum())
            {
                Num2.ForeColor = Color.Red;
            }
            else
            {
                Num2.ForeColor = Color.LimeGreen;
            }

            if (groupNums[2] >= gdb.getCNum())
            {
                Num3.ForeColor = Color.Red;
            }
            else
            {
                Num3.ForeColor = Color.LimeGreen;
            }
            StaffDB sdb = new StaffDB(db);

            StaffA.Text = groupNames[0] + " : " + sdb.countStaffbyid(1);
            StaffB.Text = groupNames[1] + " : " + sdb.countStaffbyid(2);
            StaffC.Text = groupNames[2] + " : " + sdb.countStaffbyid(3);
            List <Label> stafflabels = new List <Label>()
            {
                StaffA, StaffB, StaffC
            };
            int counter = 0;

            foreach (Label label in stafflabels)
            {
                counter++;
                if (sdb.countStaffbyid(counter) < 2)
                {
                    label.ForeColor = Color.Red;
                }
            }
        }
Example #2
0
        //setup the groups on load
        private void setGroups()
        {
            GroupDB       gdb        = new GroupDB(db);
            List <string> groupNames = gdb.getgroupnames();

            NameA.Text = groupNames[0];
            NameB.Text = groupNames[1];
            NameC.Text = groupNames[2];

            Anum.Value = gdb.getANum();
            bNum.Value = gdb.getBNum();
            cNum.Value = gdb.getCNum();
        }