Exemplo n.º 1
0
        /// <summary>
        /// The details transaction click, from Transaction View will check if a new value is selected and will initialize again
        /// </summary>
        /// <param name="sender">
        /// The sender is the parent object of the combo box, which is the Data Grid
        /// </param>
        /// <param name="e">
        /// The e is the event arguments if applicable
        /// </param>
        private void DetailsTransClick(object sender, RoutedEventArgs e)
        {
            var     transView = ((FrameworkElement)sender).DataContext as TransactionView;
            Details details   = new Details(TransactionOrder.GetTransaction(transView.Id));

            details.Show();
        }
Exemplo n.º 2
0
        /// <summary>
        /// The export transaction click, from Transaction View will create a window to export the invoice of a transaction
        /// </summary>
        /// <param name="sender">
        /// The sender is the parent object of the button, which is the Data Grid
        /// </param>
        /// <param name="e">
        /// The e is the event arguments if applicable
        /// </param>
        private void ExportTransClick(object sender, RoutedEventArgs e)
        {
            var transView = ((FrameworkElement)sender).DataContext as TransactionView;
            var trans     = TransactionOrder.GetTransaction(transView.Id);

            ExcelExport.ExcelInvoice.ExportTransactionInvoice(trans);
        }
        public void GetTransactionTest()
        {
            var actualResult = new TransactionOrder
            {
                TransactionType = "Sales",
                DateTransaction = DateTime.Now,
                RefNo           = "TestRef"
            };

            actualResult = TransactionOrder.CreateTransaction(actualResult);

            var expectedResult = TransactionOrder.GetTransaction(actualResult.Id);

            UnitTestingHelper.AssertPublicPropertiesEqual(actualResult, expectedResult);

            if (TransactionOrder.GetTransaction("DoesNotExist") != null)
            {
                Assert.Fail("Transaction Order should not exist and must return null");
            }

            if (TransactionOrder.GetTransaction(actualResult.Id + " ") != null)
            {
                Assert.Fail("Transaction Order must return null since the id is modified");
            }

            TransactionOrder.DeleteTransaction(actualResult.Id);
        }
        public void CreateTransactionTest()
        {
            var actualResult = new TransactionOrder
            {
                TransactionType = "Sales",
                DateTransaction = DateTime.Now,
                RefNo           = "TestRef"
            };

            actualResult = TransactionOrder.CreateTransaction(actualResult);
            var expectedResult = TransactionOrder.GetTransaction(actualResult.Id);

            UnitTestingHelper.AssertPublicPropertiesEqual(actualResult, expectedResult);
            TransactionOrder.DeleteTransaction(actualResult.Id);
        }
        public void DeleteTransactionTest()
        {
            var actualResult = new TransactionOrder
            {
                TransactionType = "Sales",
                DateTransaction = DateTime.Now,
                RefNo           = "TestRef"
            };

            actualResult = TransactionOrder.CreateTransaction(actualResult);

            TransactionOrder.DeleteTransaction(actualResult.Id);

            var expectedResult = TransactionOrder.GetTransaction(actualResult.Id);

            Assert.IsNull(expectedResult);
        }
        public void EditTransactionTest()
        {
            var actualResult = new TransactionOrder
            {
                TransactionType = "Sales",
                DateTransaction = DateTime.Now,
                RefNo           = "TestRef"
            };

            actualResult       = TransactionOrder.CreateTransaction(actualResult);
            actualResult.RefNo = "Change Ref No";
            TransactionOrder.EditTransaction(actualResult);
            var expectedResult = TransactionOrder.GetTransaction(actualResult.Id);

            Assert.AreEqual(actualResult.RefNo, expectedResult.RefNo);

            TransactionOrder.DeleteTransaction(actualResult.Id);
        }