public void BuyerStatistic_persistence_test() { DateTime now = DateTime.Now; // Get datetime without milliseconds now = new DateTime(now.Ticks - (now.Ticks % TimeSpan.TicksPerSecond), now.Kind); var _dashboard_buyer_buyerstatistics = new DSS5_SupplyChainFinancialsOptimisation.BO.Buyer { BuyerId = 7031, 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 = 5595, Name = "Buyer_Name", Email = "Buyer_Email", PhoneNumber = "Buyer_PhoneNumber", LockoutEndDate = now, }; new PersistenceSpecification <DSS5_SupplyChainFinancialsOptimisation.BO.BuyerStatistic>(Session) .CheckReference(p => p.Buyer, _dashboard_buyer_buyerstatistics) .VerifyTheMappings(); }
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(); }
/// <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 [Buyer] instance to use as the destination.</param> /// <returns>A copy of the object</returns> public virtual Buyer Copy(bool deep = false, Hashtable copiedObjects = null, bool asNew = false, bool reuseNestedObjects = false, Buyer copy = null) { if (copiedObjects == null) { copiedObjects = new Hashtable(); } if (copy == null && copiedObjects.Contains(this)) { return((Buyer)copiedObjects[this]); } copy = copy ?? new Buyer(); if (!asNew) { copy.TransientId = this.TransientId; } copy.BuyerId = this.BuyerId; copy.PrimaryPhone = this.PrimaryPhone; copy.SecondaryPhone = this.SecondaryPhone; copy.Fax = this.Fax; copy.WebSite = this.WebSite; copy.Company = this.Company; copy.AnnualTurnOver = this.AnnualTurnOver; copy.LegalRepresentative = this.LegalRepresentative; copy.Rating = this.Rating; copy.CreditInsurance = this.CreditInsurance; copy.Logo = this.Logo; copy.AddressOne = this.AddressOne; copy.AddressTwo = this.AddressTwo; copy.VatNumber = this.VatNumber; copy.ContactPerson = this.ContactPerson; copy.Prefix = this.Prefix; copy.Temp = this.Temp; if (!copiedObjects.Contains(this)) { copiedObjects.Add(this, copy); } copy.commercialAgreements = new List <CommercialAgreement>(); if (deep && this.commercialAgreements != null) { foreach (var __item in this.commercialAgreements) { if (!copiedObjects.Contains(__item)) { if (asNew && reuseNestedObjects) { copy.AddCommercialAgreements(__item); } else { copy.AddCommercialAgreements(__item.Copy(deep, copiedObjects, asNew)); } } else { copy.AddCommercialAgreements((CommercialAgreement)copiedObjects[__item]); } } } base.Copy(deep, copiedObjects, asNew, reuseNestedObjects, copy); return(copy); }
public BuyerFormViewModel() { Buyer = new DSS5_SupplyChainFinancialsOptimisation.BO.Buyer(); }
/*<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); }