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