I am trying to design an HR leave application system. I need to know how best I can try to implement the following requirement in the front-end, as well as how to persist data in the db so that I can handle validations dynamically. Here is a small example of how we'd go about validating whether the employee is eligible for a leave.
Suppose he/she is applying for "sick leave" this type of leave cannot come directly next day to a "casual leave". One cannot apply for casual leave if the day previous to which he/she is applying for was marked for sick leave. Once we have validated this, we need to validate against leave balances. Suppose the employee is a programmer; he/she can take a max of 1 sick leave per month (or salary cycle). The number of sick leaves one can take in one month is dependent on the employee's designation.
The above was a simple example. The rules can go complex, and numerous depending upon the employee designation. I am looking at persisting such rules in the database.(what structure/attributes would I need for this) AND also evaluating the rules dynamically in front-end code (C#) (what design patterns do I need for this)