Example #1
0
        public void OrderPayment_persistence_test()
        {
            DateTime now = DateTime.Now;

            // Get datetime without milliseconds
            now = new DateTime(now.Ticks - (now.Ticks % TimeSpan.TicksPerSecond), now.Kind);
            var _order_order_orderpayment = new DSS5_SupplyChainFinancialsOptimisation.BO.Order
            {
                OrderNumber             = "Order_OrderNumber",
                EstimatedDateOfDelivery = now,
                PaymentTerms            = "Order_PaymentTerms",
                IntermediateParty       = true,
                IsCancelled             = true,
                DateOfOrder             = now,
                OrderAmount             = 2222222222.22222M,
                TotalPrice      = 2222222222.22222M,
                From            = "Order_From",
                DeliveryTo      = "Order_DeliveryTo",
                OrderAttachment = "Order_OrderAttachment",
            };

            new PersistenceSpecification <DSS5_SupplyChainFinancialsOptimisation.BO.OrderPayment>(Session)
            .CheckProperty(p => p.PaymentAmount, 2222222222.22222M)
            .CheckProperty(p => p.DateIssued, now)
            .CheckReference(p => p.Order, _order_order_orderpayment)
            .VerifyTheMappings();
        }
        public void OrderProduct_persistence_test()
        {
            DateTime now = DateTime.Now;

            // Get datetime without milliseconds
            now = new DateTime(now.Ticks - (now.Ticks % TimeSpan.TicksPerSecond), now.Kind);
            var _order_order_orderproducts = new DSS5_SupplyChainFinancialsOptimisation.BO.Order
            {
                OrderNumber             = "Order_OrderNumber",
                EstimatedDateOfDelivery = now,
                PaymentTerms            = "Order_PaymentTerms",
                IntermediateParty       = true,
                IsCancelled             = true,
                DateOfOrder             = now,
                OrderAmount             = 2222222222.22222M,
                TotalPrice      = 2222222222.22222M,
                From            = "Order_From",
                DeliveryTo      = "Order_DeliveryTo",
                OrderAttachment = "Order_OrderAttachment",
            };
            var _orderproduct_supplierproduct_orderproduct = new DSS5_SupplyChainFinancialsOptimisation.BO.SupplierProduct
            {
                Code            = "SupplierProduct_Code",
                Description     = "SupplierProduct_Description",
                UnitValue       = "SupplierProduct_UnitValue",
                MeasurementUnit = "SupplierProduct_MeasurementUnit",
                Price           = 222222.22M,
            };

            new PersistenceSpecification <DSS5_SupplyChainFinancialsOptimisation.BO.OrderProduct>(Session)
            .CheckProperty(p => p.Code, "OrderProduct_Code")
            .CheckProperty(p => p.Quantity, 222222.22M)
            .CheckProperty(p => p.Description, "OrderProduct_Description")
            .CheckProperty(p => p.UnitValue, "OrderProduct_UnitValue")
            .CheckProperty(p => p.MeasurementUnit, "OrderProduct_MeasurementUnit")
            .CheckProperty(p => p.Price, 222222.22M)
            .CheckProperty(p => p.LineTotalPrice, 222222.22M)
            .CheckReference(p => p.Order, _order_order_orderproducts)
            .CheckReference(p => p.SupplierProduct, _orderproduct_supplierproduct_orderproduct)
            .VerifyTheMappings();
        }
Example #3
0
        public void ProofOfDelivery_persistence_test()
        {
            DateTime now = DateTime.Now;

            // Get datetime without milliseconds
            now = new DateTime(now.Ticks - (now.Ticks % TimeSpan.TicksPerSecond), now.Kind);
            var _order_orders_proofofdeliveries = new DSS5_SupplyChainFinancialsOptimisation.BO.Order
            {
                OrderNumber             = "Order_OrderNumber",
                EstimatedDateOfDelivery = now,
                PaymentTerms            = "Order_PaymentTerms",
                IntermediateParty       = true,
                IsCancelled             = true,
                DateOfOrder             = now,
                OrderAmount             = 2222222222.22222M,
                TotalPrice      = 2222222222.22222M,
                From            = "Order_From",
                DeliveryTo      = "Order_DeliveryTo",
                OrderAttachment = "Order_OrderAttachment",
            };
            var _order_orders_proofofdeliveries2 = new DSS5_SupplyChainFinancialsOptimisation.BO.Order
            {
                OrderNumber             = "Order_OrderNumber",
                EstimatedDateOfDelivery = now,
                PaymentTerms            = "Order_PaymentTerms",
                IntermediateParty       = true,
                IsCancelled             = true,
                DateOfOrder             = now,
                OrderAmount             = 2222222222.22222M,
                TotalPrice      = 2222222222.22222M,
                From            = "Order_From",
                DeliveryTo      = "Order_DeliveryTo",
                OrderAttachment = "Order_OrderAttachment",
            };
            var _transaction_transaction_proofofdeliveries = new DSS5_SupplyChainFinancialsOptimisation.BO.Transaction
            {
                TransactionDateOccured = now,
                TransactionValue       = 2222222222.22222M,
                FundedAmount           = 2222222222.22222M,
                ToBePaidAmount         = 2222222222.22222M,
                InvoicedDate           = now,
                PaymentStatus          = "Transaction_PaymentStatus",
                PaymentDate            = now,
                RestPaymentAmount      = 2222222222.22222M,
                PaidByBuyer            = true,
            };

            new PersistenceSpecification <DSS5_SupplyChainFinancialsOptimisation.BO.ProofOfDelivery>(Session)
            .CheckProperty(p => p.PODNumber, "ProofOfDelivery_PODNumber")
            .CheckProperty(p => p.DateIssued, now)
            .CheckProperty(p => p.QualityStatus, "ProofOfDelivery_QualityStatus")
            .CheckProperty(p => p.QuantityStatus, "ProofOfDelivery_QuantityStatus")
            .CheckProperty(p => p.DeliveryStatus, "ProofOfDelivery_DeliveryStatus")
            .CheckProperty(p => p.PODAttachment, "ProofOfDelivery_PODAttachment")
            .CheckProperty(p => p.Comments, "ProofOfDelivery_Comments")
            .CheckBag(p => p.Orders, (new List <DSS5_SupplyChainFinancialsOptimisation.BO.Order>
            {
                _order_orders_proofofdeliveries,
                _order_orders_proofofdeliveries2
            }))
            .CheckReference(p => p.Transaction, _transaction_transaction_proofofdeliveries)
            .VerifyTheMappings();
        }
