Esempio n. 1
0
        /// <summary>
        /// 判断清单是否规范
        /// </summary>
        /// <param name="list">待判断清单</param>
        /// <param name="errorMsg">错误信息</param>
        /// <returns>是否规范</returns>
        public static bool isNormative(InterviewList list, ref List <string> errorMsg)
        {
            List <string> errorList = new List <string>();

            if (list.Id < 0)
            {
                errorList.Add("Id 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.SubscriptionNum <= 0)
            {
                errorList.Add("SubscriptionNum Error");
            }
            if (list.PublishingHouseId <= 0)
            {
                errorList.Add("PublishingHouseId Error");
            }
            Match matchDocumentType = Regex.Match(list.DocumentType, @"^(期刊|专著|论文|电子文献|专利)$");

            if (!matchDocumentType.Success)
            {
                errorList.Add("DocumentType Error");
            }
            Match matchOrderStatus = Regex.Match(list.OrderStatus, @"^(采访|验收)$");

            if (!matchOrderStatus.Success)
            {
                errorList.Add("OrderStatus Error");
            }
            errorMsg = errorList;
            if (errorList.Count > 0)
            {
                return(false);
            }
            return(true);
        }
Esempio n. 2
0
 /// <summary>
 /// 判断清单是否有空项
 /// </summary>
 /// <param name="list">待判断清单</param>
 /// <returns>是否有空项</returns>
 public static bool isNull(InterviewList list)
 {
     if (list.ISBN == "")
     {
         return(true);
     }
     if (list.Author == "")
     {
         return(true);
     }
     if (list.BookName == "")
     {
         return(true);
     }
     if (list.Price == 0)
     {
         return(true);
     }
     if (list.CurrencyType == "")
     {
         return(true);
     }
     if (list.SubscriptionNum == 0)
     {
         return(true);
     }
     if (list.PublishingHouseId == 0)
     {
         return(true);
     }
     if (list.DocumentType == "")
     {
         return(true);
     }
     if (list.OrderStatus == "")
     {
         return(true);
     }
     return(false);
 }