//PRIVATE LOGIC
 private void InitTransactionDbManagers()
 {
     SaleTransactionDbService =
         new SaleTransactionDbService(Presenter.GetStateManager().UserSession.SessionEntity);
     DeliveryTransactionDbService =
         new DeliveryTransactionDbService(Presenter.GetStateManager().UserSession.SessionEntity);
 }
        public void ShowTransaction(int transactionId)
        {
            var transaction         = DeliveryTransactionDbService.FindById(transactionId);
            var sb                  = new StringBuilder();
            var transactionProducts = transaction.TransactionProducts;

            sb.AppendLine($"Транзакция: {transaction.Id}, тип: {transaction.TransactionType}");
            sb.AppendLine($"Обща сума: {transaction.RevenueAmount}");
            sb.AppendLine($"Общо продукти: {transactionProducts.Count}");

            foreach (var transProd in transactionProducts)
            {
                sb.AppendLine($"кол.: {transProd.ProductQuantity}, пр.: {transProd.Product.ProductName}");
            }

            Presenter.GetStateManager().Push(new ErrorPresenter(Presenter.GetStateManager(), sb.ToString()));
        }
        private void OnRemoveTransactionConfirmed(bool isConfirmed)
        {
            if (isConfirmed)
            {
                try
                {
                    var transaction = SaleTransactionDbService.FindById(_transactionToRemove);
                    if (transaction == null)
                    {
                        Form.Log(InvalidTransactionId);
                        return;
                    }

                    if (transaction.User.Id != Presenter.GetStateManager().UserSession.SessionEntity.Id)
                    {
                        if (!Roles.IsAdmin(Presenter.GetStateManager().UserSession.SessionEntity.Roles))
                        {
                            Form.Log(TransactionDoesNotBelongToUserMsg);
                            return;
                        }
                    }

                    switch (transaction.TransactionType)
                    {
                    case TransactionType.DELIVERY:
                        DeliveryTransactionDbService.RollBack(transaction);
                        break;

                    case TransactionType.SALE:
                        SaleTransactionDbService.RollBack(_transactionToRemove);
                        break;
                    }

                    Search();
                    Form.Log($"Изтрита е транзакция с номер: {_transactionToRemove}");
                    _transactionToRemove = -1;
                }
                catch (Exception e)
                {
                    Form.Log(e.Message);
                }
            }
        }