68 lines
2.8 KiB
C#
68 lines
2.8 KiB
C#
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
|
using Sarand.BusinessMgr.Net.Standard.Base.Bus;
|
|
using Sarand.BusinessMgr.Net.Standard.Base.UpdateLog;
|
|
using Sarand.Net.Standard.Base.App;
|
|
using Sarand.Net.Standard.Base.Bus;
|
|
using Sarand.Net.Standard.Base.Core;
|
|
using System.Collections.Generic;
|
|
|
|
namespace Sarand.BusinessMgr.Net.Standard.Dbas.UpdateLog
|
|
{
|
|
//=======================================================================
|
|
public class SbmUpdateLogItemMonitor_StockLevel : SbmUpdateLogItemMonitor
|
|
{
|
|
//-------------------------------------------------------------------
|
|
// Configuration.
|
|
public new class Config : SbmUpdateLogItemMonitor.Config
|
|
{
|
|
public Config(SbmInternals internals, SysId itemId) :
|
|
base(internals)
|
|
{
|
|
ItemType = (short)Sbm.ItemType.StockLevel;
|
|
ItemId = itemId;
|
|
}
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Data members.
|
|
private readonly List<TypeCodeDesc> stockLevelTypes, stockLevelSources;
|
|
|
|
//-------------------------------------------------------------------
|
|
// Construction.
|
|
public SbmUpdateLogItemMonitor_StockLevel(SbmInternals internals, SbmStockLevel stockLevel) :
|
|
base(new Config(internals, stockLevel.Id))
|
|
{
|
|
stockLevelTypes = internals.GetSystemCodes(Sbm.SystemCode.StockLevelType);
|
|
stockLevelSources = internals.GetSystemCodes(Sbm.SystemCode.StockLevelSource);
|
|
RecordAttrValues(stockLevel, false);
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Record attribute values.
|
|
public bool RecordUpdatedValues(SbmStockLevel stockLevel)
|
|
{
|
|
return RecordAttrValues(stockLevel, true);
|
|
}
|
|
private bool RecordAttrValues(SbmStockLevel stockLevel, bool newValues)
|
|
{
|
|
ClearErrorState();
|
|
|
|
// Stock Level Properties - record values that may require logging.
|
|
RecordAttrValue(SbmDbDfn.ColumnIdx.StockLevel_CommodityId, SysId.ToInt(stockLevel.CommodityId), newValues);
|
|
RecordAttrValue(SbmDbDfn.ColumnIdx.StockLevel_LocationId, SysId.ToInt(stockLevel.LocationId), newValues);
|
|
RecordAttrValue(SbmDbDfn.ColumnIdx.StockLevel_Type, stockLevelTypes.GetDescForType(stockLevel.Type, ((int)stockLevel.Type).ToString()), newValues);
|
|
RecordAttrValue(SbmDbDfn.ColumnIdx.StockLevel_Source, stockLevelSources.GetDescForType(stockLevel.Source, ((int)stockLevel.Source).ToString()), newValues);
|
|
RecordAttrValue(SbmDbDfn.ColumnIdx.StockLevel_Quantity, stockLevel.Quantity, newValues);
|
|
|
|
// Common properties.
|
|
RecordAttrValue(SbmDbDfn.ColumnIdx.StockLevel_Notes, stockLevel.Notes, newValues);
|
|
RecordAttrValue(SbmDbDfn.ColumnIdx.StockLevel_Status, SacsSystem.GetStatusCode(stockLevel.Status), newValues);
|
|
|
|
return !HasErrorState();
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
}
|
|
//=======================================================================
|
|
}
|