/// <summary> /// 判断清单是否规范 /// </summary> /// <param name="list">待判断清单</param> /// <param name="errorMsg">错误信息</param> /// <returns>是否规范</returns> public static bool isNormative(InterviewReturnList list, ref List <string> errorMsg) { List <string> errorList = new List <string>(); if (list.OrdererId <= 0) { errorList.Add("OrdererId Error"); } Match matchISBN = Regex.Match(list.ISBN, @"^(\d{10})$"); if (!matchISBN.Success) { errorList.Add("ISBN Error"); } if (list.Price <= 0) { errorList.Add("Price Error"); } if (list.PublishingHouseId <= 0) { errorList.Add("PublishingHouseId Error"); } Match matchDocumentType = Regex.Match(list.DocumentType, @"^(期刊|专著|论文|电子文献|专利)$"); if (!matchDocumentType.Success) { errorList.Add("DocumentType Error"); } errorMsg = errorList; if (errorList.Count > 0) { return(false); } return(true); }
/// <summary> /// 判断清单是否有空项 /// </summary> /// <param name="list">待判断清单</param> /// <returns>是否有空项</returns> public static bool isNull(InterviewReturnList list) { if (list.ISBN == "") { return(true); } if (list.OrdererId == 0) { return(true); } if (list.BookName == "") { return(true); } if (list.Price == 0) { return(true); } if (list.PublishingHouseId == 0) { return(true); } if (list.DocumentType == "") { return(true); } return(false); }