Esempio n. 1
0
 /// <summary>
 /// 将基础对象名称(YWAssignment)数据,根据主键“(Id)”采用UPDATE操作更新到数据库中,并返回受影响的行数。
 /// </summary>
 /// <param name="yWAssignment">基础对象名称(YWAssignment)实例对象</param>
 public static int Update(YWAssignment yWAssignment)
 {
     CheckValid(yWAssignment);
     return(DataAccess.Update(yWAssignment));
 }
Esempio n. 2
0
        /// <summary>
        /// 对基础对象名称(YWAssignment)实例对象,进行数据有效性检查。
        /// </summary>
        /// <param name="yWAssignment">基础对象名称(YWAssignment)实例对象</param>
        public static void CheckValid(YWAssignment yWAssignment)
        {
            #region 检查各属性是否符合空值约束
            if (DataValid.IsNull(yWAssignment.PlanId))
            {
                throw new CustomException("“”不能为空,请您确认输入是否正确。");
            }

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

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

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

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

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

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

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

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

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

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

            #endregion

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

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

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

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

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

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

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

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

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

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

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

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

            #endregion
        }
Esempio n. 3
0
 /// <summary>
 /// 将基础对象名称(YWAssignment)数据,采用INSERT操作插入到数据库中,并返回受影响的行数。
 /// </summary>
 /// <param name="yWAssignment">基础对象名称(YWAssignment)实例对象</param>
 public static int Insert(YWAssignment yWAssignment)
 {
     CheckValid(yWAssignment);
     return(DataAccess.Insert(yWAssignment));
 }