Joanne.Chuang 2 недель назад
Родитель
Сommit
834ee7f2e0
2 измененных файлов: 10 добавлений и 4 удалений
  1. +2
    -2
      Altob.NtuInvoiceGateway/Pages/Invoice.cshtml
  2. +8
    -2
      Altob.NtuInvoiceGateway/Pages/Invoice.cshtml.cs

+ 2
- 2
Altob.NtuInvoiceGateway/Pages/Invoice.cshtml Просмотреть файл

@@ -58,12 +58,12 @@
<input type="hidden" asp-for="InvoiceData.TaxType" /> <input type="hidden" asp-for="InvoiceData.TaxType" />


<div class="alert alert-info mb-4"> <div class="alert alert-info mb-4">
<strong>注意:</strong>以下四個選項至少需填寫一個
<strong>注意:</strong>以下四個選項僅能擇一填寫
</div> </div>


<div class="row mb-3"> <div class="row mb-3">
<div class="col-md-6"> <div class="col-md-6">
<label asp-for="InvoiceData.Email" class="form-label">消費者信箱(寄送發票開立通知用)</label>
<label asp-for="InvoiceData.Email" class="form-label">Email(寄送發票開立通知用)</label>
<input asp-for="InvoiceData.Email" class="form-control" type="email" maxlength="64" placeholder="example@email.com" /> <input asp-for="InvoiceData.Email" class="form-control" type="email" maxlength="64" placeholder="example@email.com" />
<span asp-validation-for="InvoiceData.Email" class="text-danger"></span> <span asp-validation-for="InvoiceData.Email" class="text-danger"></span>
</div> </div>


+ 8
- 2
Altob.NtuInvoiceGateway/Pages/Invoice.cshtml.cs Просмотреть файл

@@ -216,7 +216,7 @@ public class InvoiceModel : PageModel
return Page(); return Page();
} }


// 驗證 Email, CarrierID, BuyerIdentifier 至少填寫一個
// 驗證 Email, CarrierID, BuyerIdentifier, LoveCode 僅能擇一填寫
int filledCount = 0; int filledCount = 0;
if (!string.IsNullOrEmpty(InvoiceData.Email)) filledCount++; if (!string.IsNullOrEmpty(InvoiceData.Email)) filledCount++;
if (!string.IsNullOrEmpty(InvoiceData.CarrierID)) filledCount++; if (!string.IsNullOrEmpty(InvoiceData.CarrierID)) filledCount++;
@@ -225,7 +225,13 @@ public class InvoiceModel : PageModel


if (filledCount == 0) if (filledCount == 0)
{ {
ErrorMessage = "Email、手機條碼、購買者統編至少需填寫一個";
ErrorMessage = "Email、手機條碼、購買者統編、捐贈碼僅能擇一填寫,請填寫任一項";
return Page();
}

if (filledCount > 1)
{
ErrorMessage = "Email、手機條碼、購買者統編、捐贈碼僅能擇一填寫,請刪除多餘輸入";
return Page(); return Page();
} }




Загрузка…
Отмена
Сохранить