コード例 #1
0
        /// <summary>
        /// 判断列表是否有空项
        /// </summary>
        /// <param name="list">待判断列表</param>
        /// <returns>是否有空项</returns>
        public static bool isNull(CreateCatalogList list)
        {
            if (list.ISBN == "")
            {
                return(true);
            }
            if (list.CatalogerId == 0)
            {
                return(true);
            }
            if (list.PositiveTitle == "")
            {
                return(true);
            }
            if (list.FirstAuthor == "")
            {
                return(true);
            }
            if (list.PublishingHouseId == 0)
            {
                return(true);
            }
            if (list.DocumentType == "")
            {
                return(true);
            }
            if (list.PrimaryLiability == "")
            {
                return(true);
            }

            return(false);
        }
コード例 #2
0
        /// <summary>
        /// 判断编目是否规范
        /// </summary>
        /// <param name="list">待判断订单</param>
        /// <param name="errorMsg">错误信息</param>
        /// <returns>是否规范</returns>

        public static bool isNormative(CreateCatalogList list, ref List <string> errorMsg)
        {
            List <string> errorList = new List <string>();

            if (list.CatalogerId <= 0)
            {
                errorList.Add("CatalogerId Error");
            }
            Match matchISBN = Regex.Match(list.ISBN, @"^(\d{10})$");

            if (!matchISBN.Success)
            {
                errorList.Add("ISBN 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);
        }