Need simple logic for this

process

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

I need detail explanation step by step

we will do once you have shared with us

didnt get you exactly what rules @ppr

Example:
status = pending AND code =203 => condition = C
and so on for the other cases, so that we can refer to it in total

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.

most probably will look like this:
image

Spelled out that clear it is almost trivial to then come up with what Peter has in mind.

2 Likes