Example #4
0
        public void LetterOfCredit_persistence_test()
        {
            DateTime now = DateTime.Now;

            // Get datetime without milliseconds
            now = new DateTime(now.Ticks - (now.Ticks % TimeSpan.TicksPerSecond), now.Kind);
            var _order_orders_letterofcredits = new DSS5_SupplyChainFinancialsOptimisation.BO.Order
            {
                OrderNumber             = "Order_OrderNumber",
                EstimatedDateOfDelivery = now,
                PaymentTerms            = "Order_PaymentTerms",
                IntermediateParty       = true,
                IsCancelled             = true,
                DateOfOrder             = now,
                OrderAmount             = 2222222222.22222M,
                TotalPrice      = 2222222222.22222M,
                From            = "Order_From",
                DeliveryTo      = "Order_DeliveryTo",
                OrderAttachment = "Order_OrderAttachment",
            };
            var _order_orders_letterofcredits2 = new DSS5_SupplyChainFinancialsOptimisation.BO.Order
            {
                OrderNumber             = "Order_OrderNumber",
                EstimatedDateOfDelivery = now,
                PaymentTerms            = "Order_PaymentTerms",
                IntermediateParty       = true,
                IsCancelled             = true,
                DateOfOrder             = now,
                OrderAmount             = 2222222222.22222M,
                TotalPrice      = 2222222222.22222M,
                From            = "Order_From",
                DeliveryTo      = "Order_DeliveryTo",
                OrderAttachment = "Order_OrderAttachment",
            };
            var _transaction_transaction_letterofcredits = new DSS5_SupplyChainFinancialsOptimisation.BO.Transaction
            {
                TransactionDateOccured = now,
                TransactionValue       = 2222222222.22222M,
                FundedAmount           = 2222222222.22222M,
                ToBePaidAmount         = 2222222222.22222M,
                InvoicedDate           = now,
                PaymentStatus          = "Transaction_PaymentStatus",
                PaymentDate            = now,
                RestPaymentAmount      = 2222222222.22222M,
                PaidByBuyer            = true,
            };

            new PersistenceSpecification <DSS5_SupplyChainFinancialsOptimisation.BO.LetterOfCredit>(Session)
            .CheckProperty(p => p.ValueOfLoC, 222222.22M)
            .CheckProperty(p => p.IssuingBank, "LetterOfCredit_IssuingBank")
            .CheckProperty(p => p.Detail, "LetterOfCredit_Detail")
            .CheckProperty(p => p.UploadOfScan, "LetterOfCredit_UploadOfScan")
            .CheckProperty(p => p.Calculated, 222222.22M)
            .CheckProperty(p => p.DateOfValidity, now)
            .CheckProperty(p => p.DateOfExpiry, now)
            .CheckBag(p => p.Orders, (new List <DSS5_SupplyChainFinancialsOptimisation.BO.Order>
            {
                _order_orders_letterofcredits,
                _order_orders_letterofcredits2
            }))
            .CheckReference(p => p.Transaction, _transaction_transaction_letterofcredits)
            .VerifyTheMappings();
        }
        /*<ControllerActionImplementation:ImportLekosCSV:1/>*/
        public ActionResult ExecuteImportLekosCSV()
        {
            ActionResult _result = null;
            string       pathCSV = zAppDev.DotNet.Framework.Utilities.Web.MapPath(System.IO.Path.Combine("~/App_Data/Uploads", @model.LekosPath));

            if ((pathCSV?.Contains("LEKOS") ?? false))
            {
                zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Warning, "DeveloperTools", DSS5_SupplyChainFinancialsOptimisation.Hubs.EventsHub.RaiseDebugMessage, "LEKOS File Import");
                int?     rowCount       = 0;
                string[] entries        = null;
                string[] productEntries = null;
                int?     test           = 0;
                DSS5_SupplyChainFinancialsOptimisation.BO.CommercialAgreement commercialAgreement = new DSS5_SupplyChainFinancialsOptimisation.BO.CommercialAgreement();
                DSS5_SupplyChainFinancialsOptimisation.BO.Order newOrder = new DSS5_SupplyChainFinancialsOptimisation.BO.Order();
                System.Collections.Generic.List <DSS5_SupplyChainFinancialsOptimisation.BO.OrderProduct> products = new System.Collections.Generic.List <DSS5_SupplyChainFinancialsOptimisation.BO.OrderProduct>();
                commercialAgreement.Supplier = new DSS5_SupplyChainFinancialsOptimisation.DAL.Repository().GetAsQueryable <DSS5_SupplyChainFinancialsOptimisation.BO.Supplier>((a) => a.UserName == "Supplier25")?.FirstOrDefault();
                System.Collections.Generic.List <string> delim = new System.Collections.Generic.List <string>();
                delim.Add("\r");
                delim.Add("\n");
                foreach (var row in System.IO.File.ReadAllText(pathCSV).SplitExtended(delim.ToArray(), true) ?? Enumerable.Empty <string>())
                {
                    if (((((row == null || row == "")) == false) && (((row == null || row.Trim() == "")) == false)))
                    {
                        entries = row?.SplitExtended(';', false);
                        if ((entries.Length > 0))
                        {
                            if (zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(entries, 0).StartsWith("Α-ΔΑ"))
                            {
                                zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Warning, "DeveloperTools", DSS5_SupplyChainFinancialsOptimisation.Hubs.EventsHub.RaiseDebugMessage, "Found Delivery Note");
                                newOrder.PaymentTerms = "";
                                DSS5_SupplyChainFinancialsOptimisation.BO.DeliveryNote newDeliveryNote = new DSS5_SupplyChainFinancialsOptimisation.BO.DeliveryNote();
                                newDeliveryNote.DeliveryNoteNumber = zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(entries, 0);
                                newDeliveryNote.Description        = zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(entries, 1);
                                newDeliveryNote.DateIssued         = zAppDev.DotNet.Framework.Utilities.Common.ParseExactDate(zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(entries, 2), "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture).GetValueOrDefault(System.Data.SqlTypes.SqlDateTime.MinValue.Value);
                                newDeliveryNote.Amount             = zAppDev.DotNet.Framework.Utilities.Common.ConvertToDecimal(zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(entries, 14));
                                newOrder?.AddDeliveryNotes(newDeliveryNote);
                                commercialAgreement?.AddOrders(newOrder);
                            }
                            else if (zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(entries, 0).StartsWith("Α-ΠΑ"))
                            {
                                zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Warning, "DeveloperTools", DSS5_SupplyChainFinancialsOptimisation.Hubs.EventsHub.RaiseDebugMessage, "Found Order");
                                newOrder.OrderNumber  = zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(entries, 0);
                                newOrder.DateOfOrder  = zAppDev.DotNet.Framework.Utilities.Common.ParseExactDate(zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(entries, 2), "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture).GetValueOrDefault(System.Data.SqlTypes.SqlDateTime.MinValue.Value);
                                newOrder.PaymentTerms = zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(entries, 10);
                                commercialAgreement?.AddOrders(newOrder);
                            }
                            else if (zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(entries, 0).StartsWith("Α-ΤΔ"))
                            {
                                zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Warning, "DeveloperTools", DSS5_SupplyChainFinancialsOptimisation.Hubs.EventsHub.RaiseDebugMessage, "Found Delivery Note & Invoice");
                                newOrder.PaymentTerms = "";
                                DSS5_SupplyChainFinancialsOptimisation.BO.DeliveryNote newDeliveryNote = new DSS5_SupplyChainFinancialsOptimisation.BO.DeliveryNote();
                                newDeliveryNote.DeliveryNoteNumber = zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(entries, 0);
                                newDeliveryNote.Description        = zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(entries, 1);
                                newDeliveryNote.DateIssued         = zAppDev.DotNet.Framework.Utilities.Common.ParseExactDate(zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(entries, 2), "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture).GetValueOrDefault(System.Data.SqlTypes.SqlDateTime.MinValue.Value);
                                newDeliveryNote.Amount             = zAppDev.DotNet.Framework.Utilities.Common.ConvertToDecimal(zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(entries, 14));
                                newOrder?.AddDeliveryNotes(newDeliveryNote);
                                DSS5_SupplyChainFinancialsOptimisation.BO.Invoice newInvoice = new DSS5_SupplyChainFinancialsOptimisation.BO.Invoice();
                                newInvoice.InvoiceNumber = zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(entries, 0);
                                newInvoice.Description   = zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(entries, 1);
                                newInvoice.DateIssued    = zAppDev.DotNet.Framework.Utilities.Common.ParseExactDate(zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(entries, 2), "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture).GetValueOrDefault(System.Data.SqlTypes.SqlDateTime.MinValue.Value);
                                newInvoice.Amount        = zAppDev.DotNet.Framework.Utilities.Common.ConvertToDecimal(zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(entries, 14));
                                newOrder?.AddInvoices(newInvoice);
                                commercialAgreement?.AddOrders(newOrder);
                            }
                            else if (zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(entries, 0).StartsWith("Α-ΤΠ"))
                            {
                                zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Warning, "DeveloperTools", DSS5_SupplyChainFinancialsOptimisation.Hubs.EventsHub.RaiseDebugMessage, "Found Invoice");
                                newOrder.PaymentTerms = "";
                                DSS5_SupplyChainFinancialsOptimisation.BO.Invoice newInvoice = new DSS5_SupplyChainFinancialsOptimisation.BO.Invoice();
                                newInvoice.InvoiceNumber = zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(entries, 0);
                                newInvoice.Description   = zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(entries, 1);
                                newInvoice.DateIssued    = zAppDev.DotNet.Framework.Utilities.Common.ParseExactDate(zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(entries, 2), "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture).GetValueOrDefault(System.Data.SqlTypes.SqlDateTime.MinValue.Value);
                                newInvoice.Amount        = zAppDev.DotNet.Framework.Utilities.Common.ConvertToDecimal(zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(entries, 14));
                                newOrder?.AddInvoices(newInvoice);
                                commercialAgreement?.AddOrders(newOrder);
                            }
                            else if (zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(entries, 0).StartsWith("Χ-Α"))
                            {
                                zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Warning, "DeveloperTools", DSS5_SupplyChainFinancialsOptimisation.Hubs.EventsHub.RaiseDebugMessage, "Found Cancelled Order");
                                newOrder.PaymentTerms = "";
                                DSS5_SupplyChainFinancialsOptimisation.BO.CreditNote crNote = new DSS5_SupplyChainFinancialsOptimisation.BO.CreditNote();
                                crNote.CreditNoteNumber = zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(entries, 0);
                                crNote.Description      = zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(entries, 1);
                                crNote.DateIssued       = zAppDev.DotNet.Framework.Utilities.Common.ParseExactDate(zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(entries, 2), "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture).GetValueOrDefault(System.Data.SqlTypes.SqlDateTime.MinValue.Value);
                                crNote.TotalPrice       = zAppDev.DotNet.Framework.Utilities.Common.ConvertToDecimal(zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(entries, 14));
                                newOrder?.AddCreditNotes(crNote);
                                commercialAgreement?.AddOrders(newOrder);
                            }
                            else if (zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(entries, 0).StartsWith("Ε-ΤΠ"))
                            {
                                zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Warning, "DeveloperTools", DSS5_SupplyChainFinancialsOptimisation.Hubs.EventsHub.RaiseDebugMessage, "Found EU Invoice");
                                newOrder.PaymentTerms = "";
                                DSS5_SupplyChainFinancialsOptimisation.BO.Invoice newInvoice = new DSS5_SupplyChainFinancialsOptimisation.BO.Invoice();
                                newInvoice.InvoiceNumber = zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(entries, 0);
                                newInvoice.Description   = zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(entries, 1);
                                newInvoice.DateIssued    = zAppDev.DotNet.Framework.Utilities.Common.ParseExactDate(zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(entries, 2), "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture).GetValueOrDefault(System.Data.SqlTypes.SqlDateTime.MinValue.Value);
                                newInvoice.Amount        = zAppDev.DotNet.Framework.Utilities.Common.ConvertToDecimal(zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(entries, 14));
                                newInvoice.CustomerType  = "EU Customer";
                                newOrder?.AddInvoices(newInvoice);
                                commercialAgreement?.AddOrders(newOrder);
                            }
                        }
                        else
                        {
                            zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Info, "DeveloperTools", DSS5_SupplyChainFinancialsOptimisation.Hubs.EventsHub.RaiseDebugMessage, "Row: " + (rowCount?.ToString() ?? "") + "does not have 2 entries.");
                        }
                    }
                    else
                    {
                        zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Info, "DeveloperTools", DSS5_SupplyChainFinancialsOptimisation.Hubs.EventsHub.RaiseDebugMessage, "Row " + (rowCount?.ToString() ?? "") + " did not have value.");
                    }
                    if (rowCount > 0)
                    {
                        zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Info, "DeveloperTools", DSS5_SupplyChainFinancialsOptimisation.Hubs.EventsHub.RaiseDebugMessage, "product----> " + row);
                        productEntries = row?.SplitExtended(';', false);
                        DSS5_SupplyChainFinancialsOptimisation.BO.OrderProduct product = new DSS5_SupplyChainFinancialsOptimisation.BO.OrderProduct();
                        product.Code            = zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(productEntries, 0);
                        product.Description     = zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(productEntries, 1);
                        product.MeasurementUnit = zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(productEntries, 2);
                        products?.Add(product);
                        product.Quantity = zAppDev.DotNet.Framework.Utilities.Common.ConvertToDecimal(zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(productEntries, 3));
                    }
                    rowCount = rowCount.GetValueOrDefault(0) + 1;
                    commercialAgreement?.AddOrders(newOrder);
                    new DSS5_SupplyChainFinancialsOptimisation.DAL.Repository().Save <DSS5_SupplyChainFinancialsOptimisation.BO.CommercialAgreement>(commercialAgreement);
                }
                zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Warning, "DeveloperTools", DSS5_SupplyChainFinancialsOptimisation.Hubs.EventsHub.RaiseDebugMessage, "Rowcount " + (rowCount?.ToString() ?? ""));
            }
            return(_result);
        }
        public void DeliveryNote_persistence_test()
        {
            DateTime now = DateTime.Now;

            // Get datetime without milliseconds
            now = new DateTime(now.Ticks - (now.Ticks % TimeSpan.TicksPerSecond), now.Kind);
            var _deliverynote_products_deliverynote = new DSS5_SupplyChainFinancialsOptimisation.BO.OrderProduct
            {
                Code            = "OrderProduct_Code",
                Quantity        = 222222.22M,
                Description     = "OrderProduct_Description",
                UnitValue       = "OrderProduct_UnitValue",
                MeasurementUnit = "OrderProduct_MeasurementUnit",
                Price           = 222222.22M,
                LineTotalPrice  = 222222.22M,
            };
            var _deliverynote_products_deliverynote2 = new DSS5_SupplyChainFinancialsOptimisation.BO.OrderProduct
            {
                Code            = "OrderProduct_Code",
                Quantity        = 222222.22M,
                Description     = "OrderProduct_Description",
                UnitValue       = "OrderProduct_UnitValue",
                MeasurementUnit = "OrderProduct_MeasurementUnit",
                Price           = 222222.22M,
                LineTotalPrice  = 222222.22M,
            };
            var _deliverynote_deliverynoteproducts_deliverynote = new DSS5_SupplyChainFinancialsOptimisation.BO.DeliveryNoteProduct
            {
                Code            = "DeliveryNoteProduct_Code",
                Quantity        = 222222.22M,
                Description     = "DeliveryNoteProduct_Description",
                UnitValue       = "DeliveryNoteProduct_UnitValue",
                MeasurementUnit = "DeliveryNoteProduct_MeasurementUnit",
                Price           = 222222.22M,
                LineTotalPrice  = 222222.22M,
            };
            var _deliverynote_deliverynoteproducts_deliverynote2 = new DSS5_SupplyChainFinancialsOptimisation.BO.DeliveryNoteProduct
            {
                Code            = "DeliveryNoteProduct_Code",
                Quantity        = 222222.22M,
                Description     = "DeliveryNoteProduct_Description",
                UnitValue       = "DeliveryNoteProduct_UnitValue",
                MeasurementUnit = "DeliveryNoteProduct_MeasurementUnit",
                Price           = 222222.22M,
                LineTotalPrice  = 222222.22M,
            };
            var _order_orders_deliverynotes = new DSS5_SupplyChainFinancialsOptimisation.BO.Order
            {
                OrderNumber             = "Order_OrderNumber",
                EstimatedDateOfDelivery = now,
                PaymentTerms            = "Order_PaymentTerms",
                IntermediateParty       = true,
                IsCancelled             = true,
                DateOfOrder             = now,
                OrderAmount             = 2222222222.22222M,
                TotalPrice      = 2222222222.22222M,
                From            = "Order_From",
                DeliveryTo      = "Order_DeliveryTo",
                OrderAttachment = "Order_OrderAttachment",
            };
            var _order_orders_deliverynotes2 = new DSS5_SupplyChainFinancialsOptimisation.BO.Order
            {
                OrderNumber             = "Order_OrderNumber",
                EstimatedDateOfDelivery = now,
                PaymentTerms            = "Order_PaymentTerms",
                IntermediateParty       = true,
                IsCancelled             = true,
                DateOfOrder             = now,
                OrderAmount             = 2222222222.22222M,
                TotalPrice      = 2222222222.22222M,
                From            = "Order_From",
                DeliveryTo      = "Order_DeliveryTo",
                OrderAttachment = "Order_OrderAttachment",
            };
            var _transaction_transaction_deliverynotes = new DSS5_SupplyChainFinancialsOptimisation.BO.Transaction
            {
                TransactionDateOccured = now,
                TransactionValue       = 2222222222.22222M,
                FundedAmount           = 2222222222.22222M,
                ToBePaidAmount         = 2222222222.22222M,
                InvoicedDate           = now,
                PaymentStatus          = "Transaction_PaymentStatus",
                PaymentDate            = now,
                RestPaymentAmount      = 2222222222.22222M,
                PaidByBuyer            = true,
            };

            new PersistenceSpecification <DSS5_SupplyChainFinancialsOptimisation.BO.DeliveryNote>(Session)
            .CheckProperty(p => p.DeliveryNoteNumber, "DeliveryNote_DeliveryNoteNumber")
            .CheckProperty(p => p.Description, "DeliveryNote_Description")
            .CheckProperty(p => p.DateIssued, now)
            .CheckProperty(p => p.Amount, 2222222222222.22M)
            .CheckProperty(p => p.TotalPrice, 222222.22M)
            .CheckProperty(p => p.DNoteAttachment, "DeliveryNote_DNoteAttachment")
            .CheckBag(p => p.Products, (new List <DSS5_SupplyChainFinancialsOptimisation.BO.OrderProduct>
            {
                _deliverynote_products_deliverynote,
                _deliverynote_products_deliverynote2
            }))
            .CheckBag(p => p.DeliveryNoteProducts, (new List <DSS5_SupplyChainFinancialsOptimisation.BO.DeliveryNoteProduct>
            {
                _deliverynote_deliverynoteproducts_deliverynote,
                _deliverynote_deliverynoteproducts_deliverynote2
            }))
            .CheckBag(p => p.Orders, (new List <DSS5_SupplyChainFinancialsOptimisation.BO.Order>
            {
                _order_orders_deliverynotes,
                _order_orders_deliverynotes2
            }))
            .CheckReference(p => p.Transaction, _transaction_transaction_deliverynotes)
            .VerifyTheMappings();
        }
 public TrackingMapFormViewModel()
 {
     Order     = new DSS5_SupplyChainFinancialsOptimisation.BO.Order();
     MapPoints = new List <DSS5_SupplyChainFinancialsOptimisation.BO.MapPoint>();
 }
        public void Intermediary_persistence_test()
        {
            DateTime now = DateTime.Now;

            // Get datetime without milliseconds
            now = new DateTime(now.Ticks - (now.Ticks % TimeSpan.TicksPerSecond), now.Kind);
            var _order_orders_intermediaries = new DSS5_SupplyChainFinancialsOptimisation.BO.Order
            {
                OrderNumber             = "Order_OrderNumber",
                EstimatedDateOfDelivery = now,
                PaymentTerms            = "Order_PaymentTerms",
                IntermediateParty       = true,
                IsCancelled             = true,
                DateOfOrder             = now,
                OrderAmount             = 2222222222.22222M,
                TotalPrice      = 2222222222.22222M,
                From            = "Order_From",
                DeliveryTo      = "Order_DeliveryTo",
                OrderAttachment = "Order_OrderAttachment",
            };
            var _order_orders_intermediaries2 = new DSS5_SupplyChainFinancialsOptimisation.BO.Order
            {
                OrderNumber             = "Order_OrderNumber",
                EstimatedDateOfDelivery = now,
                PaymentTerms            = "Order_PaymentTerms",
                IntermediateParty       = true,
                IsCancelled             = true,
                DateOfOrder             = now,
                OrderAmount             = 2222222222.22222M,
                TotalPrice      = 2222222222.22222M,
                From            = "Order_From",
                DeliveryTo      = "Order_DeliveryTo",
                OrderAttachment = "Order_OrderAttachment",
            };
            var _transaction_transactions_intermediaries = new DSS5_SupplyChainFinancialsOptimisation.BO.Transaction
            {
                TransactionDateOccured = now,
                TransactionValue       = 2222222222.22222M,
                FundedAmount           = 2222222222.22222M,
                ToBePaidAmount         = 2222222222.22222M,
                InvoicedDate           = now,
                PaymentStatus          = "Transaction_PaymentStatus",
                PaymentDate            = now,
                RestPaymentAmount      = 2222222222.22222M,
                PaidByBuyer            = true,
            };
            var _transaction_transactions_intermediaries2 = new DSS5_SupplyChainFinancialsOptimisation.BO.Transaction
            {
                TransactionDateOccured = now,
                TransactionValue       = 2222222222.22222M,
                FundedAmount           = 2222222222.22222M,
                ToBePaidAmount         = 2222222222.22222M,
                InvoicedDate           = now,
                PaymentStatus          = "Transaction_PaymentStatus",
                PaymentDate            = now,
                RestPaymentAmount      = 2222222222.22222M,
                PaidByBuyer            = true,
            };

            new PersistenceSpecification <DSS5_SupplyChainFinancialsOptimisation.BO.Intermediary>(Session)
            .CheckProperty(p => p.OtherDescription, "Intermediary_OtherDescription")
            .CheckProperty(p => p.Company, "Intermediary_Company")
            .CheckProperty(p => p.EMail, "Intermediary_EMail")
            .CheckProperty(p => p.GUID, "Intermediary_GUID")
            .CheckBag(p => p.Orders, (new List <DSS5_SupplyChainFinancialsOptimisation.BO.Order>
            {
                _order_orders_intermediaries,
                _order_orders_intermediaries2
            }))
            .CheckBag(p => p.Transactions, (new List <DSS5_SupplyChainFinancialsOptimisation.BO.Transaction>
            {
                _transaction_transactions_intermediaries,
                _transaction_transactions_intermediaries2
            }))
            .VerifyTheMappings();
        }
