/// <summary> /// 调用存储过程增加一个 /// </summary> /// <param name="info">实体对象</param> /// <returns>正常返回大于 0 的自增id, 0代表重复,否则返回-1</returns> public static int edu_gradeAdd(Entity.edu_grade info) { SqlParameter[] prams = { SqlDB.MakeInParam("@name", SqlDbType.NVarChar, 64, info.name), SqlDB.MakeInParam("@code", SqlDbType.Char, 2, info.code), SqlDB.MakeInParam("@grade_index", SqlDbType.Int, 4, info.grade_index), SqlDB.MakeInParam("@display_flag", SqlDbType.Int, 4, info.display_flag), SqlDB.MakeInParam("@section_id", SqlDbType.Int, 4, info.section_id), }; return(Basic.Utils.StrToInt(SqlDB.ExecuteScalar(strCon, CommandType.StoredProcedure, "edu_gradeAdd", prams).ToString(), -1)); }
/// <summary> /// 获取某一个实体 /// </summary> /// <param name="id">标识</param> /// <returns>返回Entity</returns> public static Entity.edu_grade edu_gradeEntityGet(int id) { Entity.edu_grade info = new Entity.edu_grade(); DataTable dt = SqlDB.ExecuteDataset(strCon, CommandType.Text, "SELECT * FROM [edu_grade] WHERE id = " + id + ";").Tables[0]; if (dt.Rows.Count > 0) { info.id = Basic.Utils.StrToInt(dt.Rows[0]["id"].ToString(), 0); info.name = dt.Rows[0]["name"].ToString(); info.code = dt.Rows[0]["code"].ToString(); info.grade_index = Basic.Utils.StrToInt(dt.Rows[0]["grade_index"].ToString(), 0); info.display_flag = Basic.Utils.StrToInt(dt.Rows[0]["display_flag"].ToString(), 0); info.section_id = Basic.Utils.StrToInt(dt.Rows[0]["section_id"].ToString(), 0); } return(info); }
/// <summary> /// 调用存储过程修改一个 /// </summary> /// <param name="info">实体对象</param> /// <returns>更新成功返回ture,否则返回false</returns> public static bool edu_gradeEdit(Entity.edu_grade info) { SqlParameter[] prams = { SqlDB.MakeInParam("@id", SqlDbType.Int, 4, info.id), SqlDB.MakeInParam("@name", SqlDbType.NVarChar, 64, info.name), SqlDB.MakeInParam("@code", SqlDbType.Char, 2, info.code), SqlDB.MakeInParam("@grade_index", SqlDbType.Int, 4, info.grade_index), SqlDB.MakeInParam("@display_flag", SqlDbType.Int, 4, info.display_flag), SqlDB.MakeInParam("@section_id", SqlDbType.Int, 4, info.section_id), }; int intReturnValue = 0; intReturnValue = SqlDB.ExecuteNonQuery(strCon, CommandType.StoredProcedure, "edu_gradeEdit", prams); if (intReturnValue == 1) { return(true); } return(false); }