Files
raven/server/AyaNova/models/Part.cs
2021-01-18 23:35:17 +00:00

94 lines
3.1 KiB
C#

using System;
using System.Collections.Generic;
using AyaNova.Biz;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
namespace AyaNova.Models
{
//NOTE: Any non required field (nullable in DB) sb nullable here, i.e. decimal? not decimal,
//otherwise the server will call it an invalid record if the field isn't sent from client
public class Part : ICoreBizObjectModel
{
public long Id { get; set; }
public uint Concurrency { get; set; }
public string Name { get; set; }
[Required]
public bool Active { get; set; }
public string Notes { get; set; }
public string Wiki { get; set; }
public string CustomFields { get; set; }
public List<string> Tags { get; set; }
[Required]
public string PartNumber { get; set; }
public long? ManufacturerId { get; set; }
public string ManufacturerNumber { get; set; }
public long? WholeSalerId { get; set; }
public string WholeSalerNumber { get; set; }
public long? AlternativeWholeSalerId { get; set; }
public string AlternativeWholeSalerNumber { get; set; }
[Required]
public decimal Cost { get; set; }
[Required]
public decimal Retail { get; set; }
public string UnitOfMeasure { get; set; }
public string UPC { get; set; }
public Part()
{
Tags = new List<string>();
Active = true;
Cost = 0m;
Retail = 0m;
}
[NotMapped, JsonIgnore]
public AyaType AyaType { get => AyaType.Part; }
}//eoc
}//eons
/*
CREATE TABLE [dbo].[APART](
[AID] [uniqueidentifier] NOT NULL,
[ACREATED] [datetime] NULL,
[AMODIFIED] [datetime] NULL,
[AACTIVE] [bit] NOT NULL,
[ACREATOR] [uniqueidentifier] NULL,
[AMODIFIER] [uniqueidentifier] NULL,
[ANAME] [nvarchar](255) NULL,
[AALERT] [ntext] NULL,//DROP was deprecated and unusued in v7
[ANOTES] [ntext] NULL,
[APARTNUMBER] [nvarchar](255) NOT NULL,
[APARTCATEGORYID] [uniqueidentifier] NULL,//DROP now a tag
[AMANUFACTURERID] [uniqueidentifier] NULL,
[AWHOLESALERID] [uniqueidentifier] NULL,
[AMANUFACTURERNUMBER] [nvarchar](255) NULL,
[AWHOLESALERNUMBER] [nvarchar](255) NULL,
[AALTERNATIVEWHOLESALERID] [uniqueidentifier] NULL,
[AALTERNATIVEWHOLESALERNUMBER] [nvarchar](255) NULL,
[ACOST] [decimal](19, 5) NULL,
[ARETAIL] [decimal](19, 5) NULL,
[AUNITOFMEASUREID] [uniqueidentifier] NULL,//convert to text and store inside the part instead of in another table to reduce join dependencies
[APARTASSEMBLYID] [uniqueidentifier] NULL,//DROP, Migrate into new partassemblyitem
[AUPC] [nvarchar](255) NULL,
[ATRACKSERIALNUMBER] [bit] NOT NULL,
[ACUSTOM1] [ntext] NULL,
[ACUSTOM2] [ntext] NULL,
[ACUSTOM3] [ntext] NULL,
[ACUSTOM4] [ntext] NULL,
[ACUSTOM5] [ntext] NULL,
[ACUSTOM6] [ntext] NULL,
[ACUSTOM7] [ntext] NULL,
[ACUSTOM8] [ntext] NULL,
[ACUSTOM9] [ntext] NULL,
[ACUSTOM0] [ntext] NULL,
*/