Example #9
0
        public void CommercialAgreement_persistence_test()
        {
            DateTime now = DateTime.Now;

            // Get datetime without milliseconds
            now = new DateTime(now.Ticks - (now.Ticks % TimeSpan.TicksPerSecond), now.Kind);
            var _agreement_supplier_commercialagreements = new DSS5_SupplyChainFinancialsOptimisation.BO.Supplier
            {
                SupplierId              = 6701,
                Company                 = "Supplier_Company",
                CompanyLogo             = "Supplier_CompanyLogo",
                Business                = "Supplier_Business",
                CurrentAmount           = "Supplier_CurrentAmount",
                AverageAmount           = "Supplier_AverageAmount",
                PercentageOfCreditNotes = "Supplier_PercentageOfCreditNotes",
                PrimaryPhone            = "Supplier_PrimaryPhone",
                SecondaryPhone          = "Supplier_SecondaryPhone",
                Fax                     = "Supplier_Fax",
                WebSite                 = "Supplier_WebSite",
                AcceptedPolicyTerms     = true,
                SupplierStatus          = "Supplier_SupplierStatus",
                DomainFocus             = "Supplier_DomainFocus",
                EvaluationResult        = "Supplier_EvaluationResult",
                EvaluationCountResult   = 4053,
                AnnualTurnover          = true,
                BEnvironment            = true,
                PTerms                  = true,
                Average                 = true,
                InvoiceValue            = true,
                EqRatio                 = true,
                Prefix                  = "Supplier_Prefix",
                VATNumber               = "Supplier_VATNumber",
                MarketSegment           = "Supplier_MarketSegment",
                AdditionalComments      = "Supplier_AdditionalComments",
                AdditionalCommentsStep2 = "Supplier_AdditionalCommentsStep2",
                AdditionalCommentsStep3 = "Supplier_AdditionalCommentsStep3",
                UserName                = "******",
                PasswordHash            = "Supplier_PasswordHash",
                SecurityStamp           = "Supplier_SecurityStamp",
                EmailConfirmed          = true,
                LockoutEnabled          = true,
                PhoneNumberConfirmed    = true,
                TwoFactorEnabled        = true,
                AccessFailedCount       = 3664,
                Name                    = "Supplier_Name",
                Email                   = "Supplier_Email",
                PhoneNumber             = "Supplier_PhoneNumber",
                LockoutEndDate          = now,
            };
            var _agreement_buyer_commercialagreements = new DSS5_SupplyChainFinancialsOptimisation.BO.Buyer
            {
                BuyerId              = 4912,
                PrimaryPhone         = "Buyer_PrimaryPhone",
                SecondaryPhone       = "Buyer_SecondaryPhone",
                Fax                  = "Buyer_Fax",
                WebSite              = "Buyer_WebSite",
                Company              = "Buyer_Company",
                AnnualTurnOver       = 2222222222.22222M,
                LegalRepresentative  = "Buyer_LegalRepresentative",
                Rating               = "Buyer_Rating",
                CreditInsurance      = true,
                Logo                 = "Buyer_Logo",
                AddressOne           = "Buyer_AddressOne",
                AddressTwo           = "Buyer_AddressTwo",
                VatNumber            = "Buyer_VatNumber",
                ContactPerson        = "Buyer_ContactPerson",
                Prefix               = "Buyer_Prefix",
                Temp                 = "Buyer_Temp",
                UserName             = "******",
                PasswordHash         = "Buyer_PasswordHash",
                SecurityStamp        = "Buyer_SecurityStamp",
                EmailConfirmed       = true,
                LockoutEnabled       = true,
                PhoneNumberConfirmed = true,
                TwoFactorEnabled     = true,
                AccessFailedCount    = 4366,
                Name                 = "Buyer_Name",
                Email                = "Buyer_Email",
                PhoneNumber          = "Buyer_PhoneNumber",
                LockoutEndDate       = now,
            };
            var _agreement_orders_commercialagreement = new DSS5_SupplyChainFinancialsOptimisation.BO.Order
            {
                OrderNumber             = "Order_OrderNumber",
                EstimatedDateOfDelivery = now,
                PaymentTerms            = "Order_PaymentTerms",
                IntermediateParty       = true,
                IsCancelled             = true,
                DateOfOrder             = now,
                OrderAmount             = 2222222222.22222M,
                TotalPrice      = 2222222222.22222M,
                From            = "Order_From",
                DeliveryTo      = "Order_DeliveryTo",
                OrderAttachment = "Order_OrderAttachment",
            };
            var _agreement_orders_commercialagreement2 = new DSS5_SupplyChainFinancialsOptimisation.BO.Order
            {
                OrderNumber             = "Order_OrderNumber",
                EstimatedDateOfDelivery = now,
                PaymentTerms            = "Order_PaymentTerms",
                IntermediateParty       = true,
                IsCancelled             = true,
                DateOfOrder             = now,
                OrderAmount             = 2222222222.22222M,
                TotalPrice      = 2222222222.22222M,
                From            = "Order_From",
                DeliveryTo      = "Order_DeliveryTo",
                OrderAttachment = "Order_OrderAttachment",
            };
            var _agreement_importedbuyer_commercialagreement = new DSS5_SupplyChainFinancialsOptimisation.BO.ImportedBuyer
            {
                Code       = "ImportedBuyer_Code",
                VATNumber  = "ImportedBuyer_VATNumber",
                Company    = "ImportedBuyer_Company",
                AddressOne = "ImportedBuyer_AddressOne",
                AddressTwo = "ImportedBuyer_AddressTwo",
                Phone      = "ImportedBuyer_Phone",
            };
            var _agreement_transactions_commercialagreement = new DSS5_SupplyChainFinancialsOptimisation.BO.Transaction
            {
                TransactionDateOccured = now,
                TransactionValue       = 2222222222.22222M,
                FundedAmount           = 2222222222.22222M,
                ToBePaidAmount         = 2222222222.22222M,
                InvoicedDate           = now,
                PaymentStatus          = "Transaction_PaymentStatus",
                PaymentDate            = now,
                RestPaymentAmount      = 2222222222.22222M,
                PaidByBuyer            = true,
            };
            var _agreement_transactions_commercialagreement2 = new DSS5_SupplyChainFinancialsOptimisation.BO.Transaction
            {
                TransactionDateOccured = now,
                TransactionValue       = 2222222222.22222M,
                FundedAmount           = 2222222222.22222M,
                ToBePaidAmount         = 2222222222.22222M,
                InvoicedDate           = now,
                PaymentStatus          = "Transaction_PaymentStatus",
                PaymentDate            = now,
                RestPaymentAmount      = 2222222222.22222M,
                PaidByBuyer            = true,
            };
            var _agreement_agreement_commercialagreements = new DSS5_SupplyChainFinancialsOptimisation.BO.Agreement
            {
                StartDate              = now,
                EndDate                = now,
                FundedRate             = 222222.22M,
                FundedAmount           = 222222.22M,
                CurrentAgreementStatus = "Agreement_CurrentAgreementStatus",
                InterestRate           = 222222.22M,
            };

            new PersistenceSpecification <DSS5_SupplyChainFinancialsOptimisation.BO.CommercialAgreement>(Session)
            .CheckProperty(p => p.ProductCategory, "CommercialAgreement_ProductCategory")
            .CheckProperty(p => p.PaymentTerms, "CommercialAgreement_PaymentTerms")
            .CheckReference(p => p.Supplier, _agreement_supplier_commercialagreements)
            .CheckReference(p => p.Buyer, _agreement_buyer_commercialagreements)
            .CheckBag(p => p.Orders, (new List <DSS5_SupplyChainFinancialsOptimisation.BO.Order>
            {
                _agreement_orders_commercialagreement,
                _agreement_orders_commercialagreement2
            }))
            .CheckReference(p => p.ImportedBuyer, _agreement_importedbuyer_commercialagreement)
            .CheckBag(p => p.Transactions, (new List <DSS5_SupplyChainFinancialsOptimisation.BO.Transaction>
            {
                _agreement_transactions_commercialagreement,
                _agreement_transactions_commercialagreement2
            }))
            .CheckReference(p => p.Agreement, _agreement_agreement_commercialagreements)
            .VerifyTheMappings();
        }
