One of the reasons why affairs build in the office is because people with common skills and interests work together in departments and as they share their ideas in projects and assignments, they find themselves attracted to each other.
If one gets into an office relationship then a number of things ought to be dealt with. For example, if the relationship goes sour, how do you relate to each other? If the break up is very bad then maybe one of the parties can resign or request for a transfer to a different section of the company.
Another thing to consider is the ranks of the people involved in the affair. If a manager is involved with a junior staff then he/she should appoint others when it comes to appraising the staff to avoid being biased. It would also help to agree on the times when the colleagues having an affair get to meet on a social platform and when to focus on work otherwise it is very easy to nurture the relationship at the cost of the company.
If well managed, affairs at the office can flourish into happy marriages.