コード例 #1
0
/// <summary>
/// Copies the current object to a new instance
/// </summary>
/// <param name="deep">Copy members that refer to objects external to this class (not dependent)</param>
/// <param name="copiedObjects">Objects that should be reused</param>
/// <param name="asNew">Copy the current object as a new one, ready to be persisted, along all its members.</param>
/// <param name="reuseNestedObjects">If asNew is true, this flag if set, forces the reuse of all external objects.</param>
/// <param name="copy">Optional - An existing [SupplierContactInformation] instance to use as the destination.</param>
/// <returns>A copy of the object</returns>
        public virtual SupplierContactInformation Copy(bool deep = false, Hashtable copiedObjects = null, bool asNew = false, bool reuseNestedObjects = false, SupplierContactInformation copy = null)
        {
            if (copiedObjects == null)
            {
                copiedObjects = new Hashtable();
            }
            if (copy == null && copiedObjects.Contains(this))
            {
                return((SupplierContactInformation)copiedObjects[this]);
            }
            copy = copy ?? new SupplierContactInformation();
            if (!asNew)
            {
                copy.TransientId = this.TransientId;
                copy.Id          = this.Id;
            }
            copy.ContactPerson    = this.ContactPerson;
            copy.AddressOne       = this.AddressOne;
            copy.AddressTwo       = this.AddressTwo;
            copy.Telephone        = this.Telephone;
            copy.Email            = this.Email;
            copy.ManagingDirector = this.ManagingDirector;
            copy.EstablishedIn    = this.EstablishedIn;
            if (!copiedObjects.Contains(this))
            {
                copiedObjects.Add(this, copy);
            }
            return(copy);
        }
