/// <summary> /// 对功能类型(码表)(PTFunctionType)实例对象,进行数据有效性检查。 /// </summary> /// <param name="functionType">功能类型(码表)(PTFunctionType)实例对象</param> public static void CheckValid(PTFunctionType pTFunctionType) { #region 检查各属性是否符合空值约束 if (DataValid.IsNull(pTFunctionType.Id)) { throw new CustomException("“编号”不能为空,请您确认输入是否正确。"); } if (DataValid.IsNull(pTFunctionType.Name)) { throw new CustomException("“名称”不能为空,请您确认输入是否正确。"); } #endregion #region 检查字符串是否超出规定长度 if (DataValid.IsOutLength(pTFunctionType.Id, 50)) { throw new CustomException("“编号”长度不能超过 50 个汉字或字符,请您确认输入是否正确。"); } if (DataValid.IsOutLength(pTFunctionType.Name, 50)) { throw new CustomException("“名称”长度不能超过 50 个汉字或字符,请您确认输入是否正确。"); } if (DataValid.IsOutLength(pTFunctionType.Description, 500)) { throw new CustomException("“描述”长度不能超过 500 个汉字或字符,请您确认输入是否正确。"); } #endregion }
/// <summary> /// 将功能类型(码表)(PTFunctionType)数据,根据主键“编号(Id)”采用UPDATE操作更新到数据库中,并返回受影响的行数。 /// </summary> /// <param name="functionType">功能类型(码表)(PTFunctionType)实例对象</param> public static int Update(PTFunctionType pTFunctionType) { CheckValid(pTFunctionType); return(DataAccess.Update(pTFunctionType)); }
/// <summary> /// 将功能类型(码表)(PTFunctionType)数据,采用INSERT操作插入到数据库中,并返回受影响的行数。 /// </summary> /// <param name="functionType">功能类型(码表)(PTFunctionType)实例对象</param> public static int Insert(PTFunctionType pTFunctionType) { CheckValid(pTFunctionType); return(DataAccess.Insert(pTFunctionType)); }