Skip to content

SqlNumberDateTime based NullSafeSet Method Problem #3032

@burhanugur

Description

@burhanugur

Hi,

As of version 5.4.0-dev.3703, when we use the ToLongDateTime extension method below, while the 'value' parameter to the NullSafeSet method was waiting for datetime, the long value started to appear. In this case, we get an error in the DateTime conversion we made in the NullSafeSet method. When we revert to version '5.4.0-dev.3653', only DateTime objects are processed in this method. We think that the change made with #3015 may have caused this situation.

@bahusoid @fredericDelaporte

public override void NullSafeSet(DbCommand cmd, object value, int index, ISessionImplementor session)
        {
            int? result = value != null ? int.Parse(((DateTime)value).ToString(Format)) : default(int?);

            NHibernateUtil.Int32.NullSafeSet(cmd, result, index, session);
        }
var predicateTxnAcquirerAll = PredicateBuilder.True<TxnAcquirerAll>()
                .And(x => x.F42 == request.MerchantId)
                .And(x => request.MerchantIds.Contains(x.F42))
                .And(x => x.F41 == request.TerminalId)
                .And(x => request.TerminalIds.Contains(x.F41))
                .And(x => x.F13.ToLongDateTime(x.F12) <= request.EndDate.ToLongDateTime())
                .And(x => x.F13.ToLongDateTime(x.F12) >= request.StartDate.ToLongDateTime());

var txnAcquirerAll = Query<TxnAcquirerAll>().WithOptions(opt => opt.SetReadOnly(true))
                                                   .Where(predicateTxnAcquirerAll)
                                                   .OrderByDescending(order => order.Guid)
                                                   .Select(x => new GetTransactionsResponse
                                                   {
                                                       TxnGuid = x.Guid,
                                                       CardNo = x.F2.Mask(6, 4, '*', MaskOption.Default),
                                                       CardDci = x.CardDci,
                                                       CardSource = x.CardSource,
                                                       TerminalType = x.TerminalType,
                                                       TransactionName = x.TxnDef.Description.GetText(CurrentLanguage),
                                                       TxnEffect = x.TxnDef.TxnEffect,
                                                       TxnEntry = x.TxnEntry,
                                                       TransactionStatus = x.TxnStt,
                                                       TransactionDate = x.F13,
                                                       TransactionTime = x.F12,
                                                       TxnRegion = x.TxnRegion,
                                                       BinProductType = x.BinProductType,
                                                       MerchantCode = x.F42,
                                                       MerchantName = x.F43Name,
                                                       MerchantLocation = x.F43,
                                                       MerchantCity = x.F43City,
                                                       MerchantCountry = x.F43Country,
                                                       TerminalCode = x.F41,
                                                       TerminalStan = x.F11Trm,
                                                       BatchNo = x.BatchNo,
                                                       InstallCount = x.TxnAcquirerInstall.InstallCnt,
                                                       AuthCode = x.F38,
                                                       Rrn = x.F37,
                                                       ResponseCode = x.F39,
                                                       ResponseDescription = x.TxnResponseCodeDef.Description.GetText(CurrentLanguage),
                                                       Irc = x.Irc,
                                                       IrcDescription = x.TxnIrcDef.Description.GetText(CurrentLanguage),
                                                       Mcc = x.F18,
                                                       RequestDate = x.RequestDate,
                                                       RequestTime = x.RequestTime,
                                                       TransactionAmount = x.F4,
                                                       TransactionCurrency = x.F49,
                                                       BillingAmount = x.F6,
                                                       BillingCurrency = x.F51,
                                                   });
[LinqExtensionMethod]
 public static long ToLongDateTime(this DateTime date, int time)
 {
       return long.Parse(date.ToShortDate() + time.ToString());
 }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions