Summary description for TransactionEntity
Exemplo n.º 1
0
        public async Task UpdateTransactionAsync(Account account, AccountTransaction accountTransaction)
        {
            using (var dbContextTransaction = _dataDbContext.Database.BeginTransaction())
            {
                var entity   = _dataDbContext.Accounts.Single(x => string.Equals(x.IBAN, account.AccountName));
                var entityTo =
                    _dataDbContext.Accounts.SingleOrDefault(x => string.Equals(x.IBAN, accountTransaction.AccountName));

                entity.Balance   = account.Balance;
                entity.UpdatedAt = SystemDateTime.UtcNow();

                var transaction = new TransactionEntity
                {
                    FromId    = entity.Id,
                    Amount    = accountTransaction.Amount,
                    CreateAt  = entity.UpdatedAt,
                    Type      = accountTransaction.Type,
                    Status    = OperationStatus.Ok,
                    AccountTo = accountTransaction.AccountName
                };

                if (entityTo == null)
                {
                    transaction.Status = OperationStatus.AccountNotFound;
                }

                _dataDbContext.Transactions.Add(transaction);
                await _dataDbContext.SaveChangesAsync();

                dbContextTransaction.Commit();
            }
        }
        public void RestWsUpdateTransactionTest()
        {
            string            baseUrl     = "http://*****:*****@lifeiminstanceUid";
            transaction.organizationCode = "organizationCode";
            transaction.serviceName      = "serviceName";
            transaction.connectionName   = "bourne1";
            transaction.transDirection   = "inbound";
            transaction.transSize        = 50;
            transaction.patientMrn       = "6125268959";
            transaction.accessionNumber  = "606558125410";
            transaction.studyUid         = "1.2.840.10008";
            transaction.seriesUid        = "1.1.1.1.1";
            transaction.sopUid           = "1.1.1.1.1.1";
            transaction.transStatus      = "Failure";
            transaction.errorCode        = null;
            transaction.errorMessage     = null;
            transaction.transStarted     = "2020-11-26 10:32:00";
            transaction.transFinished    = null;
            transaction.retryAttempt     = 0;
            LiteRestWsRequest liteRestWsRequest =
                new LiteRestWsRequest(transaction, "transaction/" + transactionId, baseUrl, bearerAccessToken);
            object obj        = liteRestWsRequest.UpdateRecord(liteRestWsRequest.GetWsRequest());
            var    jsonString = JsonConvert.SerializeObject(obj);

            Console.Out.WriteLine(jsonString);
            TransactionEntity transactionResponse = JsonConvert.DeserializeObject <TransactionEntity>(jsonString);

            Assert.IsNotNull(transactionResponse.id);
        }
        private void SetTransactionEntity(TransactionEntity transactionEntity = null)
        {
            _transactionEntity = transactionEntity ?? new TransactionEntity()
            {
                IsIncome           = true,
                Amount             = 0D,
                ReferenceNumber    = "",
                Remarks            = "",
                TransactionPartyId = 0
            };

            if (_transactionEntity.Id == 0)
            {
                referenceNumberPanel.Visible           = false;
                transactionPartyComboBox.SelectedIndex = -1;
            }
            else
            {
                referenceNumberPanel.Visible          = true;
                referenceNumberTextBox.Text           = _transactionEntity.ReferenceNumber;
                transactionPartyComboBox.SelectedItem = _transactionParties.First(tp => tp.Id == _transactionEntity.TransactionPartyId);
            }

            transactionPartErrorLabel.Text = "";

            amountNumericUpDown.Text = _transactionEntity.Amount.ToString();
            amountErrorLabel.Text    = "";
            remarksTextBox.Text      = _transactionEntity.Remarks;
            remarksErrorLabel.Text   = "";
            incomeCheckBox.Checked   = _transactionEntity.IsIncome;
        }
        //[Browsable(true)]
        //[Description("Trigger when back button clicked"), Category("Action"),]
        //public event EventHandler BackButtonOnClick;

        //[Browsable(true)]
        //[Description("Trigger when delete button clicked"), Category("Action"),]
        //public event EventHandler DeleteButtonOnClick;

        //[Browsable(true)]
        //[Description("Trigger when save button clicked"), Category("Action"),]
        //public event EventHandler SaveButtonOnClick;

        public ManageTransactionUserControl(Action <ContentItemEnum> changeContentMainFormAction)
        {
            _changeContentMainFormAction = changeContentMainFormAction;
            _applicationService          = FinTimApplication.DependancyContainer.GetInstance <IApplicationService>();
            _transactionEntity           = null;
            InitializeComponent();
        }
Exemplo n.º 5
0
        public async Task CollectFeeAsync(Account account, decimal fee)
        {
            using (var dbContextTransaction = _dataDbContext.Database.BeginTransaction())
            {
                var entity = _dataDbContext.Accounts.Single(x => string.Equals(x.IBAN, account.AccountName));

                entity.Balance   = account.Balance;
                entity.UpdatedAt = SystemDateTime.UtcNow();

                var transaction = new TransactionEntity
                {
                    FromId    = entity.Id,
                    Amount    = fee,
                    CreateAt  = entity.UpdatedAt,
                    Type      = TransactionType.Withdraw,
                    Status    = OperationStatus.Ok,
                    AccountTo = "SYSTEM"
                };

                _dataDbContext.Transactions.Add(transaction);
                await _dataDbContext.SaveChangesAsync();

                dbContextTransaction.Commit();
            }
        }
 public static TransactionApplication Map(TransactionEntity transaction) =>
 new TransactionApplication
 {
     Amount   = transaction.Amount,
     Currency = transaction.Currency,
     Sku      = transaction.Sku
 };
Exemplo n.º 7
0
        public async Task TestCredit()
        {
            var mok = new Mock <ITransactionsRepository>();

            var controller = new TransactionsController(mok.Object);

            TransactionEntity obj = new TransactionEntity
            {
                Account = 1,
                Value   = 50.0,
                IsDebit = false,
                Date    = DateTime.Now
            };

            mok.Setup(a => a.BalanceAsync(It.IsAny <int>()))
            .Returns(Task.FromResult(60.0 + obj.Value));

            var result = await controller.Credit(obj);

            result.Should().BeOfType <OkObjectResult>().Which.Value.Should()
            .BeOfType <SuccessViewModel>().Which.Message.Should().Be("Successfully inserted credits");
            result.Should().BeOfType <OkObjectResult>().Which.Value.Should()
            .BeOfType <SuccessViewModel>().Which.Value.Should().Be(50.0);
            result.Should().BeOfType <OkObjectResult>().Which.Value.Should()
            .BeOfType <SuccessViewModel>().Which.Balance.Should().Be(110.0);
        }
Exemplo n.º 8
0
 /// <summary>
 /// Processes a specific transaction if the transaction needs to be processed.
 /// </summary>
 /// <param name="transaction">The transaction.</param>
 public void ProcessIfNeeded(TransactionEntity transaction)
 {
     if (transaction.NeedsProcessing())
     {
         this.Process(transaction);
     }
 }
Exemplo n.º 9
0
 public TransactionBinder(TransactionEntity transactionEntity, TransactionPartyEntity transactionPartyEntity)
 {
     ReferenceNumber      = transactionEntity.ReferenceNumber;
     TransactionPartyCode = transactionPartyEntity.Code;
     Amount = ((transactionEntity.IsIncome ? 1 : -1) * transactionEntity.Amount).ToString("0.00");
     TransactionDateTime = transactionEntity.TransactionDateTime;
 }
        public async Task AddAsync(
            Transaction transaction)
        {
            var(partitionKey, rowKey) = GetTransactionKeys(transaction.TransactionId);

            var transactionEntity = new TransactionEntity
            {
                Amount        = transaction.Amount,
                BlockNumber   = transaction.BlockNumber,
                BroadcastedOn = transaction.BroadcastedOn,
                BuiltOn       = transaction.BuiltOn,
                CompletedOn   = transaction.CompletedOn,
                Data          = transaction.Data,
                DeletedOn     = transaction.DeletedOn,
                Error         = transaction.Error,
                From          = transaction.From,
                GasAmount     = transaction.GasAmount,
                GasPrice      = transaction.GasPrice,
                Hash          = transaction.Hash,
                IncludeFee    = transaction.IncludeFee,
                SignedData    = transaction.SignedData,
                State         = transaction.State,
                To            = transaction.To,
                TransactionId = transaction.TransactionId,

                PartitionKey = partitionKey,
                RowKey       = rowKey
            };

            await _transactions.InsertAsync(transactionEntity);
        }
