I want to know if we can post the versions based on events through coding.
How we do batch reconcile and post through c# code?
Is it possible for automatic replication also?
A quick search of the ArcGIS help site turned up a couple of items that might be of use to you.
The first item discusses Listening to Versioned Events
The next item discusses Reconciling versions
The general arguments for each of these include specifying the source version and the target version that the source will be reconciled against. Also, you specify the type of comparison, whether row or column level conflict detection. Finally, you have options to specify an action if a conflict is detected, whether to abort, or let the child version prevail.
In this code is also a clue that batch reconcile and post is possible:
To address your question about replication, here is the appropriate help topic from the ArcObjects SDk: Replication
I'm not going to attempt any detail in setting up a sample code process as my experience does not lie in C#. These links should at least point you in the correct direction if you have not already discovered them on your own.
I would encourage you to work on some code on your own, and if you have problems, post a new question here. A comment and suggestion for future questions would be to include as much detail as possible. If you have a workflow that you are trying to implement, describe that if you can, as someone may have already attempted something similar and may have a ready solution.