public static void SaveImplementation(DSS5_SupplyChainFinancialsOptimisation.BO.Investor Investor) { new DSS5_SupplyChainFinancialsOptimisation.DAL.Repository().Save <DSS5_SupplyChainFinancialsOptimisation.BO.Investor>(Investor); }
public static void CreateImplementation(DSS5_SupplyChainFinancialsOptimisation.BO.Investor newInvestor) { newInvestor.UserName = ""; new DSS5_SupplyChainFinancialsOptimisation.DAL.Repository().Save <DSS5_SupplyChainFinancialsOptimisation.BO.Investor>(newInvestor); }
/// <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 [Investor] instance to use as the destination.</param> /// <returns>A copy of the object</returns> public virtual Investor Copy(bool deep = false, Hashtable copiedObjects = null, bool asNew = false, bool reuseNestedObjects = false, Investor copy = null) { if (copiedObjects == null) { copiedObjects = new Hashtable(); } if (copy == null && copiedObjects.Contains(this)) { return((Investor)copiedObjects[this]); } copy = copy ?? new Investor(); if (!asNew) { copy.TransientId = this.TransientId; } copy.InvestorId = this.InvestorId; copy.PrimaryPhone = this.PrimaryPhone; copy.SecondaryPhone = this.SecondaryPhone; copy.Fax = this.Fax; copy.WebSite = this.WebSite; copy.Company = this.Company; copy.ContactPerson = this.ContactPerson; copy.Logo = this.Logo; copy.SupervisingAuthority = this.SupervisingAuthority; copy.RegistrationNo = this.RegistrationNo; copy.DomainFocus = this.DomainFocus; copy.TurnOver = this.TurnOver; copy.VatNumber = this.VatNumber; copy.AddressTwo = this.AddressTwo; copy.AddressOne = this.AddressOne; copy.ManagingDirector = this.ManagingDirector; copy.TargetMarket = this.TargetMarket; copy.CustomerSizeFrom = this.CustomerSizeFrom; copy.CustomerSizeTo = this.CustomerSizeTo; copy.LocalJurisdiction = this.LocalJurisdiction; copy.CommercialRegNo = this.CommercialRegNo; copy.OtherMinRequirements = this.OtherMinRequirements; copy.CRR = this.CRR; copy.UploadCompliance = this.UploadCompliance; copy.OtherMemberships = this.OtherMemberships; copy.OtherDomainFocus = this.OtherDomainFocus; copy.InvestorStatus = this.InvestorStatus; copy.IAFC = this.IAFC; copy.Prefix = this.Prefix; if (!copiedObjects.Contains(this)) { copiedObjects.Add(this, copy); } copy.agreements = new List <Agreement>(); if (deep && this.agreements != null) { foreach (var __item in this.agreements) { if (!copiedObjects.Contains(__item)) { if (asNew && reuseNestedObjects) { copy.AddAgreements(__item); } else { copy.AddAgreements(__item.Copy(deep, copiedObjects, asNew)); } } else { copy.AddAgreements((Agreement)copiedObjects[__item]); } } } copy.annualTransactionVolumes = new List <AnnualTransactionVolume>(); if (deep && this.annualTransactionVolumes != null) { foreach (var __item in this.annualTransactionVolumes) { if (!copiedObjects.Contains(__item)) { if (asNew && reuseNestedObjects) { copy.AddAnnualTransactionVolumes(__item); } else { copy.AddAnnualTransactionVolumes(__item.Copy(deep, copiedObjects, asNew)); } } else { copy.AddAnnualTransactionVolumes((AnnualTransactionVolume)copiedObjects[__item]); } } } base.Copy(deep, copiedObjects, asNew, reuseNestedObjects, copy); return(copy); }
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 InvestorFormViewModel() { Investor = new DSS5_SupplyChainFinancialsOptimisation.BO.Investor(); }
/*<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); }