Exemplo n.º 11
0
        private async Task <SaveResult> SaveTransactions(AkromaContext context, BlockWithTransactions unsavedBlock)
        {
            if (!unsavedBlock.Transaction.Any())
            {
                return(SaveResult.Success());
            }

            foreach (var transaction in unsavedBlock.Transaction)
            {
                var aka    = UnitConversion.Convert.FromWeiToBigDecimal(transaction.Value);
                var toSave = new TransactionEntity
                {
                    Hash             = transaction.Hash,
                    Nonce            = transaction.Nonce.HexValue,
                    BlockHash        = transaction.BlockHash,
                    BlockNumber      = int.Parse(transaction.BlockNumber.Value.ToString()),
                    TransactionIndex = int.Parse(transaction.TransactionIndex.Value.ToString()),
                    From             = transaction.From,
                    To        = transaction.To,
                    Value     = decimal.Parse(aka.ToString()),
                    Gas       = transaction.Gas.HexValue,
                    GasPrice  = transaction.GasPrice.HexValue,
                    Timestamp = long.Parse(unsavedBlock.Timestamp.Value.ToString()),
                    Input     = transaction.Input
                };
                context.Transactions.Add(toSave);
                await context.SaveChangesAsync();
            }
            return(SaveResult.Success());
        }
Exemplo n.º 12
0
        public async Task <int> InsertTransactionAsync(TransactionEntity transactionEntity, bool isUserPerformed = false)
        {
            string query = "INSERT INTO `Transaction`" +
                           "(`TransactionPartyId`,`Amount`,`IsIncome`,`TransactionDateTime`,`ScheduledTransactionId`,`Remarks`,`CreatedDateTime`,`IsUserPerformed`) " +
                           "VALUES (@TransactionPartyId,@Amount,@IsIncome,@TransactionDateTime,@ScheduledTransactionId,@Remarks,@CreatedDateTime,@IsUserPerformed);";

            IEnumerable <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >()
            {
                new KeyValuePair <string, object>("@TransactionPartyId", transactionEntity.TransactionPartyId),
                new KeyValuePair <string, object>("@Amount", transactionEntity.Amount),
                new KeyValuePair <string, object>("@IsIncome", transactionEntity.IsIncome ? 1 : 0),
                new KeyValuePair <string, object>("@TransactionDateTime", TimeConverterMethods.ConvertDateTimeToTimeStamp(transactionEntity.TransactionDateTime)),
                new KeyValuePair <string, object>("@ScheduledTransactionId", transactionEntity.ScheduledTransactionId),
                new KeyValuePair <string, object>("@Remarks", transactionEntity.Remarks),
                new KeyValuePair <string, object>("@CreatedDateTime", TimeConverterMethods.ConvertDateTimeToTimeStamp(transactionEntity.CreatedDateTime)),
                new KeyValuePair <string, object>("@IsUserPerformed", isUserPerformed ? 1 : 0)
            };

            int id = await SqliteConnector.ExecuteInsertQueryAsync(query, parameters, true);

            query = "UPDATE `Transaction` SET `ReferenceNumber`=@ReferenceNumber WHERE `Id`=@Id";

            parameters = new List <KeyValuePair <string, object> >()
            {
                new KeyValuePair <string, object>("@ReferenceNumber", id.ToString("TC00000000")),
                new KeyValuePair <string, object>("@Id", id)
            };

            await SqliteConnector.ExecuteNonQueryAsync(query, parameters, true);

            return(id);
        }
