Pho3nix
The Legend
Hi,
Think the code below is a tad bloated.
Thoughts on making it a little more streamlined and easier to read?
PS. Don't rage about the variable names and the like,please. This is still in sublime and not in any solution
Enums are available for the riskCategory and QuestionTypes, just can't refer back to those properly in Sublime.
Think the code below is a tad bloated.
Thoughts on making it a little more streamlined and easier to read?
PS. Don't rage about the variable names and the like,please. This is still in sublime and not in any solution
Enums are available for the riskCategory and QuestionTypes, just can't refer back to those properly in Sublime.
Code:
foreach (var i in ruleScoringList)
{
if(i.riskCategory == "1")
{
if(i.questionType == "1")
{
if(i.ruleValue == "Yes")
{
rule1 = false;
}
}
}
if(i.riskCategory == "7")
{
if(i.questionType == "1")
{
if(i.ruleValue == "Yes")
{
rule1 = false;
}
}
if(i.questionType == "2")
{
switch(i.ruleValue)
{
case "None":
valRule2 = valRule2 + 0;
break;
case "Low"
valRule2 = valRule2 + 1;
break;
case "Medium"
valRule2 = valRule2 +2;
break;
case "High"
valRule2 = valRule2 +3;
}
}
}
if(i.riskCategory == "10")
{
if(i.questionType == "1")
{
if(i.ruleValue == "Yes")
{
rule1 = false;
}
}
if(i.questionType == "2")
{
switch(i.ruleValue)
{
case "None":
valRule3 = valRule3 + 0;
break;
case "Low"
valRule3 = valRule3 + 1;
break;
case "Medium"
valRule3 = valRule3 +2;
break;
case "High"
valRule3 = valRule3 +3;
}
}
}
if(i.riskCategory == "11")
{
if(i.questionType == "1")
{
if(i.ruleValue == "Yes")
{
rule1 = false;
}
}
if(i.questionType == "2")
{
switch(i.ruleValue)
{
case "None":
valRule4 = valRule4 + 0;
break;
case "Low"
valRule4 = valRule4 + 1;
break;
case "Medium"
valRule4 = valRule4 +2;
break;
case "High"
valRule4 = valRule4 +3;
}
}
}