Files
PowderCoatingLogix/src/PowderCoating.Application/DTOs/Vendor/VendorDtos.cs
T
spouliot d77b3778ac Add vendor supply categories with inventory auto-filter
Vendors can now be tagged with one or more inventory categories (Powder,
Chemical, etc.) via checkboxes on the Create/Edit form. The inventory
Create/Edit vendor dropdown automatically filters to matching vendors when
a category is selected; falls back to all vendors if none are tagged.
Includes migration AddVendorCategories (VendorInventoryCategories join table).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-23 09:52:34 -04:00

217 lines
6.2 KiB
C#

using System.ComponentModel.DataAnnotations;
namespace PowderCoating.Application.DTOs.Vendor;
// ============================================================================
// LIST DTO - For Index page listing
// ============================================================================
public class VendorListDto
{
public int Id { get; set; }
public string CompanyName { get; set; } = string.Empty;
public string? ContactName { get; set; }
public string? Phone { get; set; }
public string? Email { get; set; }
public bool IsActive { get; set; }
public bool IsPreferred { get; set; }
public int InventoryItemCount { get; set; }
}
// ============================================================================
// FULL VENDOR DTO - For Details page
// ============================================================================
public class VendorDto
{
public int Id { get; set; }
public string CompanyName { get; set; } = string.Empty;
public string? ContactName { get; set; }
public string? Phone { get; set; }
public string? Email { get; set; }
public string? Website { get; set; }
public string? Address { get; set; }
public string? City { get; set; }
public string? State { get; set; }
public string? ZipCode { get; set; }
public string? Country { get; set; }
public string? AccountNumber { get; set; }
public string? TaxId { get; set; }
public string? PaymentTerms { get; set; }
public decimal? CreditLimit { get; set; }
public string? Notes { get; set; }
public bool IsActive { get; set; }
public bool IsPreferred { get; set; }
public int? DefaultExpenseAccountId { get; set; }
public string? DefaultExpenseAccountName { get; set; }
public DateTime CreatedAt { get; set; }
}
// ============================================================================
// CREATE VENDOR DTO - For creating new vendors
// ============================================================================
public class CreateVendorDto
{
[Required]
[Display(Name = "Vendor Name")]
[StringLength(200)]
public string CompanyName { get; set; } = string.Empty;
[Display(Name = "Contact Name")]
[StringLength(100)]
public string? ContactName { get; set; }
[Display(Name = "Phone")]
[Phone]
[StringLength(20)]
public string? Phone { get; set; }
[Display(Name = "Email")]
[EmailAddress]
[StringLength(100)]
public string? Email { get; set; }
[Display(Name = "Website")]
[Url]
[StringLength(200)]
public string? Website { get; set; }
[Display(Name = "Address")]
[StringLength(200)]
public string? Address { get; set; }
[Display(Name = "City")]
[StringLength(100)]
public string? City { get; set; }
[Display(Name = "State")]
[StringLength(2)]
public string? State { get; set; }
[Display(Name = "Zip Code")]
[StringLength(10)]
public string? ZipCode { get; set; }
[Display(Name = "Country")]
[StringLength(50)]
public string? Country { get; set; }
[Display(Name = "Account Number")]
[StringLength(50)]
public string? AccountNumber { get; set; }
[Display(Name = "Tax ID / EIN")]
[StringLength(50)]
public string? TaxId { get; set; }
[Display(Name = "Payment Terms")]
[StringLength(100)]
public string? PaymentTerms { get; set; }
[Display(Name = "Credit Limit")]
[Range(0, 10000000)]
public decimal? CreditLimit { get; set; }
[Display(Name = "Notes")]
[DataType(DataType.MultilineText)]
public string? Notes { get; set; }
[Display(Name = "Active")]
public bool IsActive { get; set; } = true;
[Display(Name = "Preferred Vendor")]
public bool IsPreferred { get; set; } = false;
[Display(Name = "1099 Vendor")]
public bool Is1099Vendor { get; set; } = false;
[Display(Name = "Default Expense Account")]
public int? DefaultExpenseAccountId { get; set; }
public List<int> CategoryIds { get; set; } = new();
}
// ============================================================================
// UPDATE VENDOR DTO - For editing existing vendors
// ============================================================================
public class UpdateVendorDto
{
public int Id { get; set; }
[Required]
[Display(Name = "Vendor Name")]
[StringLength(200)]
public string CompanyName { get; set; } = string.Empty;
[Display(Name = "Contact Name")]
[StringLength(100)]
public string? ContactName { get; set; }
[Display(Name = "Phone")]
[Phone]
[StringLength(20)]
public string? Phone { get; set; }
[Display(Name = "Email")]
[EmailAddress]
[StringLength(100)]
public string? Email { get; set; }
[Display(Name = "Website")]
[Url]
[StringLength(200)]
public string? Website { get; set; }
[Display(Name = "Address")]
[StringLength(200)]
public string? Address { get; set; }
[Display(Name = "City")]
[StringLength(100)]
public string? City { get; set; }
[Display(Name = "State")]
[StringLength(2)]
public string? State { get; set; }
[Display(Name = "Zip Code")]
[StringLength(10)]
public string? ZipCode { get; set; }
[Display(Name = "Country")]
[StringLength(50)]
public string? Country { get; set; }
[Display(Name = "Account Number")]
[StringLength(50)]
public string? AccountNumber { get; set; }
[Display(Name = "Tax ID / EIN")]
[StringLength(50)]
public string? TaxId { get; set; }
[Display(Name = "Payment Terms")]
[StringLength(100)]
public string? PaymentTerms { get; set; }
[Display(Name = "Credit Limit")]
[Range(0, 10000000)]
public decimal? CreditLimit { get; set; }
[Display(Name = "Notes")]
[DataType(DataType.MultilineText)]
public string? Notes { get; set; }
[Display(Name = "Active")]
public bool IsActive { get; set; }
[Display(Name = "Preferred Vendor")]
public bool IsPreferred { get; set; }
[Display(Name = "1099 Vendor")]
public bool Is1099Vendor { get; set; }
[Display(Name = "Default Expense Account")]
public int? DefaultExpenseAccountId { get; set; }
public List<int> CategoryIds { get; set; } = new();
}