Exemplo n.º 13
0
        private void DgvReceiptFromCustomer_SelectionChanged(object sender, EventArgs e)
        {
            try
            {
                DataGridViewRow row = dgvReceiptFromCustomer.CurrentRow;
                if (row != null && row.Cells["ReceiptPaymentID"].Value != null)
                {
                    TransactionEntity transactionEntity = new TransactionEntity()
                    {
                        ReceiptPaymentID = (long)row.Cells["ReceiptPaymentID"].Value,
                        EntityType       = Constants.LedgerType.CustomerLedger,
                        EntityCode       = Convert.ToString(row.Cells["LedgerTypeCode"].Value),
                    };

                    LoadGridBillOutstanding(transactionEntity);
                    LoadGridBillAdjusted(transactionEntity);
                }
                else
                {
                    dgvCustomerBillOS.DataSource       = null;
                    dgvCustomerBillAdjusted.DataSource = null;
                    lblAmtOSVal.Text  = String.Empty;
                    lblAmtAdjVal.Text = String.Empty;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 14
0
        public async Task <IActionResult> Create([Bind("AccountId,Type,Amount,Id")] TransactionEntity transaction)
        {
            if (ModelState.IsValid)
            {
                transaction.TransDate = DateTime.UtcNow;
                var account = await this.accountManager.GetAccountByID(transaction.AccountId);

                if (transaction.Type == "Deposit")
                {
                    transaction.Balance = account.Balance + transaction.Amount;
                    account.Balance    += transaction.Amount;
                }
                else if (transaction.Type == "Withdrawl")
                {
                    if (account.Balance - transaction.Amount < 0)
                    {
                        throw new Exception("Insufficient balance");
                    }
                    else
                    {
                        transaction.Balance = account.Balance - transaction.Amount;
                        account.Balance    -= transaction.Amount;
                    }
                }

                await this.transactionManager.InsertTransaction(transaction);

                await this.unitOfWork.Commit();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AccountId"] = new SelectList(await this.accountManager.GetAccounts(), "Id", "Id", transaction.AccountId);
            return(View(transaction));
        }
Exemplo n.º 15
0
        public static TransactionParamsDto CalculateTransactionParams(this TransactionEntity initialTransaction, decimal feeFactor)
        {
            var amount     = initialTransaction.Amount;
            var fee        = initialTransaction.Fee;
            var gasPrice   = initialTransaction.GasPrice;
            var includeFee = initialTransaction.IncludeFee;


            if (includeFee)
            {
                amount += fee;
            }

            gasPrice = FeeFactorApplier.Apply(gasPrice, feeFactor);
            fee      = gasPrice * Constants.EtcTransferGasAmount;

            if (includeFee)
            {
                amount -= fee;
            }

            return(new TransactionParamsDto
            {
                Amount = amount,
                Fee = fee,
                GasPrice = gasPrice
            });
        }
Exemplo n.º 16
0
        private void LoadGridBillAdjusted(TransactionEntity currentTransactionEntity)
        {
            List <PharmaBusinessObjects.Transaction.ReceiptPayment.BillAdjusted> allAdjustment = applicationFacade.GetAllTempBillAdjustmentForLedger(currentTransactionEntity);

            dgvCustomerBillAdjusted.DataSource = allAdjustment;
            ExtensionMethods.SetGridDefaultProperty(dgvCustomerBillAdjusted);

            dgvCustomerBillAdjusted.Columns["InvoiceNumber"].Visible      = true;
            dgvCustomerBillAdjusted.Columns["InvoiceNumber"].HeaderText   = "Bill Number";
            dgvCustomerBillAdjusted.Columns["InvoiceNumber"].DisplayIndex = 0;

            dgvCustomerBillAdjusted.Columns["InvoiceDate"].Visible                 = true;
            dgvCustomerBillAdjusted.Columns["InvoiceDate"].HeaderText              = "Bill Date";
            dgvCustomerBillAdjusted.Columns["InvoiceDate"].DisplayIndex            = 1;
            dgvCustomerBillAdjusted.Columns["InvoiceDate"].DefaultCellStyle.Format = "dd/MM/yyyy";

            dgvCustomerBillAdjusted.Columns["Amount"].Visible      = true;
            dgvCustomerBillAdjusted.Columns["Amount"].HeaderText   = "Adjusted Amount";
            dgvCustomerBillAdjusted.Columns["Amount"].DisplayIndex = 2;

            //Display totall of adjusted amount
            decimal totallAdjusted = 0;

            allAdjustment.ForEach(x => totallAdjusted += (decimal)x.Amount);
            lblAmtAdjVal.Text = Convert.ToString(totallAdjusted);
        }
Exemplo n.º 17
0
        public async Task <IActionResult> Credit(TransactionEntity obj)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(View(obj));
                }

                if (obj.Account <= 0)
                {
                    throw new TransactionException("Account number must be greater than 0");
                }

                if (obj.IsDebit)
                {
                    throw new TransactionException("Operation must be Credit");
                }

                if (obj.Value <= 0)
                {
                    throw new TransactionException("Cannot credit account with value less than 0 or 0");
                }

                await _transactionsRepository.InsertAsync(obj);

                return(RedirectToAction(nameof(Success), new { Message = "Successfully inserted credits", obj.Value, Balance = await _transactionsRepository.BalanceAsync(obj.Account) }));
            }
            catch (ApplicationException e)
            {
                return(RedirectToAction(nameof(Error), new { e.Message }));
            }
        }
 /// <summary>
 /// Gets a value indicating if the transaction needs to be processed.
 /// </summary>
 /// <param name="entity">The transaction.</param>
 /// <returns>A boolean indicating if the transaction needs to be processed.</returns>
 public static bool NeedsProcessing(this TransactionEntity entity)
 {
     return(entity.Date <= LocalDate.FromDateTime(DateTime.Today) &&
            // Is confirmed is always filled if needs confirmation is true.
            // ReSharper disable once PossibleInvalidOperationException
            (!entity.NeedsConfirmation || entity.IsConfirmed.Value));
 }
Exemplo n.º 19
0
        public async Task <object> SendBtcAsync(
            ITransactionInfo info,
            CancellationToken ct
            )
        {
            var wallet = await _context
                         .Wallets
                         .FirstOrDefaultAsync(e => e.Balance > info.Amount, ct);

            if (wallet == null)
            {
                throw new Exception("Wallet not found for the transaction");
            }

            var transaction = new TransactionEntity
            {
                Address        = info.Address,
                Amount         = info.Amount,
                IdempotencyKey = info.IdempotencyKey,
                Data           = DateTime.UtcNow,
                WalletId       = wallet.Id,
                Type           = TransactionType.Send
            };

            await _context
            .Transactions
            .AddAsync(transaction, ct);

            await _context
            .SaveChangesAsync(ct);

            return(Transaction.FromDbo(transaction));
        }
Exemplo n.º 20
0
        public async Task SaveAsync(TransactionModel transactionModel)
        {
            TransactionEntity transactionEntity = _mapper.Map <TransactionEntity>(transactionModel);
            await _collection.DeleteOneAsync((x) => x.TransactionHash == transactionEntity.TransactionHash);

            await _collection.InsertOneAsync(transactionEntity);
        }
Exemplo n.º 21
0
        public Result UpdateEmployee(TransactionEntity employeeData)
        {
            var result = new Result()
            {
                IsValid = false
            };

            StoreProcedureCommand procedure = CreateProcedureCommand("dbo.UpdateEmployee");

            procedure.AppendGuid("EmpID", employeeData.EmpID);
            procedure.AppendNVarChar("Address", employeeData.Address);
            procedure.AppendNVarChar("EMail", employeeData.EMail);
            procedure.AppendNVarChar("Phone", employeeData.Phone);

            int resultValue = ExecuteCommand(procedure);

            if (resultValue == 0)
            {
                result.IsValid = true;
                result.Message = new List <string> {
                    "Employee updated successfully"
                };
            }

            return(result);
        }
Exemplo n.º 22
0
        public long Insert(ITransactionEditEntity entity)
        {
            if (entity.Id != 0)
            {
                throw new ArgumentException("entity.Id");
            }

            var insertItem = new TransactionEntity(entity.Id,
                                                   entity.Amount,
                                                   entity.UserIdFrom,
                                                   entity.UserIdTo,
                                                   entity.Date);

            using (var dbContextTransaction = this._dbContext.Database.BeginTransaction())
            {
                try
                {
                    this._dbContext.Transactions.Add(insertItem);
                    this._dbContext.SaveChanges();

                    dbContextTransaction.Commit();
                }
                catch
                {
                    dbContextTransaction.Rollback();

                    throw;
                }
            }

            return(insertItem.Id);
        }
Exemplo n.º 23
0
        public async Task GeneratorTransaction()
        {
            var cancelTokenSource = new CancellationTokenSource();
            var ct = cancelTokenSource.Token;

            var rnd = new Random();

            using (var context = new BitcoindDbContext(DbContextOptions))
            {
                for (var i = 1; i < 1000; i++)
                {
                    var bitcoin        = new Key();
                    var bitcoinaddress = bitcoin.PubKey.GetAddress(Network.TestNet);
                    var amount         = rnd.Next(1, i);
                    var confirmation   = (byte)rnd.Next(0, 4);

                    var transaction = new TransactionEntity
                    {
                        Address        = bitcoinaddress.ToString(),
                        Amount         = amount,
                        IdempotencyKey = Guid.NewGuid(),
                        Data           = DateTime.UtcNow,
                        Confirmation   = confirmation
                    };

                    await context
                    .Transactions
                    .AddAsync(transaction, ct);
                }

                await context
                .SaveChangesAsync(ct);
            }
        }
Exemplo n.º 24
0
        public static T ToTransactionModel <T>(this TransactionEntity transactionEntity)
            where T : class, ITransactionModel, IDataModel, IConcurrent, IApprovable, new()
        {
            return(new T
            {
                // Common
                Id = transactionEntity.Id.ToString(),
                Version = transactionEntity.Version,

                // Foreign
                AccountId = transactionEntity.AccountId.ToString(),
                ProfileId = transactionEntity.ProfileId,

                // Properties
                Amount = transactionEntity.Amount,
                Info = transactionEntity.Info,
                Timestamp = transactionEntity.Created.ToString(CultureInfo.InvariantCulture),

                // Approvable
                Approved = transactionEntity.Approved,
                Pending = transactionEntity.Pending,
                Blocked = transactionEntity.Blocked,

                // Concurrent
                SequentialNumber = transactionEntity.SequentialNumber
            });
        }
Exemplo n.º 25
0
        public static void InitializeDbForTests(ApplicationDbContext context)
        {
            context.Database.EnsureCreated();

            if (context.Customer.Any())
            {
                return; // DB has been seeded
            }

            var customer = new CustomerEntity {
                Name = "Lorem", Email = "*****@*****.**", MobileNo = 2135000001
            };

            context.Customer.Add(customer);
            context.SaveChanges();

            var transaction = new TransactionEntity
            {
                Amount     = 0.2m, CurrencyCode = "Usd", Status = Status.Success, TransactionDateTime = DateTime.UtcNow,
                CustomerId = 1
            };

            context.Transaction.Add(transaction);
            context.SaveChanges();
        }
Exemplo n.º 26
0
        //SaveTransaction()
        //SaveTransactionItem()
        //SaveTransactionItemFromFile()
        #region SaveToDB
        public TransactionEntity SaveTransaction(TransactionModel transactionModel)
        {
            if (string.IsNullOrWhiteSpace(transactionModel.Item.Name))
            {
                return(null);
            }
            transactionModel.Item.LastValue = transactionModel.Value;
            transactionModel.Item.Type      = transactionModel.Type;
            TransactionEntity entity = new TransactionEntity
            {
                TransactionItem = SaveTransactionItem(transactionModel.Item),
                CreatedTime     = transactionModel.CreatedTime,
                User            = Context.Users.First(e => e.Id == _userService.LoggedInUser.Id) ??
                                  Context.Users.First(e => e.UserName == _userService.LoggedInUser.UserName),
                UserId   = _userService.LoggedInUser.Id,
                IsIncome = transactionModel.Type == BaseModel.TypeEnum.Income,
                Value    = transactionModel.Value
            };

            entity.TransactionItemId = entity.TransactionItem.Id;
            entity.UserId            = entity.User.Id;
            Context.Transactions.Add(entity);
            Context.SaveChanges();
            return(entity);
        }
Exemplo n.º 27
0
        public static TransactionDetailsOutDto EntityToOutDto(TransactionEntity transactionEntity)
        {
            TransactionDetailsOutDto createdTransactionDetails = transactionEntity switch
            {
                CreditTransactionEntity creditTransactionEntity => new CreditTransactionDetailsOutDto()
                {
                    CreditorName    = creditTransactionEntity.CreditorName,
                    CreditorAccount =
                        AccountReferenceOutDto.EntityToOutDto <AccountReferenceOutDto>(creditTransactionEntity
                                                                                       .CreditorAccount),
                    ValueDate       = creditTransactionEntity.ValueDate,
                    TransactionType = TransactionTypeEnum.CREDIT
                },
                DebitTransactionEntity debitTransactionEntity => new DebitTransactionDetailsOutDto()
                {
                    DebtorName    = debitTransactionEntity.DebtorName,
                    DebtorAccount =
                        AccountReferenceOutDto.EntityToOutDto <AccountReferenceOutDto>(debitTransactionEntity
                                                                                       .DebtorAccount),
                    TransactionType = TransactionTypeEnum.DEBIT
                },
                _ => throw new ArgumentOutOfRangeException(nameof(transactionEntity))
            };

            createdTransactionDetails.TransactionId     = transactionEntity.TransactionId;
            createdTransactionDetails.CheckId           = transactionEntity.CheckId;
            createdTransactionDetails.BookingDate       = transactionEntity.BookingDate;
            createdTransactionDetails.TransactionAmount = AmountOutDto.EntityToOutDto(transactionEntity.TransactionAmount);
            createdTransactionDetails.BookingStatus     = transactionEntity.BookingStatus;
            createdTransactionDetails.EntryDate         = transactionEntity.EntryDate;

            return(createdTransactionDetails);
        }
    }