コード例 #2
0
/// <summary>
///     Returns true if self and the provided entity have the same Id values
///     and the Ids are not of the default Id value
/// </summary>
        protected bool HasSameNonDefaultIdAs(SupplierContactInformation compareTo)
        {
            return(!this.IsTransient() && !compareTo.IsTransient() && this.Id.Equals(compareTo.Id));
        }
        public void Supplier_persistence_test()
        {
            DateTime now = DateTime.Now;

            // Get datetime without milliseconds
            now = new DateTime(now.Ticks - (now.Ticks % TimeSpan.TicksPerSecond), now.Kind);
            var _agreement_commercialagreements_supplier = new DSS5_SupplyChainFinancialsOptimisation.BO.CommercialAgreement
            {
                ProductCategory = "CommercialAgreement_ProductCategory",
                PaymentTerms    = "CommercialAgreement_PaymentTerms",
            };
            var _agreement_commercialagreements_supplier2 = new DSS5_SupplyChainFinancialsOptimisation.BO.CommercialAgreement
            {
                ProductCategory = "CommercialAgreement_ProductCategory",
                PaymentTerms    = "CommercialAgreement_PaymentTerms",
            };
            var _agreement_agreements_supplier = new DSS5_SupplyChainFinancialsOptimisation.BO.Agreement
            {
                StartDate              = now,
                EndDate                = now,
                FundedRate             = 222222.22M,
                FundedAmount           = 222222.22M,
                CurrentAgreementStatus = "Agreement_CurrentAgreementStatus",
                InterestRate           = 222222.22M,
            };
            var _agreement_agreements_supplier2 = new DSS5_SupplyChainFinancialsOptimisation.BO.Agreement
            {
                StartDate              = now,
                EndDate                = now,
                FundedRate             = 222222.22M,
                FundedAmount           = 222222.22M,
                CurrentAgreementStatus = "Agreement_CurrentAgreementStatus",
                InterestRate           = 222222.22M,
            };
            var _supplier_supplierbusinessstructuredata_supplier = new DSS5_SupplyChainFinancialsOptimisation.BO.SupplierBusinessStructureData
            {
                NumOfCustomersD           = 8305,
                NumOfCustomersAbroad      = 2564,
                NumOfCustomersEU          = 7939,
                NumOfCustomers            = 9311,
                ThereofActiveD            = 1730,
                ThereofActiveAbroad       = 3597,
                ThereofActiveEU           = 6691,
                ThereofActive             = 9832,
                NumOfOccasionalCustD      = 5778,
                NumOfOccasionalCustAbroad = 9576,
                NumOfOccasionalCustEU     = 8968,
                NumOfOccasionalCust       = 5981,
                NumOpenBalanceD           = 3463,
                NumOpenBalanceAboad       = 7036,
                NumOpenBalanceEU          = 7273,
                NumOpenBalance            = 4600,
                NumOfInvoicesD            = 9503,
                NumOfInvoicesAbroad       = 5853,
                NumOfInvoicesEU           = 7845,
                NumOfInvoices             = 1007,
                NumOfEmployeesD           = 7719,
                NumOfEmployeesAbroad      = 6432,
                NumTransCustD             = 7582,
                NumTransCustAbroad        = 7573,
                NumTransCustEU            = 2899,
                NumTransCust            = 6393,
                ApplicableCommercialLaw = "SupplierBusinessStructureData_ApplicableCommercialLaw",
                Jurisdiction            = "SupplierBusinessStructureData_Jurisdiction",
            };
            var _supplier_supplierreceivables_supplier = new DSS5_SupplyChainFinancialsOptimisation.BO.SupplierReceivables
            {
                DomesticCustomersPresent     = 2222222222.22222M,
                DomesticCustomersPrior       = 2222222222.22222M,
                EUCustomersPresent           = 2222222222.22222M,
                EUCustomersPrior             = 2222222222.22222M,
                ThirdCountryCustomersPresent = 2222222222.22222M,
                ThirdCountryCustomersPrior   = 2222222222.22222M,
                WillUploadFiles = true,
                TotalPrior      = 2222222222.22222M,
                TotalPresent    = 2222222222.22222M,
            };
            var _supplier_suppliercontactinformation_supplier = new DSS5_SupplyChainFinancialsOptimisation.BO.SupplierContactInformation
            {
                ContactPerson    = "SupplierContactInformation_ContactPerson",
                AddressOne       = "SupplierContactInformation_AddressOne",
                AddressTwo       = "SupplierContactInformation_AddressTwo",
                Telephone        = "SupplierContactInformation_Telephone",
                Email            = "SupplierContactInformation_Email",
                ManagingDirector = "SupplierContactInformation_ManagingDirector",
                EstablishedIn    = "SupplierContactInformation_EstablishedIn",
            };
            var _supplier_supplierturnover_supplier = new DSS5_SupplyChainFinancialsOptimisation.BO.SupplierTurnover
            {
                PlannedCurrentYear       = 2222222222.22222M,
                PlannedCurrentYearD      = 2222222222.22222M,
                PlannedCurrentYearEU     = 2222222222.22222M,
                PlannedCurrentYearAbroad = 2222222222.22222M,
                PlannedNextYear          = 2222222222.22222M,
                PlannedNextYearD         = 2222222222.22222M,
                PlannedNextYearEU        = 2222222222.22222M,
                PlannedNextYearAbroad    = 2222222222.22222M,
                ActualPreviousYear       = 2222222222.22222M,
                ActualPreviousYearAbroad = 2222222222.22222M,
                ActualPreviousYearD      = 2222222222.22222M,
                ActualPreviousYearEU     = 2222222222.22222M,
                PercentageD        = 2222222222.22222M,
                PercentageEU       = 2222222222.22222M,
                PercentageAbroad   = 2222222222.22222M,
                PercentageCND      = 2222222222.22222M,
                PercentageCNEU     = 2222222222.22222M,
                PercentageCNAbroad = 2222222222.22222M,
                PercentageSales    = 2222222222.22222M,
                PercentageCN       = 2222222222.22222M,
            };
            var _supplier_supplierextrainformation_supplier = new DSS5_SupplyChainFinancialsOptimisation.BO.SupplierExtraInformation
            {
                OccurenceBadDebts      = "SupplierExtraInformation_OccurenceBadDebts",
                ExistenceCounterClaims = "SupplierExtraInformation_ExistenceCounterClaims",
                HasCompanyAssigned     = "SupplierExtraInformation_HasCompanyAssigned",
                AreCompanyReceivables  = "SupplierExtraInformation_AreCompanyReceivables",
            };
            var _supplier_financialstatements_supplier = new DSS5_SupplyChainFinancialsOptimisation.BO.SupplierUploads
            {
                Path = "SupplierUploads_Path",
            };
            var _supplier_financialstatements_supplier2 = new DSS5_SupplyChainFinancialsOptimisation.BO.SupplierUploads
            {
                Path = "SupplierUploads_Path",
            };
            var _supplier_economicevaluations_supplier2 = new DSS5_SupplyChainFinancialsOptimisation.BO.SupplierUploads
            {
                Path = "SupplierUploads_Path",
            };
            var _supplier_economicevaluations_supplier22 = new DSS5_SupplyChainFinancialsOptimisation.BO.SupplierUploads
            {
                Path = "SupplierUploads_Path",
            };
            var _supplier_businessplans_supplier = new DSS5_SupplyChainFinancialsOptimisation.BO.SupplierUploads
            {
                Path = "SupplierUploads_Path",
            };
            var _supplier_businessplans_supplier2 = new DSS5_SupplyChainFinancialsOptimisation.BO.SupplierUploads
            {
                Path = "SupplierUploads_Path",
            };
            var _supplier_prioroutstandingbalances_supplier = new DSS5_SupplyChainFinancialsOptimisation.BO.SupplierUploads
            {
                Path = "SupplierUploads_Path",
            };
            var _supplier_prioroutstandingbalances_supplier2 = new DSS5_SupplyChainFinancialsOptimisation.BO.SupplierUploads
            {
                Path = "SupplierUploads_Path",
            };
            var _supplier_outstandingbalances_supplier = new DSS5_SupplyChainFinancialsOptimisation.BO.SupplierUploads
            {
                Path = "SupplierUploads_Path",
            };
            var _supplier_outstandingbalances_supplier2 = new DSS5_SupplyChainFinancialsOptimisation.BO.SupplierUploads
            {
                Path = "SupplierUploads_Path",
            };
            var _supplier_currentsituations_supplier = new DSS5_SupplyChainFinancialsOptimisation.BO.SupplierUploads
            {
                Path = "SupplierUploads_Path",
            };
            var _supplier_currentsituations_supplier2 = new DSS5_SupplyChainFinancialsOptimisation.BO.SupplierUploads
            {
                Path = "SupplierUploads_Path",
            };
            var _supplier_currentstatements_supplier = new DSS5_SupplyChainFinancialsOptimisation.BO.SupplierUploads
            {
                Path = "SupplierUploads_Path",
            };
            var _supplier_currentstatements_supplier2 = new DSS5_SupplyChainFinancialsOptimisation.BO.SupplierUploads
            {
                Path = "SupplierUploads_Path",
            };
            var _supplier_currentcredits_supplier = new DSS5_SupplyChainFinancialsOptimisation.BO.SupplierUploads
            {
                Path = "SupplierUploads_Path",
            };
            var _supplier_currentcredits_supplier2 = new DSS5_SupplyChainFinancialsOptimisation.BO.SupplierUploads
            {
                Path = "SupplierUploads_Path",
            };
            var _supplier_factoringagreements_supplier = new DSS5_SupplyChainFinancialsOptimisation.BO.SupplierUploads
            {
                Path = "SupplierUploads_Path",
            };
            var _supplier_factoringagreements_supplier2 = new DSS5_SupplyChainFinancialsOptimisation.BO.SupplierUploads
            {
                Path = "SupplierUploads_Path",
            };
            var _supplier_customeragreements_supplier = new DSS5_SupplyChainFinancialsOptimisation.BO.SupplierUploads
            {
                Path = "SupplierUploads_Path",
            };
            var _supplier_customeragreements_supplier2 = new DSS5_SupplyChainFinancialsOptimisation.BO.SupplierUploads
            {
                Path = "SupplierUploads_Path",
            };
            var _supplier_generalconstractuals_supplier = new DSS5_SupplyChainFinancialsOptimisation.BO.SupplierUploads
            {
                Path = "SupplierUploads_Path",
            };
            var _supplier_generalconstractuals_supplier2 = new DSS5_SupplyChainFinancialsOptimisation.BO.SupplierUploads
            {
                Path = "SupplierUploads_Path",
            };
            var _supplier_organizationalcharts_supplier = new DSS5_SupplyChainFinancialsOptimisation.BO.SupplierUploads
            {
                Path = "SupplierUploads_Path",
            };
            var _supplier_organizationalcharts_supplier2 = new DSS5_SupplyChainFinancialsOptimisation.BO.SupplierUploads
            {
                Path = "SupplierUploads_Path",
            };
            var _supplier_invoicesforms_supplier = new DSS5_SupplyChainFinancialsOptimisation.BO.SupplierUploads
            {
                Path = "SupplierUploads_Path",
            };
            var _supplier_invoicesforms_supplier2 = new DSS5_SupplyChainFinancialsOptimisation.BO.SupplierUploads
            {
                Path = "SupplierUploads_Path",
            };
            var _supplier_declarations_supplier = new DSS5_SupplyChainFinancialsOptimisation.BO.SupplierUploads
            {
                Path = "SupplierUploads_Path",
            };
            var _supplier_declarations_supplier2 = new DSS5_SupplyChainFinancialsOptimisation.BO.SupplierUploads
            {
                Path = "SupplierUploads_Path",
            };
            var _supplier_supplierevaluation_supplier = new DSS5_SupplyChainFinancialsOptimisation.BO.SupplierEvaluation
            {
                Environment             = "SupplierEvaluation_Environment",
                ContractualPaymentTerms = 2222222222.22222M,
                Average             = 2222222222.22222M,
                AverageInvoiceValue = 2222222222.22222M,
                EquityRatio         = 2222222222.22222M,
            };
            var _supplier_dataquality_supplier = new DSS5_SupplyChainFinancialsOptimisation.BO.DataQuality
            {
                Orders                = true,
                DeliveryNotes         = true,
                CustomsDocuments      = true,
                IntermediaryLogistics = true,
                Invoices              = true,
                PoDs        = true,
                PaymentData = true,
            };
            var _supplier_dataavailability_supplier = new DSS5_SupplyChainFinancialsOptimisation.BO.DataAvailability
            {
                Orders                = true,
                DeliveryNotes         = true,
                CustomsDocuments      = true,
                IntermediaryLogistics = true,
                Invoices              = true,
                PoDs        = true,
                PaymentData = true,
            };
            var _supplierproduct_supplierproducts_supplier = new DSS5_SupplyChainFinancialsOptimisation.BO.SupplierProduct
            {
                Code            = "SupplierProduct_Code",
                Description     = "SupplierProduct_Description",
                UnitValue       = "SupplierProduct_UnitValue",
                MeasurementUnit = "SupplierProduct_MeasurementUnit",
                Price           = 222222.22M,
            };
            var _supplierproduct_supplierproducts_supplier2 = new DSS5_SupplyChainFinancialsOptimisation.BO.SupplierProduct
            {
                Code            = "SupplierProduct_Code",
                Description     = "SupplierProduct_Description",
                UnitValue       = "SupplierProduct_UnitValue",
                MeasurementUnit = "SupplierProduct_MeasurementUnit",
                Price           = 222222.22M,
            };
            var _transaction_transactions_supplier = 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_supplier2 = 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.Supplier>(Session)
            .CheckProperty(p => p.SupplierId, 7413)
            .CheckProperty(p => p.Company, "Supplier_Company")
            .CheckProperty(p => p.CompanyLogo, "Supplier_CompanyLogo")
            .CheckProperty(p => p.Business, "Supplier_Business")
            .CheckProperty(p => p.CurrentAmount, "Supplier_CurrentAmount")
            .CheckProperty(p => p.AverageAmount, "Supplier_AverageAmount")
            .CheckProperty(p => p.PercentageOfCreditNotes, "Supplier_PercentageOfCreditNotes")
            .CheckProperty(p => p.PrimaryPhone, "Supplier_PrimaryPhone")
            .CheckProperty(p => p.SecondaryPhone, "Supplier_SecondaryPhone")
            .CheckProperty(p => p.Fax, "Supplier_Fax")
            .CheckProperty(p => p.WebSite, "Supplier_WebSite")
            .CheckProperty(p => p.AcceptedPolicyTerms, true)
            .CheckProperty(p => p.SupplierStatus, "Supplier_SupplierStatus")
            .CheckProperty(p => p.DomainFocus, "Supplier_DomainFocus")
            .CheckProperty(p => p.EvaluationResult, "Supplier_EvaluationResult")
            .CheckProperty(p => p.EvaluationCountResult, 5378)
            .CheckProperty(p => p.AnnualTurnover, true)
            .CheckProperty(p => p.BEnvironment, true)
            .CheckProperty(p => p.PTerms, true)
            .CheckProperty(p => p.Average, true)
            .CheckProperty(p => p.InvoiceValue, true)
            .CheckProperty(p => p.EqRatio, true)
            .CheckProperty(p => p.Prefix, "Supplier_Prefix")
            .CheckProperty(p => p.VATNumber, "Supplier_VATNumber")
            .CheckProperty(p => p.MarketSegment, "Supplier_MarketSegment")
            .CheckProperty(p => p.AdditionalComments, "Supplier_AdditionalComments")
            .CheckProperty(p => p.AdditionalCommentsStep2, "Supplier_AdditionalCommentsStep2")
            .CheckProperty(p => p.AdditionalCommentsStep3, "Supplier_AdditionalCommentsStep3")
            .CheckProperty(p => p.UserName, "5751132e-819d-430c-9606-abc087f96970Supplier_UserName")
            .CheckProperty(p => p.PasswordHash, "Supplier_PasswordHash")
            .CheckProperty(p => p.SecurityStamp, "Supplier_SecurityStamp")
            .CheckProperty(p => p.EmailConfirmed, true)
            .CheckProperty(p => p.LockoutEnabled, true)
            .CheckProperty(p => p.PhoneNumberConfirmed, true)
            .CheckProperty(p => p.TwoFactorEnabled, true)
            .CheckProperty(p => p.AccessFailedCount, 7261)
            .CheckProperty(p => p.Name, "Supplier_Name")
            .CheckProperty(p => p.Email, "Supplier_Email")
            .CheckProperty(p => p.PhoneNumber, "Supplier_PhoneNumber")
            .CheckProperty(p => p.LockoutEndDate, now)
            .CheckBag(p => p.CommercialAgreements, (new List <DSS5_SupplyChainFinancialsOptimisation.BO.CommercialAgreement>
            {
                _agreement_commercialagreements_supplier,
                _agreement_commercialagreements_supplier2
            }))
            .CheckBag(p => p.Agreements, (new List <DSS5_SupplyChainFinancialsOptimisation.BO.Agreement>
            {
                _agreement_agreements_supplier,
                _agreement_agreements_supplier2
            }))
            .CheckReference(p => p.SupplierBusinessStructureData, _supplier_supplierbusinessstructuredata_supplier)
            .CheckReference(p => p.SupplierReceivables, _supplier_supplierreceivables_supplier)
            .CheckReference(p => p.SupplierContactInformation, _supplier_suppliercontactinformation_supplier)
            .CheckReference(p => p.SupplierTurnover, _supplier_supplierturnover_supplier)
            .CheckReference(p => p.SupplierExtraInformation, _supplier_supplierextrainformation_supplier)
            .CheckBag(p => p.FinancialStatements, (new List <DSS5_SupplyChainFinancialsOptimisation.BO.SupplierUploads>
            {
                _supplier_financialstatements_supplier,
                _supplier_financialstatements_supplier2
            }))
            .CheckBag(p => p.EconomicEvaluations, (new List <DSS5_SupplyChainFinancialsOptimisation.BO.SupplierUploads>
            {
                _supplier_economicevaluations_supplier2,
                _supplier_economicevaluations_supplier22
            }))
            .CheckBag(p => p.BusinessPlans, (new List <DSS5_SupplyChainFinancialsOptimisation.BO.SupplierUploads>
            {
                _supplier_businessplans_supplier,
                _supplier_businessplans_supplier2
            }))
            .CheckBag(p => p.PriorOutstandingBalances, (new List <DSS5_SupplyChainFinancialsOptimisation.BO.SupplierUploads>
            {
                _supplier_prioroutstandingbalances_supplier,
                _supplier_prioroutstandingbalances_supplier2
            }))
            .CheckBag(p => p.OutstandingBalances, (new List <DSS5_SupplyChainFinancialsOptimisation.BO.SupplierUploads>
            {
                _supplier_outstandingbalances_supplier,
                _supplier_outstandingbalances_supplier2
            }))
            .CheckBag(p => p.CurrentSituations, (new List <DSS5_SupplyChainFinancialsOptimisation.BO.SupplierUploads>
            {
                _supplier_currentsituations_supplier,
                _supplier_currentsituations_supplier2
            }))
            .CheckBag(p => p.CurrentStatements, (new List <DSS5_SupplyChainFinancialsOptimisation.BO.SupplierUploads>
            {
                _supplier_currentstatements_supplier,
                _supplier_currentstatements_supplier2
            }))
            .CheckBag(p => p.CurrentCredits, (new List <DSS5_SupplyChainFinancialsOptimisation.BO.SupplierUploads>
            {
                _supplier_currentcredits_supplier,
                _supplier_currentcredits_supplier2
            }))
            .CheckBag(p => p.FactoringAgreements, (new List <DSS5_SupplyChainFinancialsOptimisation.BO.SupplierUploads>
            {
                _supplier_factoringagreements_supplier,
                _supplier_factoringagreements_supplier2
            }))
            .CheckBag(p => p.CustomerAgreements, (new List <DSS5_SupplyChainFinancialsOptimisation.BO.SupplierUploads>
            {
                _supplier_customeragreements_supplier,
                _supplier_customeragreements_supplier2
            }))
            .CheckBag(p => p.GeneralConstractuals, (new List <DSS5_SupplyChainFinancialsOptimisation.BO.SupplierUploads>
            {
                _supplier_generalconstractuals_supplier,
                _supplier_generalconstractuals_supplier2
            }))
            .CheckBag(p => p.OrganizationalCharts, (new List <DSS5_SupplyChainFinancialsOptimisation.BO.SupplierUploads>
            {
                _supplier_organizationalcharts_supplier,
                _supplier_organizationalcharts_supplier2
            }))
            .CheckBag(p => p.InvoicesForms, (new List <DSS5_SupplyChainFinancialsOptimisation.BO.SupplierUploads>
            {
                _supplier_invoicesforms_supplier,
                _supplier_invoicesforms_supplier2
            }))
            .CheckBag(p => p.Declarations, (new List <DSS5_SupplyChainFinancialsOptimisation.BO.SupplierUploads>
            {
                _supplier_declarations_supplier,
                _supplier_declarations_supplier2
            }))
            .CheckReference(p => p.SupplierEvaluation, _supplier_supplierevaluation_supplier)
            .CheckReference(p => p.DataQuality, _supplier_dataquality_supplier)
            .CheckReference(p => p.DataAvailability, _supplier_dataavailability_supplier)
            .CheckBag(p => p.SupplierProducts, (new List <DSS5_SupplyChainFinancialsOptimisation.BO.SupplierProduct>
            {
                _supplierproduct_supplierproducts_supplier,
                _supplierproduct_supplierproducts_supplier2
            }))
            .CheckBag(p => p.Transactions, (new List <DSS5_SupplyChainFinancialsOptimisation.BO.Transaction>
            {
                _transaction_transactions_supplier,
                _transaction_transactions_supplier2
            }))
            .VerifyTheMappings();
        }