Created
January 13, 2011 21:31
-
-
Save postnati/778653 to your computer and use it in GitHub Desktop.
Survey Scoring Code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int points = 0; | |
int unpoints = 0; | |
RadioButton[] radiolist = new RadioButton[] { RadioButton11, RadioButton12, RadioButton13, RadioButton14, RadioButton15, RadioButton21, RadioButton22, RadioButton23, RadioButton24, RadioButton25, RadioButton31, RadioButton32, RadioButton33, RadioButton34, RadioButton35, RadioButton51, RadioButton52, RadioButton53, RadioButton54, RadioButton55, RadioButton71, RadioButton72, RadioButton73, RadioButton74, RadioButton75, RadioButton81, RadioButton82, RadioButton83, RadioButton84, RadioButton85, RadioButton91, RadioButton92, RadioButton93, RadioButton94, RadioButton95, RadioButton101, RadioButton102, RadioButton103, RadioButton104, RadioButton105, RadioButton121, RadioButton122, RadioButton123, RadioButton124, RadioButton125 }; | |
for (int i = 0; i < radiolist.Length; i++) | |
{ | |
if (i % 5 == 0 && radiolist[i].Checked) | |
unpoints += 1; | |
if (i % 5 == 1 && radiolist[i].Checked) | |
unpoints += 1; | |
//if (i % 5 == 2 && radiolist[i].Checked) | |
// points += 3; | |
if (i % 5 == 3 && radiolist[i].Checked) | |
points += 1; | |
if (i % 5 == 4 && radiolist[i].Checked) | |
points += 1; | |
} | |
RadioButton[] unradiolist = new RadioButton[] { | |
RadioButton41, RadioButton42, RadioButton43,RadioButton44, RadioButton45, | |
RadioButton61, RadioButton62, RadioButton63, RadioButton64, RadioButton65, | |
RadioButton111, RadioButton112, RadioButton113, RadioButton114, RadioButton115 | |
}; | |
for (int i = 0; i < unradiolist.Length; i++) | |
{ | |
if (i % 5 == 0 && unradiolist[i].Checked) | |
points += 1; | |
if (i % 5 == 1 && unradiolist[i].Checked) | |
points += 1; | |
//if (i % 5 == 2 && unradiolist[i].Checked) | |
// points += 3; | |
if (i % 5 == 3 && unradiolist[i].Checked) | |
unpoints += 1; | |
if (i % 5 == 4 && unradiolist[i].Checked) | |
unpoints += 1; | |
} | |
string averFavorable = (points / 12.0).ToString("#,###.##"); | |
string averUnFavorable = (unpoints / 12.0).ToString("#,###.##"); | |
emailBody = emailBody.Replace("#FAVORABLE#", "Average Favorable Score: " + averFavorable); | |
emailBody = emailBody.Replace("#UNFAVORABLE#", "Average Unfavorable Score: " + averUnFavorable); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment