Exemple #1
0
        /// <summary>
        /// 对提示消息类型(码表)(NoticeType)实例对象,进行数据有效性检查。
        /// </summary>
        /// <param name="noticeType">提示消息类型(码表)(NoticeType)实例对象</param>
        public static void CheckValid(PTNoticeType noticeType)
        {
            #region 检查各属性是否符合空值约束
            if (DataValid.IsNull(noticeType.Id))
            {
                throw new CustomException("“编号”不能为空,请您确认输入是否正确。");
            }

            if (DataValid.IsNull(noticeType.Name))
            {
                throw new CustomException("“名称”不能为空,请您确认输入是否正确。");
            }

            #endregion

            #region 检查字符串是否超出规定长度
            if (DataValid.IsOutLength(noticeType.Id, 50))
            {
                throw new CustomException("“编号”长度不能超过 50 个汉字或字符,请您确认输入是否正确。");
            }

            if (DataValid.IsOutLength(noticeType.Name, 50))
            {
                throw new CustomException("“名称”长度不能超过 50 个汉字或字符,请您确认输入是否正确。");
            }

            if (DataValid.IsOutLength(noticeType.Description, 50))
            {
                throw new CustomException("“描述”长度不能超过 50 个汉字或字符,请您确认输入是否正确。");
            }

            #endregion
        }
Exemple #2
0
 /// <summary>
 /// 将提示消息类型(码表)(NoticeType)数据,根据主键“编号(Id)”采用UPDATE操作更新到数据库中,并返回受影响的行数。
 /// </summary>
 /// <param name="noticeType">提示消息类型(码表)(NoticeType)实例对象</param>
 public static int Update(PTNoticeType noticeType)
 {
     CheckValid(noticeType);
     return(DataAccess.Update(noticeType));
 }
Exemple #3
0
 /// <summary>
 /// 将提示消息类型(码表)(NoticeType)数据,采用INSERT操作插入到数据库中,并返回受影响的行数。
 /// </summary>
 /// <param name="noticeType">提示消息类型(码表)(NoticeType)实例对象</param>
 public static int Insert(PTNoticeType noticeType)
 {
     CheckValid(noticeType);
     return(DataAccess.Insert(noticeType));
 }