public JsonResult GetAllSubject(TranferObj obj) { TBSUBJECT_BUS bus = new TBSUBJECT_BUS(); string message = string.Empty; List <TBSUBJECT_OBJ> li = null; li = bus.getListByDepartmentCode(obj); bus.CloseConnection(); if (obj.semester != null) { message = "Danh sách môn học theo kỳ : " + obj.semester; } else if (obj.speciality != null) { message = "Danh sách môn học theo theo chuyên ngành"; } return(Json(new { data = li, //Danh sách message = message, ret = 0 //ok }, JsonRequestBehavior.AllowGet)); }
public List <TBSUBJECT_OBJ> getListByDepartmentCode(TranferObj obj) { List <TBSUBJECT_OBJ> lidata = new List <TBSUBJECT_OBJ>(); string sql = "GET_SUBJECT_BY_SPECIALITY"; SqlCommand cm = new SqlCommand(); cm.CommandText = sql; cm.CommandType = CommandType.StoredProcedure; cm.Parameters.AddWithValue("@specialitycode", obj.speciality == null ? "" : obj.speciality); cm.Parameters.AddWithValue("@semester", Convert.ToInt16(obj.semester)); cm.Parameters.AddWithValue("@leveleducation", obj.leveleducation); DataSet ds = new DataSet(); int ret = db.getCommand(ref ds, "Tmp", cm); if (ret < 0) { return(null); } else { lidata = FillToOBJ(ds); } return(lidata); }