public string SerializeTransaction(BalanceChange trans) { return string.Format("INSERT INTO BALANCE_CHANGE (AccountID, ChangeType, Amount, ValueDate, Description)" + "VALUES ({0}, {1}, {2}, '{3}', '{4}')", trans.AccountID, (int) trans.ChangeType, trans.Amount, trans.ValueDate.ToString("yyyyMMdd HH:mm"), trans.Description); }
public WalletError GetTransferExtendedInfo(ProtectedOperationContext secCtx, int transferId, out BalanceChange balanceChange, out PlatformUser user) { balanceChange = null; user = null; if (!UserSessionStorage.Instance.PermitUserOperation(secCtx, false, false)) return WalletError.InsufficientRights; var error = WalletError.ServerError; try { using (var ctx = DatabaseContext.Instance.Make()) { var trans = ctx.TRANSFER.FirstOrDefault(t => t.ID == transferId); if (trans == null) return WalletError.InvalidData; if (trans.BalanceChange.HasValue) { balanceChange = LinqToEntity.DecorateBalanceChange(trans.BALANCE_CHANGE); return WalletError.OK; } if (trans.RefWallet.HasValue) { var us = ctx.PLATFORM_USER.FirstOrDefault(u => u.ID == trans.RefWallet.Value); if (us != null) { user = LinqToEntity.DecoratePlatformUser(us); user.Password = string.Empty; } } } } catch (Exception ex) { Logger.ErrorFormat("GetTransferExtendedInfo({0}) error: {1}", transferId, ex); error = WalletError.ServerError; } return error; }