/// <summary>
        ///     Indicates whether the current <see cref="PayAllocationRecord" /> instance is equal to another <see cref="PayAllocationRecord" /> instance.
        /// </summary>
        /// <param name="that">
        ///     The <see cref="PayAllocationRecord" /> instance to be compared against this instance.
        /// </param>
        /// <returns>
        ///     True if both instances are considered equal; otherwise, false.
        /// </returns>
        public Boolean Equals(PayAllocationRecord that)
        {
            Boolean result = true;

            result = result && (this.Id.TrimOrNullify() == that.Id.TrimOrNullify());
            result = result && (this.Lock.TrimOrNullify() == that.Lock.TrimOrNullify());
            result = result && (this.Date == that.Date);
            result = result && (this.InvId.TrimOrNullify() == that.InvId.TrimOrNullify());
            result = result && (this.InvRef.TrimOrNullify() == that.InvRef.TrimOrNullify());
            result = result && (this.PayId.TrimOrNullify() == that.PayId.TrimOrNullify());
            result = result && (this.Hidden == that.Hidden);
            result = result && (this.CurrType.TrimOrNullify() == that.CurrType.TrimOrNullify());
            result = result && (this.Value == that.Value);
            result = result && (this.ValueBc == that.ValueBc);
            result = result && (this.CreditId.TrimOrNullify() == that.CreditId.TrimOrNullify());
            result = result && (this.CreditRef.TrimOrNullify() == that.CreditRef.TrimOrNullify());
            result = result && (this.BookId.TrimOrNullify() == that.BookId.TrimOrNullify());
            result = result && (this.MepId.TrimOrNullify() == that.MepId.TrimOrNullify());
            result = result && (this.BatId.TrimOrNullify() == that.BatId.TrimOrNullify());
            result = result && (this.ValueBc2 == that.ValueBc2);
            result = result && (this.DelId.TrimOrNullify() == that.DelId.TrimOrNullify());
            result = result && (this.Description.TrimOrNullify() == that.Description.TrimOrNullify());
            result = result && (this.External == that.External);
            result = result && (this.RefundId.TrimOrNullify() == that.RefundId.TrimOrNullify());
            result = result && (this.Deallocation == that.Deallocation);
            result = result && (this.ReversesPaId.TrimOrNullify() == that.ReversesPaId.TrimOrNullify());
            result = result && (this.ElemId.TrimOrNullify() == that.ElemId.TrimOrNullify());
            return(result);
        }
        /// <summary>
        ///     Creates a new <see cref="PayAllocationRecord" /> object instance that is a shallow-copy of the current object instance.
        /// </summary>
        /// <returns>
        ///     The shallow-copy of the current <see cref="PayAllocationRecord" /> object instance.
        /// </returns>
        public PayAllocationRecord Clone()
        {
            PayAllocationRecord record = new PayAllocationRecord();

            record.Id           = this.Id;
            record.Lock         = this.Lock;
            record.AddDate      = this.AddDate;
            record.AddBy        = this.AddBy;
            record.ModDate      = this.ModDate;
            record.ModBy        = this.ModBy;
            record.RcvDate      = this.RcvDate;
            record.RcvFrom      = this.RcvFrom;
            record.Date         = this.Date;
            record.InvId        = this.InvId;
            record.InvRef       = this.InvRef;
            record.PayId        = this.PayId;
            record.Hidden       = this.Hidden;
            record.CurrType     = this.CurrType;
            record.Value        = this.Value;
            record.ValueBc      = this.ValueBc;
            record.CreditId     = this.CreditId;
            record.CreditRef    = this.CreditRef;
            record.BookId       = this.BookId;
            record.MepId        = this.MepId;
            record.BatId        = this.BatId;
            record.ValueBc2     = this.ValueBc2;
            record.DelId        = this.DelId;
            record.Description  = this.Description;
            record.External     = this.External;
            record.RefundId     = this.RefundId;
            record.Deallocation = this.Deallocation;
            record.ReversesPaId = this.ReversesPaId;
            record.ElemId       = this.ElemId;
            return(record);
        }
        public override void Modify(PayAllocationRecord record)
        {
            DbCommand command = this.Provider.GetStoredProcedure("spInsertUpdatePayAllocation");

            this.MapParameterIn(command, "@PA_USER_LOGIN_ID", "dev");
            this.MapParametersIn(command, record, true);
            this.Execute(command);
            this.MapParametersOut(command, record);
        }
        public void CreateReverse(PayAllocationRecord record, Boolean reverse, String paid)
        {
            DbCommand command = this.Provider.GetStoredProcedure("spInsertUpdatePayAllocation");

            this.MapParametersIn(command, record, true);
            this.MapParameterIn(command, "@PA_USER_LOGIN_ID", "dev");
            this.MapParameterIn(command, "@PA_REVERSE", reverse);
            this.MapParameterIn(command, "@PA_PA_ID", paid);
            this.MapParameterIn(command, "@PA_PA_PAY_ID", record.PayId);
            this.MapParameterIn(command, "@PA_PAY_REFUND_PAY_ID", record.PayId);

            this.Execute(command);
            this.MapParametersOut(command, record);
        }