Feature repricing min max (#10)

amazon settlement import/export improvements
This commit is contained in:
2020-05-01 09:08:23 +01:00
committed by GitHub
parent 56647c7648
commit 43d61c2ef8
118 changed files with 7930 additions and 3021 deletions

View File

@@ -0,0 +1,189 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace bnhtrade.Core.Model.Stock
{
public class SkuTransaction : IValidatableObject
{
private DateTime? transactionDate = null;
private bool? isProcessed = null;
private short? quantity = null;
private int? stockjournalId = null;
private int? skuTransactionId = null;
private int? skuTransactionTypeId = null;
private int? foreignKey = null;
public int SkuTransactionId
{
get { return skuTransactionId.GetValueOrDefault(); }
set { skuTransactionId = value; }
}
public bool IsSetSkuTransactionId
{
get { return skuTransactionId != null; }
}
[Required()]
public DateTime TransactionDate
{
get { return transactionDate.GetValueOrDefault(); }
set { transactionDate = value; }
}
public bool IsSetTransactionDate
{
get { return transactionDate != null; }
}
[Required()]
public int SkuTransactionTypeId
{
get { return skuTransactionTypeId.GetValueOrDefault(); }
private set { skuTransactionTypeId = value; }
}
public bool IsSetSkuTransactionTypeId
{
get { return skuTransactionTypeId != null; }
}
public string SkuTransactionTypeName { get; private set; }
public bool IsSetReconcileSkuTypeName
{
get { return SkuTransactionTypeName != null; }
}
public int ForeignKey
{
get { return foreignKey.GetValueOrDefault(); }
set { foreignKey = value; }
}
public bool IsSetForeignKey
{
get { return foreignKey != null; }
}
public string Reference { get; set; }
public bool IsSetReference
{
get { return Reference != null; }
}
public string Detail { get; set; }
public bool IsSetDetail
{
get { return Detail != null; }
}
[Required()]
public string SkuNumber { get; set; }
public bool IsSetSkuNumber
{
get { return SkuNumber != null; }
}
[Required(), Range(0, short.MaxValue)]
public short Quantity
{
get { return quantity.GetValueOrDefault(); }
set { quantity = value; }
}
public bool IsSetQuantity
{
get { return quantity != null; }
}
public bool IsProcessed
{
get { return isProcessed.GetValueOrDefault(); }
set { isProcessed = value; }
}
public bool IsSetIsProcessed
{
get { return isProcessed != null; }
}
public int StockJournalId
{
get { return stockjournalId.GetValueOrDefault(); }
set { stockjournalId = value; }
}
public bool IsSetStockJournalId
{
get { return stockjournalId != null; }
}
public void SetReconcileSkuType(int reconcileSkuTypeId, string reconcileSkuTypeName)
{
if (!string.IsNullOrWhiteSpace(reconcileSkuTypeName) || reconcileSkuTypeId == 0)
{
SkuTransactionTypeId = reconcileSkuTypeId;
SkuTransactionTypeName = reconcileSkuTypeName;
}
}
public SkuTransaction Clone()
{
var clone = new SkuTransaction();
if (IsSetDetail) { clone.Detail = string.Copy(this.Detail); }
if (IsSetForeignKey) { clone.ForeignKey = this.ForeignKey; }
if (IsSetIsProcessed) { clone.IsProcessed = this.IsProcessed; }
if (IsSetQuantity) { clone.Quantity = this.Quantity; }
if (IsSetReference) { clone.Reference = string.Copy(this.Reference); }
if (IsSetSkuNumber) { clone.SkuNumber = string.Copy(this.SkuNumber); }
if (IsSetReconcileSkuTypeName) { clone.SkuTransactionTypeName = string.Copy(this.SkuTransactionTypeName); }
if (IsSetStockJournalId) { clone.StockJournalId = this.StockJournalId; }
if (IsSetSkuTransactionId) { clone.SkuTransactionId = this.SkuTransactionId; }
if (IsSetSkuTransactionTypeId) { clone.SkuTransactionTypeId = this.SkuTransactionTypeId; }
if (IsSetTransactionDate) { clone.TransactionDate = this.TransactionDate; }
return clone;
}
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
var result = new List<ValidationResult>();
if (!IsSetTransactionDate)
{
result.Add(new ValidationResult("Transaction date is not set"));
}
if (!IsSetIsProcessed)
{
result.Add(new ValidationResult("IsProcessed is not set"));
}
if (!IsSetQuantity)
{
result.Add(new ValidationResult("Quantity is not set"));
}
if (!IsSetSkuTransactionId)
{
result.Add(new ValidationResult("Stock Transaction Id is not set"));
}
if (!IsSetSkuTransactionTypeId)
{
result.Add(new ValidationResult("Stock Transaction TypeId is not set"));
}
if (IsSetStockJournalId && (!IsSetIsProcessed || IsProcessed == false))
{
result.Add(new ValidationResult("Stock Journal Id is set, IsProcessed must be set to true"));
}
return result;
}
}
}