A comprehensive two- and three-dimensional framework for the electrohydrodynamic simulation of deformable capsules is provided. The role of a direct current (DC) electric field on the deformation and orientation of a liquid-filled capsule is thoroughly considered numerically. This framework is based on lattice Boltzmann method for the fluid, finite element method for the membrane structure of the capsule, fast immersed interface method for the electric field and immersed boundary method being used to consider the fluid-structure-electric interaction. Under the effect of electric field, two different types of equilibrium states, prolate or oblate are obtained. The numerical algorithm is also applied to study the interfacial tension droplet and red blood cell under shear flow. The capsules are more deformed and arrive at equilibrium status more quickly under stronger electric field. Bending stiffness will suppress the deformation and cause transition from tank-treading to tumbling for the red blood cell. However, the applied electric field will slow down the transition from tank-treading to the tumbling motion or even stay in the tank-treading motion with stronger electric field.