using BeWo.Data.Entities;

using BS.Shared.DataContracts;

namespace BeWo.Service.DCEntityMapper
{
    public class AssessmentSheetValueDC_AssessmentSheetValue : AbstractIDCEntityMapper<AssessmentSheetValue, AssessmentSheetValueDC>
    {
        public override AssessmentSheetValueDC MergeWithDC(AssessmentSheetValue pEntity, AssessmentSheetValueDC pDataContract)
        {
            pDataContract.AssessmentSheetValueOid = pEntity.Oid;
            pDataContract.AssessmentSheetValueVersion = pEntity.Version;
            pDataContract.Description = pEntity.Description;
            pDataContract.Color = pEntity.Color;
            pDataContract.ShortcutKey = pEntity.ShortcutKey;
            pDataContract.Sign = pEntity.Sign;
            pDataContract.Position = pEntity.Position;
            return pDataContract;
        }

        public override AssessmentSheetValue MergeWithEntity(AssessmentSheetValueDC pDataContract, AssessmentSheetValue pEntity)
        {
            this.ConcurrencyCheck(pDataContract.AssessmentSheetValueVersion, pEntity);

            pEntity.Description = pDataContract.Description;
            pEntity.Color = pDataContract.Color;
            pEntity.ShortcutKey = pDataContract.ShortcutKey;
            pEntity.Sign = pDataContract.Sign;
            pEntity.Position = pDataContract.Position;

            return pEntity;
        }

        protected override bool AreDCAndEntityEqual(AssessmentSheetValueDC pDC, AssessmentSheetValue pEntity)
        {
            if (pDC.AssessmentSheetValueOid == null)
            {
                return false;
            }

            return pDC.AssessmentSheetValueOid == pEntity.Oid;
        }
    }
}