/*<ControllerActionImplementation:AddTransaction:1/>*/ public ActionResult ExecuteAddTransaction() { if (_parentController == null) { _parentController = new MasterPage.MasterPageController(new DSS5_SupplyChainFinancialsOptimisation.UI.ViewModels.MasterPage.MasterPageViewModel()); } ((MasterPage.MasterPageController)_parentController).ExecuteRender(); ActionResult _result = null; @model.Title = ""; @model.Transaction.TransactionDateOccured = DateTime.UtcNow; DSS5_SupplyChainFinancialsOptimisation.BO.Supplier transactionSupplier = new DSS5_SupplyChainFinancialsOptimisation.BO.Supplier(); transactionSupplier = new DSS5_SupplyChainFinancialsOptimisation.DAL.Repository().GetAsQueryable <DSS5_SupplyChainFinancialsOptimisation.BO.Supplier>((a) => a.UserName == zAppDev.DotNet.Framework.Identity.IdentityHelper.GetCurrentUserName())?.FirstOrDefault(); @model.Transaction.Supplier = transactionSupplier; DSS5_SupplyChainFinancialsOptimisation.BO.Supplier sup = new DSS5_SupplyChainFinancialsOptimisation.DAL.Repository().GetAsQueryable <DSS5_SupplyChainFinancialsOptimisation.BO.Supplier>((s) => s.UserName == zAppDev.DotNet.Framework.Identity.IdentityHelper.GetCurrentUserName())?.FirstOrDefault(); if ((sup?.IsSupplier() ?? false)) { @model.IsSupplier = true; } return(_result); }
public void DataAvailability_persistence_test() { DateTime now = DateTime.Now; // Get datetime without milliseconds now = new DateTime(now.Ticks - (now.Ticks % TimeSpan.TicksPerSecond), now.Kind); var _supplier_supplier_dataavailability = new DSS5_SupplyChainFinancialsOptimisation.BO.Supplier { SupplierId = 1314, 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 = 2572, 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 = 7662, Name = "Supplier_Name", Email = "Supplier_Email", PhoneNumber = "Supplier_PhoneNumber", LockoutEndDate = now, }; new PersistenceSpecification <DSS5_SupplyChainFinancialsOptimisation.BO.DataAvailability>(Session) .CheckProperty(p => p.Orders, true) .CheckProperty(p => p.DeliveryNotes, true) .CheckProperty(p => p.CustomsDocuments, true) .CheckProperty(p => p.IntermediaryLogistics, true) .CheckProperty(p => p.Invoices, true) .CheckProperty(p => p.PoDs, true) .CheckProperty(p => p.PaymentData, true) .CheckReference(p => p.Supplier, _supplier_supplier_dataavailability) .VerifyTheMappings(); }
public void TurnoverStatistic_persistence_test() { DateTime now = DateTime.Now; // Get datetime without milliseconds now = new DateTime(now.Ticks - (now.Ticks % TimeSpan.TicksPerSecond), now.Kind); var _turnover_supplier_turnoverstatistic = new DSS5_SupplyChainFinancialsOptimisation.BO.Supplier { SupplierId = 278, 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 = 2477, 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 = 3173, Name = "Supplier_Name", Email = "Supplier_Email", PhoneNumber = "Supplier_PhoneNumber", LockoutEndDate = now, }; new PersistenceSpecification <DSS5_SupplyChainFinancialsOptimisation.BO.TurnoverStatistic>(Session) .CheckProperty(p => p.TotalAmount, 222222.22M) .CheckProperty(p => p.Year, 7698) .CheckProperty(p => p.Month, 9547) .CheckProperty(p => p.TotalAmountFunded, 222222.22M) .CheckProperty(p => p.TotalTransactions, 8857) .CheckProperty(p => p.TotalCreditNotes, 4707) .CheckProperty(p => p.CNAmount, 222222.22M) .CheckReference(p => p.Supplier, _turnover_supplier_turnoverstatistic) .VerifyTheMappings(); }
public TurnoverPerMonthFormViewModel() { Supplier = new DSS5_SupplyChainFinancialsOptimisation.BO.Supplier(); }
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(); }
public void Agreement_persistence_test() { DateTime now = DateTime.Now; // Get datetime without milliseconds now = new DateTime(now.Ticks - (now.Ticks % TimeSpan.TicksPerSecond), now.Kind); var _agreement_investor_agreements = new DSS5_SupplyChainFinancialsOptimisation.BO.Investor { InvestorId = 1174, PrimaryPhone = "Investor_PrimaryPhone", SecondaryPhone = "Investor_SecondaryPhone", Fax = "Investor_Fax", WebSite = "Investor_WebSite", Company = "Investor_Company", ContactPerson = "Investor_ContactPerson", Logo = "Investor_Logo", SupervisingAuthority = "Investor_SupervisingAuthority", RegistrationNo = "Investor_RegistrationNo", DomainFocus = "Investor_DomainFocus", TurnOver = 2222222222.22222M, VatNumber = "Investor_VatNumber", AddressTwo = "Investor_AddressTwo", AddressOne = "Investor_AddressOne", ManagingDirector = "Investor_ManagingDirector", TargetMarket = "Investor_TargetMarket", CustomerSizeFrom = "Investor_CustomerSizeFrom", CustomerSizeTo = "Investor_CustomerSizeTo", LocalJurisdiction = "Investor_LocalJurisdiction", CommercialRegNo = "Investor_CommercialRegNo", OtherMinRequirements = "Investor_OtherMinRequirements", CRR = true, UploadCompliance = "Investor_UploadCompliance", OtherMemberships = "Investor_OtherMemberships", OtherDomainFocus = "Investor_OtherDomainFocus", InvestorStatus = "Investor_InvestorStatus", IAFC = true, Prefix = "Investor_Prefix", UserName = "******", PasswordHash = "Investor_PasswordHash", SecurityStamp = "Investor_SecurityStamp", EmailConfirmed = true, LockoutEnabled = true, PhoneNumberConfirmed = true, TwoFactorEnabled = true, AccessFailedCount = 3988, Name = "Investor_Name", Email = "Investor_Email", PhoneNumber = "Investor_PhoneNumber", LockoutEndDate = now, }; var _agreement_supplier_agreements = new DSS5_SupplyChainFinancialsOptimisation.BO.Supplier { SupplierId = 4870, 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 = 1087, 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 = 1898, Name = "Supplier_Name", Email = "Supplier_Email", PhoneNumber = "Supplier_PhoneNumber", LockoutEndDate = now, }; var _agreement_fundedtransactions_agreement = new DSS5_SupplyChainFinancialsOptimisation.BO.FundedTransaction { FundingPercentage = "FundedTransaction_FundingPercentage", TransactionStatus = "FundedTransaction_TransactionStatus", }; var _agreement_fundedtransactions_agreement2 = new DSS5_SupplyChainFinancialsOptimisation.BO.FundedTransaction { FundingPercentage = "FundedTransaction_FundingPercentage", TransactionStatus = "FundedTransaction_TransactionStatus", }; var _agreement_agreementstatus_agreement = new DSS5_SupplyChainFinancialsOptimisation.BO.AgreementStatus { Status = "AgreementStatus_Status", DateOccured = now, ProvidedBy = "AgreementStatus_ProvidedBy", }; var _agreement_agreementstatus_agreement2 = new DSS5_SupplyChainFinancialsOptimisation.BO.AgreementStatus { Status = "AgreementStatus_Status", DateOccured = now, ProvidedBy = "AgreementStatus_ProvidedBy", }; var _agreement_documentagreement_agreement = new DSS5_SupplyChainFinancialsOptimisation.BO.DocumentAgreement { SupplierDocument = "DocumentAgreement_SupplierDocument", InvestorDocument = "DocumentAgreement_InvestorDocument", AdminDocument = "DocumentAgreement_AdminDocument", }; var _agreement_commercialagreements_agreement = new DSS5_SupplyChainFinancialsOptimisation.BO.CommercialAgreement { ProductCategory = "CommercialAgreement_ProductCategory", PaymentTerms = "CommercialAgreement_PaymentTerms", }; var _agreement_commercialagreements_agreement2 = new DSS5_SupplyChainFinancialsOptimisation.BO.CommercialAgreement { ProductCategory = "CommercialAgreement_ProductCategory", PaymentTerms = "CommercialAgreement_PaymentTerms", }; new PersistenceSpecification <DSS5_SupplyChainFinancialsOptimisation.BO.Agreement>(Session) .CheckProperty(p => p.StartDate, now) .CheckProperty(p => p.EndDate, now) .CheckProperty(p => p.FundedRate, 222222.22M) .CheckProperty(p => p.FundedAmount, 222222.22M) .CheckProperty(p => p.InterestRate, 222222.22M) .CheckReference(p => p.Investor, _agreement_investor_agreements) .CheckReference(p => p.Supplier, _agreement_supplier_agreements) .CheckBag(p => p.FundedTransactions, (new List <DSS5_SupplyChainFinancialsOptimisation.BO.FundedTransaction> { _agreement_fundedtransactions_agreement, _agreement_fundedtransactions_agreement2 })) .CheckBag(p => p.AgreementStatus, (new List <DSS5_SupplyChainFinancialsOptimisation.BO.AgreementStatus> { _agreement_agreementstatus_agreement, _agreement_agreementstatus_agreement2 })) .CheckReference(p => p.DocumentAgreement, _agreement_documentagreement_agreement) .CheckBag(p => p.CommercialAgreements, (new List <DSS5_SupplyChainFinancialsOptimisation.BO.CommercialAgreement> { _agreement_commercialagreements_agreement, _agreement_commercialagreements_agreement2 })) .VerifyTheMappings(); }
public static void SaveImplementation(DSS5_SupplyChainFinancialsOptimisation.BO.Supplier Supplier) { new DSS5_SupplyChainFinancialsOptimisation.DAL.Repository().Save <DSS5_SupplyChainFinancialsOptimisation.BO.Supplier>(Supplier); }
public static void CreateImplementation(DSS5_SupplyChainFinancialsOptimisation.BO.Supplier newSupplier) { newSupplier.UserName = ""; new DSS5_SupplyChainFinancialsOptimisation.DAL.Repository().Save <DSS5_SupplyChainFinancialsOptimisation.BO.Supplier>(newSupplier); }
public TestingFormViewModel() { Supplier = new DSS5_SupplyChainFinancialsOptimisation.BO.Supplier(); }
public void SupplierStatistic_persistence_test() { DateTime now = DateTime.Now; // Get datetime without milliseconds now = new DateTime(now.Ticks - (now.Ticks % TimeSpan.TicksPerSecond), now.Kind); var _dashboard_supplier_supplierstatistics = new DSS5_SupplyChainFinancialsOptimisation.BO.Supplier { SupplierId = 7876, 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 = 7093, 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 = 7161, Name = "Supplier_Name", Email = "Supplier_Email", PhoneNumber = "Supplier_PhoneNumber", LockoutEndDate = now, }; new PersistenceSpecification <DSS5_SupplyChainFinancialsOptimisation.BO.SupplierStatistic>(Session) .CheckProperty(p => p.TotalCommercialAgreements, 433) .CheckProperty(p => p.DataQuality, 222222.22M) .CheckProperty(p => p.DataAvailability, 5946) .CheckProperty(p => p.OnTimeDeliveries, 3420) .CheckProperty(p => p.AsOrderedDeliveries, 640) .CheckProperty(p => p.InFullDeliveries, 3541) .CheckProperty(p => p.TotalImpeachments, 9213) .CheckProperty(p => p.CurrentTurnover, 222222.22M) .CheckProperty(p => p.NextTurnover, 222222.22M) .CheckProperty(p => p.PreviousTurnover, 222222.22M) .CheckProperty(p => p.TotalTransactions, 9199) .CheckReference(p => p.Supplier, _dashboard_supplier_supplierstatistics) .VerifyTheMappings(); }
public void SupplierProduct_persistence_test() { DateTime now = DateTime.Now; // Get datetime without milliseconds now = new DateTime(now.Ticks - (now.Ticks % TimeSpan.TicksPerSecond), now.Kind); var _supplierproduct_productcategory_supplierproduct = new DSS5_SupplyChainFinancialsOptimisation.BO.ProductCategory { Type = "ProductCategory_Type", }; var _supplierproduct_supplier_supplierproducts = new DSS5_SupplyChainFinancialsOptimisation.BO.Supplier { SupplierId = 3217, 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 = 8885, 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 = 6210, Name = "Supplier_Name", Email = "Supplier_Email", PhoneNumber = "Supplier_PhoneNumber", LockoutEndDate = now, }; new PersistenceSpecification <DSS5_SupplyChainFinancialsOptimisation.BO.SupplierProduct>(Session) .CheckProperty(p => p.Code, "SupplierProduct_Code") .CheckProperty(p => p.Description, "SupplierProduct_Description") .CheckProperty(p => p.UnitValue, "SupplierProduct_UnitValue") .CheckProperty(p => p.MeasurementUnit, "SupplierProduct_MeasurementUnit") .CheckProperty(p => p.Price, 222222.22M) .CheckReference(p => p.ProductCategory, _supplierproduct_productcategory_supplierproduct) .CheckReference(p => p.Supplier, _supplierproduct_supplier_supplierproducts) .VerifyTheMappings(); }
public void SupplierUploads_persistence_test() { DateTime now = DateTime.Now; // Get datetime without milliseconds now = new DateTime(now.Ticks - (now.Ticks % TimeSpan.TicksPerSecond), now.Kind); var _supplier_supplier_financialstatements = new DSS5_SupplyChainFinancialsOptimisation.BO.Supplier { SupplierId = 1873, 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 = 4982, 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 = 366, Name = "Supplier_Name", Email = "Supplier_Email", PhoneNumber = "Supplier_PhoneNumber", LockoutEndDate = now, }; var _supplier_supplier2_economicevaluations = new DSS5_SupplyChainFinancialsOptimisation.BO.Supplier { SupplierId = 6413, 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 = 5337, 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 = 6184, Name = "Supplier_Name", Email = "Supplier_Email", PhoneNumber = "Supplier_PhoneNumber", LockoutEndDate = now, }; new PersistenceSpecification <DSS5_SupplyChainFinancialsOptimisation.BO.SupplierUploads>(Session) .CheckProperty(p => p.Path, "SupplierUploads_Path") .CheckReference(p => p.Supplier, _supplier_supplier_financialstatements) .CheckReference(p => p.Supplier2, _supplier_supplier2_economicevaluations) .VerifyTheMappings(); }
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(); }
/*<ControllerActionImplementation:SignUp:1/>*/ public ActionResult ExecuteSignUp() { ActionResult _result = null; if ((@model.PasswordTextBox != @model.RetypePass)) { ClientCommand(ClientCommands.SHOW_MESSAGE, "Passwords do not match", MessageType.Warning); return(null); } zAppDev.DotNet.Framework.Identity.Model.ApplicationUser userToRegister = new zAppDev.DotNet.Framework.Identity.Model.ApplicationUser(); System.Collections.Generic.List <zAppDev.DotNet.Framework.Identity.Model.ApplicationRole> roleToAdd = new System.Collections.Generic.List <zAppDev.DotNet.Framework.Identity.Model.ApplicationRole>(); if ((@model.ChoosenRole == null)) { zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Warning, "SignUp", DSS5_SupplyChainFinancialsOptimisation.Hubs.EventsHub.RaiseDebugMessage, "User did not select a Role."); ClientCommand(ClientCommands.SHOW_MESSAGE, "Please choose a role you wish to sign up as.", MessageType.Warning); return(null); } if (@model.ChoosenRole == "Supplier") { DSS5_SupplyChainFinancialsOptimisation.BO.Supplier newSupplier = new DSS5_SupplyChainFinancialsOptimisation.BO.Supplier(); newSupplier.UserName = @model.UserName; newSupplier.Email = @model.Email; if ((((((newSupplier?.Email ?? "") == null ? false : CSharpVerbalExpressions.VerbalExpressions.DefaultExpression.Add(CSharpVerbalExpressions.CommonRegex.Email).Test((newSupplier?.Email ?? "")))) == false))) { ClientCommand(ClientCommands.SHOW_MESSAGE, "Please enter a valid e-mail address", MessageType.Warning); return(null); } newSupplier.Company = @model.CompanyName; userToRegister = newSupplier; roleToAdd = new DSS5_SupplyChainFinancialsOptimisation.DAL.Repository().Get <zAppDev.DotNet.Framework.Identity.Model.ApplicationRole>((a) => a.Name == "GuestSupplier").ToList(); } if (@model.ChoosenRole == "Buyer") { DSS5_SupplyChainFinancialsOptimisation.BO.Buyer newBuyer = new DSS5_SupplyChainFinancialsOptimisation.BO.Buyer(); newBuyer.UserName = @model.UserName; newBuyer.Email = @model.Email; if ((((((newBuyer?.Email ?? "") == null ? false : CSharpVerbalExpressions.VerbalExpressions.DefaultExpression.Add(CSharpVerbalExpressions.CommonRegex.Email).Test((newBuyer?.Email ?? "")))) == false))) { ClientCommand(ClientCommands.SHOW_MESSAGE, "Please enter a valid e-mail address", MessageType.Warning); return(null); } newBuyer.Company = @model.CompanyName; userToRegister = newBuyer; roleToAdd = new DSS5_SupplyChainFinancialsOptimisation.DAL.Repository().Get <zAppDev.DotNet.Framework.Identity.Model.ApplicationRole>((a) => a.Name == "Buyer").ToList(); } if (@model.ChoosenRole == "Investor") { DSS5_SupplyChainFinancialsOptimisation.BO.Investor newInvestor = new DSS5_SupplyChainFinancialsOptimisation.BO.Investor(); newInvestor.UserName = @model.UserName; newInvestor.Email = @model.Email; if ((((((newInvestor?.Email ?? "") == null ? false : CSharpVerbalExpressions.VerbalExpressions.DefaultExpression.Add(CSharpVerbalExpressions.CommonRegex.Email).Test((newInvestor?.Email ?? "")))) == false))) { ClientCommand(ClientCommands.SHOW_MESSAGE, "Please enter a valid e-mail address", MessageType.Warning); return(null); } newInvestor.Company = @model.CompanyName; newInvestor.InvestorStatus = "GuestInvestor"; userToRegister = newInvestor; roleToAdd = new DSS5_SupplyChainFinancialsOptimisation.DAL.Repository().Get <zAppDev.DotNet.Framework.Identity.Model.ApplicationRole>((a) => a.Name == "GuestInvestor").ToList(); } if ((@model.ChoosenRole == "Intermediary")) { DSS5_SupplyChainFinancialsOptimisation.BO.IntermediaryUser newIntermediaryUser = new DSS5_SupplyChainFinancialsOptimisation.BO.IntermediaryUser(); newIntermediaryUser.UserName = @model.UserName; newIntermediaryUser.Email = @model.Email; if ((((((newIntermediaryUser?.Email ?? "") == null ? false : CSharpVerbalExpressions.VerbalExpressions.DefaultExpression.Add(CSharpVerbalExpressions.CommonRegex.Email).Test((newIntermediaryUser?.Email ?? "")))) == false))) { ClientCommand(ClientCommands.SHOW_MESSAGE, "Please enter a valid e-mail address", MessageType.Warning); return(null); } newIntermediaryUser.Intermediary = @model.Intermediary; userToRegister = newIntermediaryUser; roleToAdd = new DSS5_SupplyChainFinancialsOptimisation.DAL.Repository().Get <zAppDev.DotNet.Framework.Identity.Model.ApplicationRole>((a) => a.Name == "Intermediary").ToList(); } if ((new DSS5_SupplyChainFinancialsOptimisation.DAL.Repository().Get <zAppDev.DotNet.Framework.Identity.Model.ApplicationUser>((a) => a.UserName == @model.UserName)).Count() > 0) { ClientCommand(ClientCommands.SHOW_MESSAGE, "Please choose a different Username", MessageType.Warning); return(null); } string error = zAppDev.DotNet.Framework.Identity.IdentityHelper.CreateUser(userToRegister, @model.PasswordTextBox); if ((((error == null || error == "")) == false)) { ClientCommand(ClientCommands.SHOW_MESSAGE, error, MessageType.Warning); return(null); } string code = zAppDev.DotNet.Framework.Identity.IdentityHelper.GetUserManager().GenerateEmailConfirmationTokenAsync(userToRegister.UserName).Result; string link = (!string.IsNullOrEmpty(System.Configuration.ConfigurationManager.AppSettings["ServerExternalPath"]) ? System.Configuration.ConfigurationManager.AppSettings["ServerExternalPath"] : zAppDev.DotNet.Framework.Utilities.Web.GetApplicationPathUri(false)) + "/EmailConfirmation/Confirm" + "?email=" + System.Web.HttpUtility.UrlEncode((userToRegister?.Email ?? "")) + "&code=" + System.Web.HttpUtility.UrlEncode(code); zAppDev.DotNet.Framework.Utilities.EMailMessage emailMessage = new zAppDev.DotNet.Framework.Utilities.EMailMessage(); emailMessage.To = new List <string> { (userToRegister?.Email ?? "") }.ToList(); emailMessage.Subject = "Account Activation"; emailMessage.Body = "Please click <a href='" + link + "'>here</a> to activate your account"; emailMessage.IsBodyHtml = true; zAppDev.DotNet.Framework.Utilities.Email.SendMail(emailMessage, true); userToRegister.Roles = roleToAdd.ToList(); new DSS5_SupplyChainFinancialsOptimisation.DAL.Repository().Save <zAppDev.DotNet.Framework.Identity.Model.ApplicationUser>(userToRegister); ClientCommand(ClientCommands.SHOW_MESSAGE, "Please activate your account using the link sent to your email.", MessageType.Success, (!string.IsNullOrEmpty(System.Configuration.ConfigurationManager.AppSettings["ServerExternalPath"]) ? System.Configuration.ConfigurationManager.AppSettings["ServerExternalPath"] : zAppDev.DotNet.Framework.Utilities.Web.GetApplicationPathUri(false)) + "/HomePage/Render"); return(_result); }