73 lines
3.3 KiB
C#
73 lines
3.3 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_Movement : SbmUpdateLogItemMonitor
|
|
{
|
|
//-------------------------------------------------------------------
|
|
// Configuration.
|
|
public new class Config : SbmUpdateLogItemMonitor.Config
|
|
{
|
|
public Config(SbmInternals internals, SysId itemId) :
|
|
base(internals)
|
|
{
|
|
ItemType = (short)Sbm.ItemType.Movement;
|
|
ItemId = itemId;
|
|
}
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Data members.
|
|
private readonly List<TypeCodeDesc> itemTypes, movementTypes, itemTypeSources;
|
|
|
|
//-------------------------------------------------------------------
|
|
// Construction.
|
|
public SbmUpdateLogItemMonitor_Movement(SbmInternals internals, SbmMovement movement) :
|
|
base(new Config(internals, movement.Id))
|
|
{
|
|
itemTypes = internals.GetSystemCodes(Sbm.SystemCode.ItemType);
|
|
movementTypes = internals.GetSystemCodes(Sbm.SystemCode.MovementType);
|
|
RecordAttrValues(movement, false);
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Record attribute values.
|
|
public bool RecordUpdatedValues(SbmMovement movement)
|
|
{
|
|
return RecordAttrValues(movement, true);
|
|
}
|
|
private bool RecordAttrValues(SbmMovement movement, bool newValues)
|
|
{
|
|
ClearErrorState();
|
|
|
|
// Movement Properties - record values that may require logging.
|
|
RecordAttrValue(SbmDbDfn.ColumnIdx.Movement_ItemType, itemTypes.GetDescForType(movement.ItemType, ((int)movement.ItemType).ToString()), newValues);
|
|
RecordAttrValue(SbmDbDfn.ColumnIdx.Movement_ItemId, SysId.ToInt(movement.ItemId), newValues);
|
|
RecordAttrValue(SbmDbDfn.ColumnIdx.Movement_Type, movementTypes.GetDescForType(movement.MovementType, ((int)movement.MovementType).ToString()), newValues);
|
|
RecordAttrValue(SbmDbDfn.ColumnIdx.Movement_Movement, movement.Movement, newValues);
|
|
RecordAttrValue(SbmDbDfn.ColumnIdx.Movement_LocationIdFrom, SysId.ToInt(movement.LocationIdFrom), newValues);
|
|
RecordAttrValue(SbmDbDfn.ColumnIdx.Movement_LocationIdTo, SysId.ToInt(movement.LocationIdTo), newValues);
|
|
RecordAttrValue(SbmDbDfn.ColumnIdx.Movement_Quantity, movement.Quantity, newValues);
|
|
RecordAttrValue(SbmDbDfn.ColumnIdx.Movement_MovementIdSource, SysId.ToInt(movement.MovementIdSource), newValues);
|
|
RecordAttrValue(SbmDbDfn.ColumnIdx.Movement_ItemTypeSource, itemTypeSources.GetDescForType(movement.ItemTypeSource, ((int)movement.ItemTypeSource).ToString()), newValues);
|
|
RecordAttrValue(SbmDbDfn.ColumnIdx.Movement_ItemIdSource, SysId.ToInt(movement.ItemIdSource), newValues);
|
|
|
|
// Common properties.
|
|
RecordAttrValue(SbmDbDfn.ColumnIdx.Movement_Notes, movement.Notes, newValues);
|
|
RecordAttrValue(SbmDbDfn.ColumnIdx.Movement_Status, SacsSystem.GetStatusCode(movement.Status), newValues);
|
|
|
|
return OK;
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
}
|
|
//=======================================================================
|
|
}
|