Exemplo n.º 28
0
        private void LoadGridBillOutstanding(TransactionEntity transactionEntity)
        {
            List <PharmaBusinessObjects.Transaction.ReceiptPayment.BillOutstanding> allOutstandings = applicationFacade.GetAllBillOutstandingForLedger(transactionEntity);

            dgvCustomerBillOS.DataSource = allOutstandings;
            ExtensionMethods.SetGridDefaultProperty(dgvCustomerBillOS);

            dgvCustomerBillOS.Columns["InvoiceNumber"].Visible      = true;
            dgvCustomerBillOS.Columns["InvoiceNumber"].HeaderText   = "Bill Number";
            dgvCustomerBillOS.Columns["InvoiceNumber"].DisplayIndex = 0;

            dgvCustomerBillOS.Columns["InvoiceDate"].Visible                 = true;
            dgvCustomerBillOS.Columns["InvoiceDate"].HeaderText              = "Bill Date";
            dgvCustomerBillOS.Columns["InvoiceDate"].DisplayIndex            = 1;
            dgvCustomerBillOS.Columns["InvoiceDate"].DefaultCellStyle.Format = "dd/MM/yyyy";

            dgvCustomerBillOS.Columns["BillAmount"].Visible      = true;
            dgvCustomerBillOS.Columns["BillAmount"].HeaderText   = "Bill Amount";
            dgvCustomerBillOS.Columns["BillAmount"].DisplayIndex = 2;

            dgvCustomerBillOS.Columns["OSAmount"].Visible      = true;
            dgvCustomerBillOS.Columns["OSAmount"].HeaderText   = "Outstanding Amount";
            dgvCustomerBillOS.Columns["OSAmount"].DisplayIndex = 3;

            //Display totall of outstanding amount
            decimal totallOutstanding = 0;

            allOutstandings.ForEach(x => totallOutstanding += x.OSAmount);
            lblAmtOSVal.Text = Convert.ToString(totallOutstanding);
        }
