Here is my code:
internal class RiskScore
{
public void attachCoordinates()
{
List<Coordinates> listOfCoords = new List<Coordinates>();
StringBuilder sb = new StringBuilder();
sb.Append("Improbable,Acceptable,1,Low$");
sb.Append("Improbable,Tolerable,4,Medium$");
sb.Append("Improbable,Undesirable,6,Medium$");
sb.Append("Improbable,Intolerable,10,High$");
sb.Append("Possible,Acceptable,2,Low$");
sb.Append("Possible,Tolerable,5,Medium$");
sb.Append("Possible,Undesirable,8,High$");
sb.Append("Possible,Intolerable,11,Extreme$");
sb.Append("Probable,Acceptable,3,Medium$");
sb.Append("Probable,Tolerable,7,High$");
sb.Append("Probable,Undesirable,9,High$");
sb.Append("Probable,Intolerable,12,Extreme");
string matrix = sb.ToString();
string[] EachMatrix = matrix.Split("$");
foreach (string eachmatrix in EachMatrix)
{
string[] EachValue = eachmatrix.Split(",");
Coordinates coord = new Coordinates
{
coordX = EachValue[0],
coordY = EachValue[1],
Riskvalue = EachValue[2],
RiskRatingKey = EachValue[3]
};
listOfCoords.Add(coord);
}
}
public string getRiskProbability(string riskvalue)
{
//should return coordX and coordY
return null;
}
public string getRiskValueandRiskRatingKey(string coordX, string coordY)
{
//should return Riskvalue and RiskRatingKey
return null;
}
}
public class Coordinates
{
public string coordX;
public string coordY;
public string Riskvalue;
public string RiskRatingKey;
}
This is to calculate Risk score and Risk Rating. for example If Risk Probablility is Improbable and Acceptable then the risk valueis 1 and the risk rating is Low. This is defined in the stringbuilder(sb).
I have put these values in a List<> Class.
My requirement is: a) If I give an input of 1(riskvalue) I need get the risk probablility which is (Improbable and acceptable) b)If I give the input in reverse ie., Improbable and acceptable I need the riskvalue and risk rating(low, medium, high).
Is this possible with this design?