/// <summary> /// 从异常信息判断单据表插入异常是否因为ReceiptNo重复 /// </summary> /// <param name="ex"></param> /// <returns></returns> public static bool IsReceiptsNoRepeat(this Exception ex) { if (ex.Message == null) { return(false); } string message = new ExceptionMessage(ex).ToString().ToLowerInvariant(); return(message.Contains("dbo.financereceipts") && message.Contains("unique index") && message.Contains("key") && message.Contains("receiptno")); }