2024-09-28 14:58:36 -04:00
|
|
|
|
|
|
|
|
|
|
using Microsoft.AspNetCore.Identity;
|
|
|
|
|
|
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
|
|
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
|
|
using System.Data;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Data.SeaHavenIndustries
|
|
|
|
|
|
{
|
|
|
|
|
|
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
|
|
|
|
|
|
{
|
|
|
|
|
|
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : base(options)
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
protected override void OnModelCreating(ModelBuilder builder)
|
|
|
|
|
|
{
|
|
|
|
|
|
base.OnModelCreating(builder);
|
|
|
|
|
|
foreach (var foreignKey in builder.Model.GetEntityTypes().SelectMany
|
|
|
|
|
|
(e => e.GetForeignKeys()))
|
|
|
|
|
|
{
|
|
|
|
|
|
foreignKey.DeleteBehavior = DeleteBehavior.Restrict;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
public DbSet<Category> Categories { get; set; }
|
|
|
|
|
|
public DbSet<Locations> Locations { get; set; }
|
|
|
|
|
|
public DbSet<Contacts> Contacts { get; set; }
|
|
|
|
|
|
public DbSet<WorkOrder> workOrders { get; set; }
|
|
|
|
|
|
public DbSet<Template> Templates { get; set; }
|
2026-01-21 15:41:19 -06:00
|
|
|
|
public DbSet<Comments> Comments { get; set; }
|
|
|
|
|
|
public DbSet<Quotes> Quotes { get; set; }
|
|
|
|
|
|
public DbSet<QuotesLineItems> QuotesLines { get; set; }
|
|
|
|
|
|
public DbSet<ForgetPasswordCode> ForgetPasswordCodes { get; set; }
|
|
|
|
|
|
public DbSet<WorkOrderContacts> WorkOrderContacts { get; set; }
|
|
|
|
|
|
public DbSet<WorkOrderCategories> workOrderCategories { get; set; }
|
|
|
|
|
|
public DbSet<WorkOrderAttachments> workOrderAttachments { get; set; }
|
2026-04-16 18:09:57 -04:00
|
|
|
|
public DbSet<WorkOrderAuditLog> WorkOrderAuditLogs { get; set; }
|
Add configurable dropdowns, new WO fields, and seed data
- Create DropdownOption model with Category, Value, ParentValue for Trade/SubTrade/Problem
- Add DropdownOptionsController with CRUD + ByCategory endpoint with parent filtering
- Add Problem, Trade, SubTrade, VendorNTE, ScheduledDate, CompletedDate, Source to WorkOrder
- Update EditWorkorder_DTO and GetWorkorderById with new fields
- Audit log tracks changes to all new fields
- Seed default Trades (10), SubTrades (20), and Problems (11) on startup
2026-04-17 10:40:38 -04:00
|
|
|
|
public DbSet<DropdownOption> DropdownOptions { get; set; }
|
Add vendor dispatch workflow backend
- Create Vendor model with company info, trade specialties, active flag
- Create Dispatch model (doubles as Vendor PO) with PO number, NTE, status, reply-to address
- VendorController: CRUD, paginated list, dropdown endpoint with trade filtering
- DispatchToVendor endpoint: multi-vendor dispatch, auto-generated PO numbers (VPO-00001),
HTML email with full WO details via SendGrid, reply-to wo-{number}@int.seahaven.com
- GetDispatches endpoint for listing dispatches by WO
- Include dispatches in GetWorkorderById response
- SendMessage.SendDispatchEmail with reply-to support
- Audit log entry for each dispatch
2026-04-17 11:37:35 -04:00
|
|
|
|
public DbSet<Vendor> Vendors { get; set; }
|
|
|
|
|
|
public DbSet<Dispatch> Dispatches { get; set; }
|
2026-04-17 15:16:28 -04:00
|
|
|
|
public DbSet<DispatchWorkOrder> DispatchWorkOrders { get; set; }
|
2026-04-17 14:57:18 -04:00
|
|
|
|
public DbSet<TaskListTemplate> TaskListTemplates { get; set; }
|
|
|
|
|
|
public DbSet<TaskListTemplateItem> TaskListTemplateItems { get; set; }
|
2026-01-21 15:41:19 -06:00
|
|
|
|
|
|
|
|
|
|
// New DbSets for added entities
|
|
|
|
|
|
public DbSet<Accounts> Accounts { get; set; }
|
|
|
|
|
|
public DbSet<Addresses> Addresses { get; set; }
|
|
|
|
|
|
public DbSet<Assets> Assets { get; set; }
|
|
|
|
|
|
public DbSet<Employee> Employees { get; set; }
|
|
|
|
|
|
public DbSet<FollowUps> FollowUps { get; set; }
|
|
|
|
|
|
public DbSet<PMSchedules> PMSchedules { get; set; }
|
|
|
|
|
|
public DbSet<ContactDetails> ContactDetails { get; set; }
|
2026-03-30 06:49:40 -05:00
|
|
|
|
|
|
|
|
|
|
// Employee related DbSets
|
|
|
|
|
|
public DbSet<EmployeeAddress> EmployeeAddresses { get; set; }
|
|
|
|
|
|
public DbSet<EmployeePhone> EmployeePhones { get; set; }
|
|
|
|
|
|
public DbSet<EmployeeEmail> EmployeeEmails { get; set; }
|
|
|
|
|
|
public DbSet<Department> Departments { get; set; }
|
|
|
|
|
|
public DbSet<JobTitle> JobTitles { get; set; }
|
|
|
|
|
|
public DbSet<Region> Regions { get; set; }
|
2024-09-28 14:58:36 -04:00
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
public class ApplicationUser : IdentityUser
|
|
|
|
|
|
{
|
|
|
|
|
|
public string? FirstName { get; set; }
|
|
|
|
|
|
public string? LastName { get; set; }
|
|
|
|
|
|
public string? UniqueName { get; set; }
|
|
|
|
|
|
public string? Locations { get; set; }
|
|
|
|
|
|
public string? Contact { get; set; }
|
|
|
|
|
|
public DateTime? CreatedDate { get; set; }
|
|
|
|
|
|
public DateTime? DeletedDate { get; set; }
|
|
|
|
|
|
public bool? IsDeleted { get; set; }
|
|
|
|
|
|
public string? UserImage { get; set; }
|
|
|
|
|
|
public int? Type { get; set; } // 1 for users 0 for admin
|
|
|
|
|
|
public ICollection<Template>? Templates { get; set; }
|
|
|
|
|
|
public ICollection<WorkOrder>? WorkOrders { get; set; }
|
|
|
|
|
|
}
|
|
|
|
|
|
public class FullAuditEntity
|
|
|
|
|
|
{
|
|
|
|
|
|
[Key]
|
|
|
|
|
|
public int Id { get; set; }
|
|
|
|
|
|
public bool? IsDeleted { get; set; }
|
|
|
|
|
|
public string? createdby { get; set; }
|
|
|
|
|
|
public string? DeleterUserId { get; set; }
|
|
|
|
|
|
public DateTime? DeletionTime { get; set; }
|
|
|
|
|
|
public DateTime? CreatedDate { get; set; }
|
|
|
|
|
|
public DateTime? LastModificationTime { get; set; }
|
|
|
|
|
|
public int? LastModifierUserId { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|