38748c2152
BatchId (Guid?) is stamped on every certificate in a bulk run so the batch is permanently addressable. BulkResult is now a bookmarkable GET by batchId rather than TempData, so users can return to re-download at any time. BatchDownloadPdf is a GET link (no form POST needed). Index shows a Batch badge on bulk certs that links directly back to the batch result page. Migration: AddGiftCertificateBatchId Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
115 lines
3.6 KiB
C#
115 lines
3.6 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
using PowderCoating.Core.Enums;
|
|
|
|
namespace PowderCoating.Application.DTOs.GiftCertificate;
|
|
|
|
public class GiftCertificateListDto
|
|
{
|
|
public int Id { get; set; }
|
|
public string CertificateCode { get; set; } = string.Empty;
|
|
public decimal OriginalAmount { get; set; }
|
|
public decimal RedeemedAmount { get; set; }
|
|
public decimal RemainingBalance { get; set; }
|
|
public string? RecipientName { get; set; }
|
|
public string? RecipientEmail { get; set; }
|
|
public GiftCertificateIssuedReason IssuedReason { get; set; }
|
|
public GiftCertificateStatus Status { get; set; }
|
|
public DateTime IssueDate { get; set; }
|
|
public DateTime? ExpiryDate { get; set; }
|
|
public Guid? BatchId { get; set; }
|
|
}
|
|
|
|
public class GiftCertificateDto : GiftCertificateListDto
|
|
{
|
|
public int? RecipientCustomerId { get; set; }
|
|
public decimal? PurchasePrice { get; set; }
|
|
public int? PurchasingCustomerId { get; set; }
|
|
public string? PurchasingCustomerName { get; set; }
|
|
public string? Notes { get; set; }
|
|
public string? IssuedByName { get; set; }
|
|
public List<GiftCertificateRedemptionDto> Redemptions { get; set; } = new();
|
|
}
|
|
|
|
public class GiftCertificateRedemptionDto
|
|
{
|
|
public int Id { get; set; }
|
|
public int GiftCertificateId { get; set; }
|
|
public int InvoiceId { get; set; }
|
|
public string InvoiceNumber { get; set; } = string.Empty;
|
|
public decimal AmountRedeemed { get; set; }
|
|
public DateTime RedeemedDate { get; set; }
|
|
public string? RedeemedByName { get; set; }
|
|
}
|
|
|
|
public class CreateGiftCertificateDto
|
|
{
|
|
[Required]
|
|
[Range(1.00, 9999.99, ErrorMessage = "Amount must be between $1.00 and $9,999.99")]
|
|
[Display(Name = "Certificate Amount")]
|
|
public decimal Amount { get; set; }
|
|
|
|
[Required]
|
|
[Display(Name = "Issued Reason")]
|
|
public GiftCertificateIssuedReason IssuedReason { get; set; } = GiftCertificateIssuedReason.Sold;
|
|
|
|
[Range(0, 9999.99)]
|
|
[Display(Name = "Purchase Price (if sold)")]
|
|
public decimal? PurchasePrice { get; set; }
|
|
|
|
[Display(Name = "Purchasing Customer")]
|
|
public int? PurchasingCustomerId { get; set; }
|
|
|
|
[Display(Name = "Recipient Customer")]
|
|
public int? RecipientCustomerId { get; set; }
|
|
|
|
[StringLength(200)]
|
|
[Display(Name = "Recipient Name")]
|
|
public string? RecipientName { get; set; }
|
|
|
|
[EmailAddress]
|
|
[StringLength(200)]
|
|
[Display(Name = "Recipient Email")]
|
|
public string? RecipientEmail { get; set; }
|
|
|
|
[Display(Name = "Expiry Date (optional)")]
|
|
public DateTime? ExpiryDate { get; set; }
|
|
|
|
[StringLength(1000)]
|
|
[Display(Name = "Notes")]
|
|
public string? Notes { get; set; }
|
|
}
|
|
|
|
public class RedeemGiftCertificateDto
|
|
{
|
|
[Required]
|
|
public string CertificateCode { get; set; } = string.Empty;
|
|
|
|
[Required]
|
|
[Range(0.01, 9999.99)]
|
|
public decimal Amount { get; set; }
|
|
}
|
|
|
|
public class BulkCreateGiftCertificateDto
|
|
{
|
|
[Required]
|
|
[Range(1, 500, ErrorMessage = "Quantity must be between 1 and 500.")]
|
|
[Display(Name = "Number of Certificates")]
|
|
public int Quantity { get; set; } = 25;
|
|
|
|
[Required]
|
|
[Range(1.00, 9999.99, ErrorMessage = "Amount must be between $1.00 and $9,999.99.")]
|
|
[Display(Name = "Face Value (each)")]
|
|
public decimal Amount { get; set; }
|
|
|
|
[Required]
|
|
[Display(Name = "Issued Reason")]
|
|
public GiftCertificateIssuedReason IssuedReason { get; set; } = GiftCertificateIssuedReason.Promotional;
|
|
|
|
[Display(Name = "Expiry Date (optional)")]
|
|
public DateTime? ExpiryDate { get; set; }
|
|
|
|
[StringLength(1000)]
|
|
[Display(Name = "Event / Notes (applied to all certificates)")]
|
|
public string? Notes { get; set; }
|
|
}
|