Example #10
0
        public void BillOfLanding_persistence_test()
        {
            DateTime now = DateTime.Now;

            // Get datetime without milliseconds
            now = new DateTime(now.Ticks - (now.Ticks % TimeSpan.TicksPerSecond), now.Kind);
            var _billoflanding_meanoftransport_billoflading = new DSS5_SupplyChainFinancialsOptimisation.BO.MeanOfTransport
            {
                LicensePlate = "MeanOfTransport_LicensePlate",
                ContainerId  = "MeanOfTransport_ContainerId",
                ShipId       = "MeanOfTransport_ShipId",
                TrainId      = "MeanOfTransport_TrainId",
            };
            var _order_orders_billoflandings = new DSS5_SupplyChainFinancialsOptimisation.BO.Order
            {
                OrderNumber             = "Order_OrderNumber",
                EstimatedDateOfDelivery = now,
                PaymentTerms            = "Order_PaymentTerms",
                IntermediateParty       = true,
                IsCancelled             = true,
                DateOfOrder             = now,
                OrderAmount             = 2222222222.22222M,
                TotalPrice      = 2222222222.22222M,
                From            = "Order_From",
                DeliveryTo      = "Order_DeliveryTo",
                OrderAttachment = "Order_OrderAttachment",
            };
            var _order_orders_billoflandings2 = new DSS5_SupplyChainFinancialsOptimisation.BO.Order
            {
                OrderNumber             = "Order_OrderNumber",
                EstimatedDateOfDelivery = now,
                PaymentTerms            = "Order_PaymentTerms",
                IntermediateParty       = true,
                IsCancelled             = true,
                DateOfOrder             = now,
                OrderAmount             = 2222222222.22222M,
                TotalPrice      = 2222222222.22222M,
                From            = "Order_From",
                DeliveryTo      = "Order_DeliveryTo",
                OrderAttachment = "Order_OrderAttachment",
            };
            var _transaction_transaction_billoflandings = new DSS5_SupplyChainFinancialsOptimisation.BO.Transaction
            {
                TransactionDateOccured = now,
                TransactionValue       = 2222222222.22222M,
                FundedAmount           = 2222222222.22222M,
                ToBePaidAmount         = 2222222222.22222M,
                InvoicedDate           = now,
                PaymentStatus          = "Transaction_PaymentStatus",
                PaymentDate            = now,
                RestPaymentAmount      = 2222222222.22222M,
                PaidByBuyer            = true,
            };

            new PersistenceSpecification <DSS5_SupplyChainFinancialsOptimisation.BO.BillOfLanding>(Session)
            .CheckProperty(p => p.LandingPlace, "BillOfLanding_LandingPlace")
            .CheckProperty(p => p.LandingDate, now)
            .CheckProperty(p => p.DeliveryPlace, "BillOfLanding_DeliveryPlace")
            .CheckProperty(p => p.DeliveryDate, now)
            .CheckProperty(p => p.DOCNumber, 9936)
            .CheckProperty(p => p.ReceivingPartyId, 1800)
            .CheckProperty(p => p.IsBuyerReceiving, true)
            .CheckReference(p => p.MeanOfTransport, _billoflanding_meanoftransport_billoflading)
            .CheckBag(p => p.Orders, (new List <DSS5_SupplyChainFinancialsOptimisation.BO.Order>
            {
                _order_orders_billoflandings,
                _order_orders_billoflandings2
            }))
            .CheckReference(p => p.Transaction, _transaction_transaction_billoflandings)
            .VerifyTheMappings();
        }
        /*<ControllerActionImplementation:ImportRAYMETRICSCSV:1/>*/
        public ActionResult ExecuteImportRAYMETRICSCSV()
        {
            ActionResult _result = null;
            string       pathCSV = zAppDev.DotNet.Framework.Utilities.Web.MapPath(System.IO.Path.Combine("~/App_Data/Uploads", @model.rayPath));

            if ((pathCSV?.Contains("raymetrics") ?? false))
            {
                zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Warning, "DevTool", DSS5_SupplyChainFinancialsOptimisation.Hubs.EventsHub.RaiseDebugMessage, "raymetrics File Import");
                int?     rowCount     = 0;
                string[] entries      = null;
                string[] orderEntries = null;
                int?     test         = 0;
                DSS5_SupplyChainFinancialsOptimisation.BO.CommercialAgreement commercialAgreement            = new DSS5_SupplyChainFinancialsOptimisation.BO.CommercialAgreement();
                DSS5_SupplyChainFinancialsOptimisation.BO.ImportedBuyer       newImportedBuyer               = new DSS5_SupplyChainFinancialsOptimisation.BO.ImportedBuyer();
                System.Collections.Generic.List <DSS5_SupplyChainFinancialsOptimisation.BO.Order>   orders   = new System.Collections.Generic.List <DSS5_SupplyChainFinancialsOptimisation.BO.Order>();
                System.Collections.Generic.List <DSS5_SupplyChainFinancialsOptimisation.BO.Invoice> invoices = new System.Collections.Generic.List <DSS5_SupplyChainFinancialsOptimisation.BO.Invoice>();
                commercialAgreement.Supplier = new DSS5_SupplyChainFinancialsOptimisation.DAL.Repository().GetAsQueryable <DSS5_SupplyChainFinancialsOptimisation.BO.Supplier>((a) => a.UserName == "Supplier15")?.FirstOrDefault();
                System.Collections.Generic.List <string> delim = new System.Collections.Generic.List <string>();
                delim.Add("\r");
                delim.Add("\n");
                foreach (var row in System.IO.File.ReadAllText(pathCSV).SplitExtended(delim.ToArray(), true) ?? Enumerable.Empty <string>())
                {
                    if (((((row == null || row == "")) == false) && (((row == null || row.Trim() == "")) == false)))
                    {
                        entries = row?.SplitExtended(';', false);
                        if ((entries.Length > 0))
                        {
                            if (zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(entries, 0).StartsWith("Πελάτης"))
                            {
                                newImportedBuyer.Code = zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(entries, 1);
                                zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Warning, "DevTool", DSS5_SupplyChainFinancialsOptimisation.Hubs.EventsHub.RaiseDebugMessage, "Customer is " + (newImportedBuyer?.Code ?? ""));
                            }
                        }
                        else
                        {
                            zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Info, "DevTool", DSS5_SupplyChainFinancialsOptimisation.Hubs.EventsHub.RaiseDebugMessage, "Row: " + (rowCount?.ToString() ?? "") + "does not have 2 entries.");
                        }
                    }
                    else
                    {
                        zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Info, "DevTool", DSS5_SupplyChainFinancialsOptimisation.Hubs.EventsHub.RaiseDebugMessage, "Row " + (rowCount?.ToString() ?? "") + " did not have value.");
                    }
                    if (rowCount > 0)
                    {
                        zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Info, "DevTool", DSS5_SupplyChainFinancialsOptimisation.Hubs.EventsHub.RaiseDebugMessage, "order----> " + row);
                        orderEntries = row?.SplitExtended(';', false);
                        if (zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(orderEntries, 2).StartsWith("ΤΔΑ-Χ"))
                        {
                            DSS5_SupplyChainFinancialsOptimisation.BO.Invoice inv = new DSS5_SupplyChainFinancialsOptimisation.BO.Invoice();
                            inv.DateIssued    = zAppDev.DotNet.Framework.Utilities.Common.ParseExactDate(zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(orderEntries, 1), "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture).GetValueOrDefault(System.Data.SqlTypes.SqlDateTime.MinValue.Value);
                            inv.InvoiceNumber = zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(orderEntries, 3);
                            inv.Description   = zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(orderEntries, 5);
                            invoices?.Add(inv);
                            DSS5_SupplyChainFinancialsOptimisation.BO.Order order = new DSS5_SupplyChainFinancialsOptimisation.BO.Order();
                            order.DateOfOrder = zAppDev.DotNet.Framework.Utilities.Common.ParseExactDate(zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(orderEntries, 0), "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture).GetValueOrDefault(System.Data.SqlTypes.SqlDateTime.MinValue.Value);
                            order.OrderNumber = zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(orderEntries, 4);
                            order.Invoices    = invoices.ToList();
                            orders?.Add(order);
                        }
                        else if (zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(orderEntries, 2).StartsWith("EU-INV"))
                        {
                            DSS5_SupplyChainFinancialsOptimisation.BO.Invoice inv = new DSS5_SupplyChainFinancialsOptimisation.BO.Invoice();
                            inv.DateIssued    = zAppDev.DotNet.Framework.Utilities.Common.ParseExactDate(zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(orderEntries, 1), "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture).GetValueOrDefault(System.Data.SqlTypes.SqlDateTime.MinValue.Value);
                            inv.InvoiceNumber = zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(orderEntries, 3);
                            inv.Description   = zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(orderEntries, 5);
                            inv.CustomerType  = "EU Customer";
                            invoices?.Add(inv);
                            DSS5_SupplyChainFinancialsOptimisation.BO.Order order = new DSS5_SupplyChainFinancialsOptimisation.BO.Order();
                            order.DateOfOrder = zAppDev.DotNet.Framework.Utilities.Common.ParseExactDate(zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(orderEntries, 0), "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture).GetValueOrDefault(System.Data.SqlTypes.SqlDateTime.MinValue.Value);
                            order.OrderNumber = zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(orderEntries, 4);
                            order.Invoices    = invoices.ToList();
                            orders?.Add(order);
                        }
                        else if (zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(orderEntries, 2).StartsWith("NoE-INV"))
                        {
                            DSS5_SupplyChainFinancialsOptimisation.BO.Invoice inv = new DSS5_SupplyChainFinancialsOptimisation.BO.Invoice();
                            inv.DateIssued    = zAppDev.DotNet.Framework.Utilities.Common.ParseExactDate(zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(orderEntries, 1), "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture).GetValueOrDefault(System.Data.SqlTypes.SqlDateTime.MinValue.Value);
                            inv.InvoiceNumber = zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(orderEntries, 3);
                            inv.Description   = zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(orderEntries, 5);
                            inv.CustomerType  = "Non EU Customer";
                            invoices?.Add(inv);
                            DSS5_SupplyChainFinancialsOptimisation.BO.Order order = new DSS5_SupplyChainFinancialsOptimisation.BO.Order();
                            order.DateOfOrder = zAppDev.DotNet.Framework.Utilities.Common.ParseExactDate(zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(orderEntries, 0), "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture).GetValueOrDefault(System.Data.SqlTypes.SqlDateTime.MinValue.Value);
                            order.OrderNumber = zAppDev.DotNet.Framework.Utilities.Common.GetItemFromArray(orderEntries, 4);
                            order.Invoices    = invoices.ToList();
                            orders?.Add(order);
                        }
                    }
                    rowCount = rowCount.GetValueOrDefault(0) + 1;
                    commercialAgreement.Orders = orders.ToList();
                    new DSS5_SupplyChainFinancialsOptimisation.DAL.Repository().Save <DSS5_SupplyChainFinancialsOptimisation.BO.CommercialAgreement>(commercialAgreement);
                }
                zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Warning, "DevTool", DSS5_SupplyChainFinancialsOptimisation.Hubs.EventsHub.RaiseDebugMessage, "Rowcount " + (rowCount?.ToString() ?? ""));
            }
            return(_result);
        }
        public void Transaction_persistence_test()
        {
            DateTime now = DateTime.Now;

            // Get datetime without milliseconds
            now = new DateTime(now.Ticks - (now.Ticks % TimeSpan.TicksPerSecond), now.Kind);
            var _agreement_commercialagreement_transactions = new DSS5_SupplyChainFinancialsOptimisation.BO.CommercialAgreement
            {
                ProductCategory = "CommercialAgreement_ProductCategory",
                PaymentTerms    = "CommercialAgreement_PaymentTerms",
            };
            var _transaction_orders_transaction = new DSS5_SupplyChainFinancialsOptimisation.BO.Order
            {
                OrderNumber             = "Order_OrderNumber",
                EstimatedDateOfDelivery = now,
                PaymentTerms            = "Order_PaymentTerms",
                IntermediateParty       = true,
                IsCancelled             = true,
                DateOfOrder             = now,
                OrderAmount             = 2222222222.22222M,
                TotalPrice      = 2222222222.22222M,
                From            = "Order_From",
                DeliveryTo      = "Order_DeliveryTo",
                OrderAttachment = "Order_OrderAttachment",
            };
            var _transaction_orders_transaction2 = new DSS5_SupplyChainFinancialsOptimisation.BO.Order
            {
                OrderNumber             = "Order_OrderNumber",
                EstimatedDateOfDelivery = now,
                PaymentTerms            = "Order_PaymentTerms",
                IntermediateParty       = true,
                IsCancelled             = true,
                DateOfOrder             = now,
                OrderAmount             = 2222222222.22222M,
                TotalPrice      = 2222222222.22222M,
                From            = "Order_From",
                DeliveryTo      = "Order_DeliveryTo",
                OrderAttachment = "Order_OrderAttachment",
            };
            var _transaction_creditnotes_transaction = new DSS5_SupplyChainFinancialsOptimisation.BO.CreditNote
            {
                CreditNoteNumber   = "CreditNote_CreditNoteNumber",
                Description        = "CreditNote_Description",
                DateIssued         = now,
                Amount             = 2222222222.22222M,
                TotalPrice         = 2222222222.22222M,
                CreditNoteDocument = "CreditNote_CreditNoteDocument",
                CNoteAttachment    = "CreditNote_CNoteAttachment",
            };
            var _transaction_creditnotes_transaction2 = new DSS5_SupplyChainFinancialsOptimisation.BO.CreditNote
            {
                CreditNoteNumber   = "CreditNote_CreditNoteNumber",
                Description        = "CreditNote_Description",
                DateIssued         = now,
                Amount             = 2222222222.22222M,
                TotalPrice         = 2222222222.22222M,
                CreditNoteDocument = "CreditNote_CreditNoteDocument",
                CNoteAttachment    = "CreditNote_CNoteAttachment",
            };
            var _transaction_deliverynotes_transaction = new DSS5_SupplyChainFinancialsOptimisation.BO.DeliveryNote
            {
                DeliveryNoteNumber = "DeliveryNote_DeliveryNoteNumber",
                Description        = "DeliveryNote_Description",
                DateIssued         = now,
                Amount             = 2222222222222.22M,
                TotalPrice         = 222222.22M,
                DNoteAttachment    = "DeliveryNote_DNoteAttachment",
            };
            var _transaction_deliverynotes_transaction2 = new DSS5_SupplyChainFinancialsOptimisation.BO.DeliveryNote
            {
                DeliveryNoteNumber = "DeliveryNote_DeliveryNoteNumber",
                Description        = "DeliveryNote_Description",
                DateIssued         = now,
                Amount             = 2222222222222.22M,
                TotalPrice         = 222222.22M,
                DNoteAttachment    = "DeliveryNote_DNoteAttachment",
            };
            var _transaction_invoices_transaction = new DSS5_SupplyChainFinancialsOptimisation.BO.Invoice
            {
                InvoiceNumber     = "Invoice_InvoiceNumber",
                Description       = "Invoice_Description",
                DateIssued        = now,
                Amount            = 2222222222222.22M,
                CustomerType      = "Invoice_CustomerType",
                CumulativeBalance = 222222.22M,
                TotalPrice        = 222222.22M,
                DescriptionTwo    = "Invoice_DescriptionTwo",
                Attribute         = "Invoice_Attribute",
                InvoiceAttachment = "Invoice_InvoiceAttachment",
            };
            var _transaction_invoices_transaction2 = new DSS5_SupplyChainFinancialsOptimisation.BO.Invoice
            {
                InvoiceNumber     = "Invoice_InvoiceNumber",
                Description       = "Invoice_Description",
                DateIssued        = now,
                Amount            = 2222222222222.22M,
                CustomerType      = "Invoice_CustomerType",
                CumulativeBalance = 222222.22M,
                TotalPrice        = 222222.22M,
                DescriptionTwo    = "Invoice_DescriptionTwo",
                Attribute         = "Invoice_Attribute",
                InvoiceAttachment = "Invoice_InvoiceAttachment",
            };
            var _transaction_proofofdeliveries_transaction = new DSS5_SupplyChainFinancialsOptimisation.BO.ProofOfDelivery
            {
                PODNumber      = "ProofOfDelivery_PODNumber",
                DateIssued     = now,
                QualityStatus  = "ProofOfDelivery_QualityStatus",
                QuantityStatus = "ProofOfDelivery_QuantityStatus",
                DeliveryStatus = "ProofOfDelivery_DeliveryStatus",
                PODAttachment  = "ProofOfDelivery_PODAttachment",
                Comments       = "ProofOfDelivery_Comments",
            };
            var _transaction_proofofdeliveries_transaction2 = new DSS5_SupplyChainFinancialsOptimisation.BO.ProofOfDelivery
            {
                PODNumber      = "ProofOfDelivery_PODNumber",
                DateIssued     = now,
                QualityStatus  = "ProofOfDelivery_QualityStatus",
                QuantityStatus = "ProofOfDelivery_QuantityStatus",
                DeliveryStatus = "ProofOfDelivery_DeliveryStatus",
                PODAttachment  = "ProofOfDelivery_PODAttachment",
                Comments       = "ProofOfDelivery_Comments",
            };
            var _transaction_transactionstatus_transaction = new DSS5_SupplyChainFinancialsOptimisation.BO.TransactionStatus
            {
                TransactionDateOccured = now,
                Status              = "TransactionStatus_Status",
                Shipped             = true,
                Invoiced            = true,
                ShippedDateOccured  = now,
                InvoicedDateOccured = now,
                Cancelled           = true,
                InTransit           = true,
                Picked              = true,
                PaymentStatus       = true,
                InitialOrderDate    = now,
                FinalOrderDate      = now,
                Delivered           = true,
                Ordered             = true,
            };
            var _transaction_supplier_transactions = new DSS5_SupplyChainFinancialsOptimisation.BO.Supplier
            {
                SupplierId              = 5635,
                Company                 = "Supplier_Company",
                CompanyLogo             = "Supplier_CompanyLogo",
                Business                = "Supplier_Business",
                CurrentAmount           = "Supplier_CurrentAmount",
                AverageAmount           = "Supplier_AverageAmount",
                PercentageOfCreditNotes = "Supplier_PercentageOfCreditNotes",
                PrimaryPhone            = "Supplier_PrimaryPhone",
                SecondaryPhone          = "Supplier_SecondaryPhone",
                Fax                     = "Supplier_Fax",
                WebSite                 = "Supplier_WebSite",
                AcceptedPolicyTerms     = true,
                SupplierStatus          = "Supplier_SupplierStatus",
                DomainFocus             = "Supplier_DomainFocus",
                EvaluationResult        = "Supplier_EvaluationResult",
                EvaluationCountResult   = 7465,
                AnnualTurnover          = true,
                BEnvironment            = true,
                PTerms                  = true,
                Average                 = true,
                InvoiceValue            = true,
                EqRatio                 = true,
                Prefix                  = "Supplier_Prefix",
                VATNumber               = "Supplier_VATNumber",
                MarketSegment           = "Supplier_MarketSegment",
                AdditionalComments      = "Supplier_AdditionalComments",
                AdditionalCommentsStep2 = "Supplier_AdditionalCommentsStep2",
                AdditionalCommentsStep3 = "Supplier_AdditionalCommentsStep3",
                UserName                = "******",
                PasswordHash            = "Supplier_PasswordHash",
                SecurityStamp           = "Supplier_SecurityStamp",
                EmailConfirmed          = true,
                LockoutEnabled          = true,
                PhoneNumberConfirmed    = true,
                TwoFactorEnabled        = true,
                AccessFailedCount       = 2744,
                Name                    = "Supplier_Name",
                Email                   = "Supplier_Email",
                PhoneNumber             = "Supplier_PhoneNumber",
                LockoutEndDate          = now,
            };
            var _transaction_importedbuyer_transactions = new DSS5_SupplyChainFinancialsOptimisation.BO.ImportedBuyer
            {
                Code       = "ImportedBuyer_Code",
                VATNumber  = "ImportedBuyer_VATNumber",
                Company    = "ImportedBuyer_Company",
                AddressOne = "ImportedBuyer_AddressOne",
                AddressTwo = "ImportedBuyer_AddressTwo",
                Phone      = "ImportedBuyer_Phone",
            };
            var _transaction_letterofcredits_transaction = new DSS5_SupplyChainFinancialsOptimisation.BO.LetterOfCredit
            {
                ValueOfLoC     = 222222.22M,
                IssuingBank    = "LetterOfCredit_IssuingBank",
                Detail         = "LetterOfCredit_Detail",
                UploadOfScan   = "LetterOfCredit_UploadOfScan",
                Calculated     = 222222.22M,
                DateOfValidity = now,
                DateOfExpiry   = now,
            };
            var _transaction_letterofcredits_transaction2 = new DSS5_SupplyChainFinancialsOptimisation.BO.LetterOfCredit
            {
                ValueOfLoC     = 222222.22M,
                IssuingBank    = "LetterOfCredit_IssuingBank",
                Detail         = "LetterOfCredit_Detail",
                UploadOfScan   = "LetterOfCredit_UploadOfScan",
                Calculated     = 222222.22M,
                DateOfValidity = now,
                DateOfExpiry   = now,
            };
            var _transaction_intermediaries_transactions = new DSS5_SupplyChainFinancialsOptimisation.BO.Intermediary
            {
                OtherDescription = "Intermediary_OtherDescription",
                Company          = "Intermediary_Company",
                EMail            = "Intermediary_EMail",
                GUID             = "Intermediary_GUID",
            };
            var _transaction_intermediaries_transactions2 = new DSS5_SupplyChainFinancialsOptimisation.BO.Intermediary
            {
                OtherDescription = "Intermediary_OtherDescription",
                Company          = "Intermediary_Company",
                EMail            = "Intermediary_EMail",
                GUID             = "Intermediary_GUID",
            };
            var _transaction_partialproofofdeliveries_transaction = new DSS5_SupplyChainFinancialsOptimisation.BO.PartialProofOfDelivery
            {
                PODNumber      = "PartialProofOfDelivery_PODNumber",
                DateIssued     = now,
                QualityStatus  = "PartialProofOfDelivery_QualityStatus",
                QuantityStatus = "PartialProofOfDelivery_QuantityStatus",
                DeliveryStatus = "PartialProofOfDelivery_DeliveryStatus",
                PODAttachment  = "PartialProofOfDelivery_PODAttachment",
                Comments       = "PartialProofOfDelivery_Comments",
            };
            var _transaction_partialproofofdeliveries_transaction2 = new DSS5_SupplyChainFinancialsOptimisation.BO.PartialProofOfDelivery
            {
                PODNumber      = "PartialProofOfDelivery_PODNumber",
                DateIssued     = now,
                QualityStatus  = "PartialProofOfDelivery_QualityStatus",
                QuantityStatus = "PartialProofOfDelivery_QuantityStatus",
                DeliveryStatus = "PartialProofOfDelivery_DeliveryStatus",
                PODAttachment  = "PartialProofOfDelivery_PODAttachment",
                Comments       = "PartialProofOfDelivery_Comments",
            };
            var _transaction_customsclearingdocumentations_transaction = new DSS5_SupplyChainFinancialsOptimisation.BO.CustomsClearingDocumentation
            {
                CustomsClearingDate = now,
                ExportingCountry    = "CustomsClearingDocumentation_ExportingCountry",
                ImportingCountry    = "CustomsClearingDocumentation_ImportingCountry",
                BuyerName           = "CustomsClearingDocumentation_BuyerName",
            };
            var _transaction_customsclearingdocumentations_transaction2 = new DSS5_SupplyChainFinancialsOptimisation.BO.CustomsClearingDocumentation
            {
                CustomsClearingDate = now,
                ExportingCountry    = "CustomsClearingDocumentation_ExportingCountry",
                ImportingCountry    = "CustomsClearingDocumentation_ImportingCountry",
                BuyerName           = "CustomsClearingDocumentation_BuyerName",
            };
            var _transaction_billoflandings_transaction = new DSS5_SupplyChainFinancialsOptimisation.BO.BillOfLanding
            {
                LandingPlace     = "BillOfLanding_LandingPlace",
                LandingDate      = now,
                DeliveryPlace    = "BillOfLanding_DeliveryPlace",
                DeliveryDate     = now,
                DOCNumber        = 5377,
                ReceivingPartyId = 8383,
                IsBuyerReceiving = true,
            };
            var _transaction_billoflandings_transaction2 = new DSS5_SupplyChainFinancialsOptimisation.BO.BillOfLanding
            {
                LandingPlace     = "BillOfLanding_LandingPlace",
                LandingDate      = now,
                DeliveryPlace    = "BillOfLanding_DeliveryPlace",
                DeliveryDate     = now,
                DOCNumber        = 1637,
                ReceivingPartyId = 8022,
                IsBuyerReceiving = true,
            };
            var _transaction_transactionoverview_transaction = new DSS5_SupplyChainFinancialsOptimisation.BO.TransactionOverview
            {
                DeliveryDate     = now,
                OrderQuantity    = 2222222222.22222M,
                OrderDate        = now,
                InvoiceId        = 7059,
                InvoiceDate      = now,
                FundedRate       = 2222222222.22222M,
                InterestRate     = 2222222222.22222M,
                TotalValue       = 2222222222.22222M,
                FundingValue     = 2222222222.22222M,
                PaymentId        = 4011,
                PayementDate     = now,
                CreditNoteNumber = "TransactionOverview_CreditNoteNumber",
            };

            new PersistenceSpecification <DSS5_SupplyChainFinancialsOptimisation.BO.Transaction>(Session)
            .CheckProperty(p => p.TransactionDateOccured, now)
            .CheckProperty(p => p.ToBePaidAmount, 2222222222.22222M)
            .CheckProperty(p => p.InvoicedDate, now)
            .CheckProperty(p => p.PaymentStatus, "Transaction_PaymentStatus")
            .CheckProperty(p => p.PaymentDate, now)
            .CheckProperty(p => p.RestPaymentAmount, 2222222222.22222M)
            .CheckProperty(p => p.PaidByBuyer, true)
            .CheckReference(p => p.CommercialAgreement, _agreement_commercialagreement_transactions)
            .CheckBag(p => p.Orders, (new List <DSS5_SupplyChainFinancialsOptimisation.BO.Order>
            {
                _transaction_orders_transaction,
                _transaction_orders_transaction2
            }))
            .CheckBag(p => p.CreditNotes, (new List <DSS5_SupplyChainFinancialsOptimisation.BO.CreditNote>
            {
                _transaction_creditnotes_transaction,
                _transaction_creditnotes_transaction2
            }))
            .CheckBag(p => p.DeliveryNotes, (new List <DSS5_SupplyChainFinancialsOptimisation.BO.DeliveryNote>
            {
                _transaction_deliverynotes_transaction,
                _transaction_deliverynotes_transaction2
            }))
            .CheckBag(p => p.Invoices, (new List <DSS5_SupplyChainFinancialsOptimisation.BO.Invoice>
            {
                _transaction_invoices_transaction,
                _transaction_invoices_transaction2
            }))
            .CheckBag(p => p.ProofOfDeliveries, (new List <DSS5_SupplyChainFinancialsOptimisation.BO.ProofOfDelivery>
            {
                _transaction_proofofdeliveries_transaction,
                _transaction_proofofdeliveries_transaction2
            }))
            .CheckReference(p => p.TransactionStatus, _transaction_transactionstatus_transaction)
            .CheckReference(p => p.Supplier, _transaction_supplier_transactions)
            .CheckReference(p => p.ImportedBuyer, _transaction_importedbuyer_transactions)
            .CheckBag(p => p.LetterOfCredits, (new List <DSS5_SupplyChainFinancialsOptimisation.BO.LetterOfCredit>
            {
                _transaction_letterofcredits_transaction,
                _transaction_letterofcredits_transaction2
            }))
            .CheckBag(p => p.Intermediaries, (new List <DSS5_SupplyChainFinancialsOptimisation.BO.Intermediary>
            {
                _transaction_intermediaries_transactions,
                _transaction_intermediaries_transactions2
            }))
            .CheckBag(p => p.PartialProofOfDeliveries, (new List <DSS5_SupplyChainFinancialsOptimisation.BO.PartialProofOfDelivery>
            {
                _transaction_partialproofofdeliveries_transaction,
                _transaction_partialproofofdeliveries_transaction2
            }))
            .CheckBag(p => p.CustomsClearingDocumentations, (new List <DSS5_SupplyChainFinancialsOptimisation.BO.CustomsClearingDocumentation>
            {
                _transaction_customsclearingdocumentations_transaction,
                _transaction_customsclearingdocumentations_transaction2
            }))
            .CheckBag(p => p.BillOfLandings, (new List <DSS5_SupplyChainFinancialsOptimisation.BO.BillOfLanding>
            {
                _transaction_billoflandings_transaction,
                _transaction_billoflandings_transaction2
            }))
            .CheckReference(p => p.TransactionOverview, _transaction_transactionoverview_transaction)
            .VerifyTheMappings();
        }