first I should check the status of the code and status be like pending, connected, canceled, suspended.(if we are getting the suspended or canceled should through an exception )
and the codes be like 201,202,203,204 and (also so another codes are there like 301 and 302 if we are getting the 301or 302 we should through the an error)
based on the code and based on the status we will take the conditions the condition be like A,B,C,D.
SAMPLE
ex 1 : status is pending and code is 203 and condition is C
ex 2 :status is connected and code is 202 and condition is A
ex 3 : status is pending and code Is 202 and condition is A
.
.
.
.
.
When concatenating Status (as string) and the Code (as String) e.g. “PENDING#203” the a dictionary can help where “PENDING#203” is the key and C is the value
This lookup dictionary can be manually created ot with the help of a config datatable which will be used for dynamic generating the lookup dictionary
Maybe you can list down all rules. Maybe we can also optimize by wildcarting some codes. For such approaches also Regex and Regex Group name concepts can help
When Peter asks for the rules you can maybe express them in a tabular fashion like here in an example of mine: I needed 2 rules/conditions “MailTo” and “MailCc” (first column).
Then I listed all requirements in the other columns – replace with your elements.