Files
raven/server/AyaNova/models/LoanUnit.cs
2022-05-26 18:59:37 +00:00

124 lines
3.9 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 LoanUnit : ICoreBizObjectModel
{
public long Id { get; set; }
public uint Concurrency { get; set; }
[Required]
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; }
public string Serial { get; set; }
//MIGRATE_OUTSTANDING this needs to be set in migrate v8 once workorderitemloan is coded and importable
public long? WorkOrderItemLoanId { get; set; }
[Required]
public decimal RateHour { get; set; }
[Required]
public decimal RateHalfDay { get; set; }
[Required]
public decimal RateDay { get; set; }
[Required]
public decimal RateWeek { get; set; }
[Required]
public decimal RateMonth { get; set; }
[Required]
public decimal RateYear { get; set; }
[Required]
public decimal RateHourCost { get; set; }
[Required]
public decimal RateHalfDayCost { get; set; }
[Required]
public decimal RateDayCost { get; set; }
[Required]
public decimal RateWeekCost { get; set; }
[Required]
public decimal RateMonthCost { get; set; }
[Required]
public decimal RateYearCost { get; set; }
// [Required]
// public LoanUnitRateUnit DefaultRate { get; set; }
public long? UnitId { get; set; }//Shadow unit
[NotMapped]
public string UnitViz { get; set; }
[NotMapped]
public string WorkOrderCustomerViz { get; set; }
[NotMapped]
public string WorkOrderSerialViz { get; set; }
[NotMapped]
public string WorkOrderRateViz { get; set; }
[NotMapped]
public decimal WorkOrderQuantityViz { get; set; }
[NotMapped]
public DateTime? WorkOrderOutDateViz { get; set; }
[NotMapped]
public DateTime? WorkOrderDueDateViz { get; set; }
[NotMapped]
public DateTime? WorkOrderReturnDateViz { get; set; }
public LoanUnit()
{
Tags = new List<string>();
// DefaultRate = LoanUnitRateUnit.Days;
}
[NotMapped, JsonIgnore]
public AyaType AyaType { get => AyaType.LoanUnit; }
}//eoc
}//eons
/*
Add: ShadowUnitId, DefaultRate (enum int)
CREATE TABLE [dbo].[ALOANITEM](
[AID] [uniqueidentifier] NOT NULL,
[ANAME] [nvarchar](255) NOT NULL,
[ACREATED] [datetime] NULL,
[AMODIFIED] [datetime] NULL,
[AACTIVE] [bit] NOT NULL,
[ACREATOR] [uniqueidentifier] NULL,
[AMODIFIER] [uniqueidentifier] NULL,
[ASERIAL] [nvarchar](255) NULL,
[ANOTES] [ntext] NULL,
[ACURRENTWORKORDERITEMLOAN] [uniqueidentifier] 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,
[ARATEHOUR] [decimal](19, 5) NOT NULL,
[ARATEHALFDAY] [decimal](19, 5) NOT NULL,
[ARATEDAY] [decimal](19, 5) NOT NULL,
[ARATEWEEK] [decimal](19, 5) NOT NULL,
[ARATEMONTH] [decimal](19, 5) NOT NULL,
[ARATEYEAR] [decimal](19, 5) NOT NULL,
[AREGIONID] [uniqueidentifier] NULL,//TAG
*/