/// <summary> /// 将系统功能列表(PTFunctions)数据,根据主键“编号(Id)”采用UPDATE操作更新到数据库中,并返回受影响的行数。 /// </summary> /// <param name="pTFunctions">系统功能列表(PTFunctions)实例对象</param> public static int Update(PTFunctions pTFunctions) { CheckValid(pTFunctions); return(DataAccess.Update(pTFunctions)); }
/// <summary> /// 对系统功能列表(PTFunctions)实例对象,进行数据有效性检查。 /// </summary> /// <param name="pTFunctions">系统功能列表(PTFunctions)实例对象</param> public static void CheckValid(PTFunctions pTFunctions) { #region 检查各属性是否符合空值约束 if (DataValid.IsNull(pTFunctions.Id)) { throw new CustomException("“编号”不能为空,请您确认输入是否正确。"); } if (DataValid.IsNull(pTFunctions.FatherNumber)) { throw new CustomException("“上级编号”不能为空,请您确认输入是否正确。"); } if (DataValid.IsNull(pTFunctions.FunctionName)) { throw new CustomException("“功能名称”不能为空,请您确认输入是否正确。"); } if (DataValid.IsNull(pTFunctions.StateId)) { throw new CustomException("“状态”不能为空,请您确认输入是否正确。"); } #endregion #region 检查字符串是否超出规定长度 if (DataValid.IsOutLength(pTFunctions.Id, 50)) { throw new CustomException("“编号”长度不能超过 50 个汉字或字符,请您确认输入是否正确。"); } if (DataValid.IsOutLength(pTFunctions.FatherNumber, 50)) { throw new CustomException("“上级编号”长度不能超过 50 个汉字或字符,请您确认输入是否正确。"); } if (DataValid.IsOutLength(pTFunctions.FunctionName, 50)) { throw new CustomException("“功能名称”长度不能超过 50 个汉字或字符,请您确认输入是否正确。"); } if (DataValid.IsOutLength(pTFunctions.FunctionTypeId, 50)) { throw new CustomException("“功能类型”编号长度不能超过 50 个汉字或字符,请您确认输入是否正确。"); } if (DataValid.IsOutLength(pTFunctions.FunctionPath, 50)) { throw new CustomException("“路径”长度不能超过 50 个汉字或字符,请您确认输入是否正确。"); } if (DataValid.IsOutLength(pTFunctions.Description, 500)) { throw new CustomException("“功能描述”长度不能超过 500 个汉字或字符,请您确认输入是否正确。"); } if (DataValid.IsOutLength(pTFunctions.StateId, 50)) { throw new CustomException("“状态”编号长度不能超过 50 个汉字或字符,请您确认输入是否正确。"); } if (DataValid.IsOutLength(pTFunctions.Alternate1, 50)) { throw new CustomException("“备用1”长度不能超过 50 个汉字或字符,请您确认输入是否正确。"); } if (DataValid.IsOutLength(pTFunctions.Alternate2, 50)) { throw new CustomException("“备用2”长度不能超过 50 个汉字或字符,请您确认输入是否正确。"); } if (DataValid.IsOutLength(pTFunctions.Alternate3, 50)) { throw new CustomException("“备用3”长度不能超过 50 个汉字或字符,请您确认输入是否正确。"); } if (DataValid.IsOutLength(pTFunctions.Alternate4, 500)) { throw new CustomException("“备用4”长度不能超过 500 个汉字或字符,请您确认输入是否正确。"); } if (DataValid.IsOutLength(pTFunctions.Alternate5, 500)) { throw new CustomException("“备用5”长度不能超过 500 个汉字或字符,请您确认输入是否正确。"); } #endregion }
/// <summary> /// 将系统功能列表(PTFunctions)数据,采用INSERT操作插入到数据库中,并返回受影响的行数。 /// </summary> /// <param name="pTFunctions">系统功能列表(PTFunctions)实例对象</param> public static int Insert(PTFunctions pTFunctions) { CheckValid(pTFunctions); return(DataAccess.Insert(pTFunctions)); }