Exemplo n.º 29
0
 /// <summary>
 /// Reverts the processing of a transaction if it was already processed.
 /// </summary>
 /// <param name="transaction">The transaction.</param>
 /// <param name="onlyInternally">A value indicating if the transaction should only be reverted internally. This means that no removal is send to Splitwise.</param>
 public void RevertIfProcessed(TransactionEntity transaction, bool onlyInternally = false)
 {
     if (transaction.Processed)
     {
         this.Revert(transaction, onlyInternally);
     }
 }
Exemplo n.º 30
0
        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            if (keyData == Keys.End)
            {
                if (dgvReceiptFromCustomer.SelectedCells.Count > 0)
                {
                    if (DialogResult.Yes == MessageBox.Show(Constants.Messages.SaveDataPrompt, Constants.Messages.Confirmation, MessageBoxButtons.YesNo, MessageBoxIcon.Warning))
                    {
                        List <long> listTempReceiptPaymentList = new List <long>();
                        foreach (DataGridViewRow receiptPaymentRow in dgvReceiptFromCustomer.Rows.Cast <DataGridViewRow>())
                        {
                            if (receiptPaymentRow.Cells["ReceiptPaymentID"].Value != null)
                            {
                                listTempReceiptPaymentList.Add((long)receiptPaymentRow.Cells["ReceiptPaymentID"].Value);
                            }
                        }

                        if (listTempReceiptPaymentList.Count > 0)
                        {
                            applicationFacade.SaveAllTempTransaction(listTempReceiptPaymentList);
                            this.Close();
                        }
                    }
                }
            }
            else if (keyData == Keys.Escape || keyData == Keys.Delete)
            {
                if (dgvReceiptFromCustomer.SelectedCells.Count > 0)
                {
                    int rowIndex = dgvReceiptFromCustomer.SelectedCells[0].RowIndex;
                    if (DialogResult.Yes == MessageBox.Show(Constants.Messages.DeletePrompt, Constants.Messages.Confirmation, MessageBoxButtons.YesNo, MessageBoxIcon.Warning))
                    {
                        if (dgvReceiptFromCustomer.Rows[rowIndex].Cells["ReceiptPaymentID"].Value != null)
                        {
                            TransactionEntity tranEntity = new TransactionEntity();
                            tranEntity.ReceiptPaymentID = (long)dgvReceiptFromCustomer.Rows[rowIndex].Cells["ReceiptPaymentID"].Value;
                            tranEntity.EntityCode       = Convert.ToString(dgvReceiptFromCustomer.Rows[rowIndex].Cells["LedgerTypeCode"].Value);

                            applicationFacade.ClearTempTransaction(tranEntity);
                            dgvReceiptFromCustomer.Rows.RemoveAt(rowIndex);
                            dgvReceiptFromCustomer.Refresh();
                            if (dgvReceiptFromCustomer.Rows.Count == 0)
                            {
                                AddNewRowToGrid();
                                dgvReceiptFromCustomer.CurrentCell = dgvReceiptFromCustomer.Rows[0].Cells["LedgerTypeCode"];
                                dgvReceiptFromCustomer.BeginEdit(true);
                            }

                            RaisePaymentModeCalculations();
                            dgvCustomerBillOS.DataSource       = null;
                            dgvCustomerBillAdjusted.DataSource = null;
                            lblAmtOSVal.Text  = String.Empty;
                            lblAmtAdjVal.Text = String.Empty;
                        }
                    }
                }
            }

            return(base.ProcessCmdKey(ref msg, keyData));
        }
