Example #1
0
        /// <summary>
        /// 判断记录是否规范
        /// </summary>
        /// <param name="log">待判断记录</param>
        /// <param name="errorMsg">错误信息</param>
        /// <returns>是否规范</returns>
        public static bool isNormative(BookDamageLog log, ref List <string> errorMsg)
        {
            List <string> errorlog = new List <string>();

            if (log.BookId == 0)
            {
                errorlog.Add("BookId Error");
            }
            if (log.CheckerId == 0)
            {
                errorlog.Add("CheckerId Error");
            }
            Match matchDamageDetail = Regex.Match(log.DamageDetail, @"^(.*)$");

            if (!matchDamageDetail.Success)
            {
                errorlog.Add("DamageDetail Error");
            }
            Match matchRepairState = Regex.Match(log.RepairState, @"^(已修复|待修复|修复失败)$");

            if (!matchRepairState.Success)
            {
                errorlog.Add("RepairState Error");
            }
            errorMsg = errorlog;
            if (errorlog.Count > 0)
            {
                return(false);
            }
            return(true);
        }
Example #2
0
 /// <summary>
 /// 判断记录是否有空项
 /// </summary>
 /// <param name="log">待判断记录</param>
 /// <returns>是否有空项</returns>
 public static bool isNull(BookDamageLog log)
 {
     if (log.BookId == 0)
     {
         return(true);
     }
     if (log.CheckerId == 0)
     {
         return(true);
     }
     if (string.IsNullOrEmpty(log.DamageDetail))
     {
         return(true);
     }
     if (string.IsNullOrEmpty(log.RepairState))
     {
         return(true);
     }
     return(false);
 }