/// <summary> /// 判断记录是否规范 /// </summary> /// <param name="log">待判断记录</param> /// <param name="errorMsg">错误信息</param> /// <returns>是否规范</returns> public static bool isNormative(BookAppointLog log, ref List <string> errorMsg) { List <string> errorlog = new List <string>(); if (log.ReaderId <= 0) { errorlog.Add("ReaderId Error"); } if (log.BookId <= 0) { errorlog.Add("BookId Error"); } Match matchState = Regex.Match(log.State, @"^(有效|失效)$"); if (!matchState.Success) { errorlog.Add("State Error"); } errorMsg = errorlog; if (errorlog.Count > 0) { return(false); } return(true); }
/// <summary> /// 判断记录是否有空项 /// </summary> /// <param name="log">待判断记录</param> /// <returns>是否有空项</returns> public static bool isNull(BookAppointLog log) { if (log.ReaderId == 0) { return(true); } if (log.BookId == 0) { return(true); } if (string.IsNullOrEmpty(log.State)) { return(true); } return(false); }