Exemplo n.º 31
0
    public Boolean verifyPaymentUrl(String transaction_info, String order_code, String price, String payment_id, String payment_type, String error_text, String secure_code, string urlReturn, out TransactionEntity trans)
    {
        String str = "";
        trans = new TransactionEntity();
        str += " " + transaction_info;

        str += " " + order_code;

        str += " " + price;

        str += " " + payment_id;

        str += " " + payment_type;

        str += " " + error_text;

        str += " " + this.merchant_site_code;

        str += " " + this.secure_pass;

        // Mã hóa các tham so
        String verify_secure_code = "";

        verify_secure_code = this.GetMD5Hash(str);
        trans = null;
        // Xác thuc mã cua cho web voi mã tro vo to nganluong.vn
        if (verify_secure_code == secure_code)
        {
            trans = TransactionManager.CreateInstant().SelectOne(FGuid.ToGuid(transaction_info));
            if (trans.OrderCode == order_code && trans.Price == FNumber.ConvertDecimal(price))
            {
                trans.UrlReturn2 = urlReturn;
                trans.Status = true;
                TransactionManager.CreateInstant().Update(trans);
                return true;
            }
        }
        trans.Status = false;
        return false;
    }
Exemplo n.º 32
0
 public static TransactionEntity CreateTransactionEntity(int transactionId)
 {
     TransactionEntity transactionEntity = new TransactionEntity();
     transactionEntity.TransactionId = transactionId;
     return transactionEntity;
 }
