Unified primal formulation-based a priori and a posteriori error analysis of mixed finite element methods