using BeWo.Data.Entities;

using BS.Shared.DataContracts;

namespace BeWo.Service.DCEntityMapper
{
	public class ResetPasswordDC_ResetPassword: AbstractIDCEntityMapper<ResetPasswordInfo, ResetPasswordInfoDC>
	{
		public override ResetPasswordInfoDC MergeWithDC(ResetPasswordInfo pEntity, ResetPasswordInfoDC pDataContract)
		{
			pDataContract.ResetPasswordInfoOid = pEntity.Oid;
			pDataContract.ResetPasswordInfoVersion = pEntity.Version;
			pDataContract.Code = pEntity.Code;
			pDataContract.HasToChangePW = pEntity.HasToChangePW;
			pDataContract.ResetDate = pEntity.ResetDate;

			return pDataContract;
		}

		public override ResetPasswordInfo MergeWithEntity(ResetPasswordInfoDC pDataContract, ResetPasswordInfo pEntity)
		{
			ConcurrencyCheck(pDataContract.ResetPasswordInfoVersion, pEntity);

			pEntity.Oid = pDataContract.ResetPasswordInfoOid;
			pEntity.Code = pDataContract.Code;
			pEntity.HasToChangePW = pDataContract.HasToChangePW;
			pEntity.ResetDate = pDataContract.ResetDate;

			return pEntity;
		}

		protected override bool AreDCAndEntityEqual(ResetPasswordInfoDC pDC, ResetPasswordInfo pEntity)
		{
			if (pDC.ResetPasswordInfoOid == null)
				return false;

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