Construction of a Class of Algebraic-Geometric Codes via Grobner Bases