Hope you guys can give me some good suggestions. I think how to create a good architecture for developing C #. I try to explain the scripts because they don't like English:
1) Two classes: Blue Bank and Red Bank
2) Third class: Validation rules
3) Blue and red banks have several fields (values), such as AccountNumber, Amount, InvoicePeriod, etc. Example here (xml):
Blue bank
<AccountNumber>Maria 5987593457</AccountNumber> <Amount>200.00</Amount> <InvoicePeriod>1</InvoicePeriod>
Red bank
<AccountNumber>8529458</AccountNumber> <Amount>300.00</Amount> <InvoicePeriod>0</InvoicePeriod>
Red / Blue banks have the same validation rules, such as sums of fields that must be numerical. But Red / Blue Banks has different validation rules - the AccountNumber field must be alphanumeric in Blue Bank, while the AccountNumber must be numeric in Red Bank otherwise. The InvoicePeriod field should be the default 1 in Red Bank, while it should be the default 0 in Blue Bank otherwise.
My idea:
I want to create each Red / Blue Bank class for different verification rules, and then I also create verification class rules for the same rules as the Blue / Red banks.
My code is here:
Blue Bank Class:
- Confirm account number, which must be alphanumeric otherwise
- Check InvoicePeriod, which should be the default of 1 otherwise failed
Red Bank Class:
- Confirm the account number, which otherwise must be numbered.
- Check InvoicePeriod, which should be the default 0 otherwise failed
RulesOfValidation class
- Confirm the amount, which should be numbered (the same rules for the Red / Blue Bank classes)
How does this work with the dictator <,> with these classes? Or any better suggestion with code examples?
Your help would be greatly appreciated.
source share