Exemplo n.º 33
0
    public String buildCheckoutUrl(String return_url, String receiver, String transaction_info, String order_code, String price)
    {
        // Tao bien secure code
        String secure_code = "";

        TransactionEntity trans = new TransactionEntity();
        trans.Id = Guid.NewGuid();
        trans.ProductType = transaction_info;

        secure_code += this.merchant_site_code;

        secure_code += " " + HttpUtility.UrlEncode(return_url).ToLower();

        secure_code += " " + receiver;

        secure_code += " " + trans.Id.ToString();

        secure_code += " " + order_code;

        secure_code += " " + price;

        secure_code += " " + this.secure_pass;

        // Tao mang bam
        Hashtable ht = new Hashtable();

        ht.Add("merchant_site_code", this.merchant_site_code);

        ht.Add("return_url", HttpUtility.UrlEncode(return_url).ToLower());

        ht.Add("receiver", receiver);

        ht.Add("transaction_info", trans.Id.ToString());

        ht.Add("order_code", order_code);

        ht.Add("price", price);

        ht.Add("secure_code", this.GetMD5Hash(secure_code));

        // Tao url redirect
        String redirect_url = this.nganluong_url;

        if (redirect_url.IndexOf("?") == -1)
        {
            redirect_url += "?";
        }
        else if (redirect_url.Substring(redirect_url.Length - 1, 1) != "?" && redirect_url.IndexOf("&") == -1)
        {
            redirect_url += "&";
        }

        String url = "";

        // Duyet các phan tu trong mang bam ht1 de tao redirect url
        IDictionaryEnumerator en = ht.GetEnumerator();

        while (en.MoveNext())
        {
            if (url == "")
                url += en.Key.ToString() + "=" + en.Value.ToString();
            else
                url += "&" + en.Key.ToString() + "=" + en.Value.ToString();
        }

        String rdu = redirect_url + url;

        trans.ClientIp = WebUtility.GetUserIP();
        trans.MachineId = merchant_site_code;
        trans.OrderCode = order_code;
        trans.Price = FNumber.ConvertDecimal(price);
        trans.TransType = "NL";
        trans.UrlCheckOut = return_url;
        trans.UrlReturn = redirect_url + url;
        trans.CreatedBy = Util.CurrentUserName;
        trans.CreatedDate = DateTime.Now;
        TransactionManager.CreateInstant().Insert(trans);

        return rdu;
    }
Exemplo n.º 34
0
 public void AddToTransactionEntitySet(TransactionEntity transactionEntity)
 {
     base.AddObject("TransactionEntitySet", transactionEntity);
 }
Exemplo n.º 35
0
 public Boolean verifyPaymentUrl(Page p, out TransactionEntity trans)
 {
     return verifyPaymentUrl(p.Request.QueryString["transaction_info"], p.Request.QueryString["order_code"], p.Request.QueryString["price"], p.Request.QueryString["payment_id"], p.Request.QueryString["payment_type"], p.Request.QueryString["error_text"], p.Request.QueryString["secure_code"], p.Request.RawUrl, out trans);
 }