12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- using FluentValidation;
- using Microsoft.AspNetCore.Http;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace OASystem.Domain.ViewModels.Financial
- {
-
-
-
- public class CreditCardBillDTO
- {
-
-
-
-
-
-
-
- public int cardType { get; set; }
- public string beginDt { get; set; }
- public string endDt { get; set; }
- }
- public class CreditCardBillDTOFoaValidator : AbstractValidator<CreditCardBillDTO>
- {
- public CreditCardBillDTOFoaValidator()
- {
-
-
-
-
-
-
- RuleFor(it => it.cardType)
- .GreaterThan(0)
- .WithMessage("请传入有效的卡类型!");
- RuleFor(it => it.beginDt)
- .NotNull()
- .NotEmpty()
- .WithMessage("请输入开始日期!")
- .Must(IsValidDate)
- .WithMessage("请输入正确的日期格式!");
- RuleFor(it => it.endDt)
- .NotNull()
- .NotEmpty()
- .WithMessage("请输入结束日期!")
- .Must(IsValidDate)
- .WithMessage("请输入正确的日期格式!");
- }
- private bool IsValidDate(string dateString)
- {
- return DateTime.TryParse(dateString, out _);
- }
- private bool IsExcelFile(string fileName)
- {
- if (!fileName.EndsWith(".xlsx") && !fileName.EndsWith(".xls"))
- {
- return false;
- }
- return true;
- }
- }
-
- }
|