1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
-
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Linq;
- using System.Reflection;
- using System.Text;
- using System.Threading.Tasks;
- namespace NXWMS.Code.Verifications
- {
- /// <summary>
- /// 字符串验证
- /// </summary>
- public static class UtilCheckString
- {
- /// <summary>
- /// 获取动态参数空结果处理
- /// </summary>
- /// <param name="paramArray"></param>
- /// <returns></returns>
- public static bool GetDynamicParmaValidateResult(params object[] paramArray)
- {
- foreach (var item in paramArray)
- {
- if (string.IsNullOrWhiteSpace(item.ToString()))
- {
- return false;
- }
- }
- return true;
- }
- /// <summary>
- /// 获取动态参数空结果处理T
- /// </summary>
- /// <typeparam name="T"></typeparam>
- /// <param name="data"></param>
- /// <returns></returns>
- public static bool GetDynamicParmaValidateResult<T>(T data) where T : class
- {
- var props = typeof(T).GetProperties();
- foreach (PropertyInfo detail in props)
- {
- if (props.Where(m => string.IsNullOrWhiteSpace(m.ToString())).Count() > 0)
- {
- return false;
- }
- }
- return true;
- }
- }
- }
|