public JsonResult dochangepass(string studentcode, string passwordnew, string passwordnewre) { int ret = 0; STUDENT_BUS bus = new STUDENT_BUS(); STUDENT_OBJ obj = bus.GetByID(new STUDENT_OBJ.BusinessObjectID(studentcode)); bus.CloseConnection(); if (obj == null) { ret = -1; } if (passwordnewre != passwordnew) { ret = -2; } if (ret >= 0) { //obj.USERNAME = obj.CODEVIEW; if (!string.IsNullOrEmpty(passwordnew)) { //Change the pass if input ret = bus.SetPass(obj, passwordnew); }//else keep the old pasword bus.CloseConnection(); } return(Json(new { ret = ret }, JsonRequestBehavior.AllowGet)); }