/*<ControllerActionImplementation:InterestedInInvestor:1/>*/ public ActionResult ExecuteInterestedInInvestor() { ActionResult _result = null; DSS5_SupplyChainFinancialsOptimisation.BO.Agreement newAgreement = new DSS5_SupplyChainFinancialsOptimisation.BO.Agreement(); DSS5_SupplyChainFinancialsOptimisation.BO.AgreementStatus newStatus = new DSS5_SupplyChainFinancialsOptimisation.BO.AgreementStatus(); newStatus.Status = "Interested"; newStatus.ProvidedBy = "Supplier"; newStatus.DateOccured = DateTime.UtcNow; newAgreement?.AddAgreementStatus(newStatus); if ((zAppDev.DotNet.Framework.Identity.IdentityHelper.GetCurrentApplicationUser()?.IsInRole("ValidatedSupplier") ?? false) || (zAppDev.DotNet.Framework.Identity.IdentityHelper.GetCurrentApplicationUser()?.IsInRole("ActiveSupplier") ?? false)) { DSS5_SupplyChainFinancialsOptimisation.BO.Supplier newSup = new DSS5_SupplyChainFinancialsOptimisation.DAL.Repository().GetById <DSS5_SupplyChainFinancialsOptimisation.BO.Supplier>(zAppDev.DotNet.Framework.Identity.IdentityHelper.GetCurrentUserName()); newAgreement.Supplier = newSup; } newAgreement.Investor = new DSS5_SupplyChainFinancialsOptimisation.BO.Investor(); newAgreement.Investor = @model.Investor; new DSS5_SupplyChainFinancialsOptimisation.DAL.Repository().Save <DSS5_SupplyChainFinancialsOptimisation.BO.Agreement>(newAgreement); System.Collections.Generic.List <string> recipients = new System.Collections.Generic.List <string>(); recipients.Add((@model.Investor?.Email ?? "")); zAppDev.DotNet.Framework.Utilities.EMailMessage em = new zAppDev.DotNet.Framework.Utilities.EMailMessage(); em.Subject = "New Agreement"; em.Body = "A new Agreement is created" + "Please edit the Agreement."; em.To = recipients.Distinct().ToList().ToList(); zAppDev.DotNet.Framework.Utilities.Email.SendMail(em, true); ClientCommand(ClientCommands.SHOW_MESSAGE, "New Agreement created."); return(_result); }
/// <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 [Agreement] instance to use as the destination.</param> /// <returns>A copy of the object</returns> public virtual Agreement Copy(bool deep = false, Hashtable copiedObjects = null, bool asNew = false, bool reuseNestedObjects = false, Agreement copy = null) { if (copiedObjects == null) { copiedObjects = new Hashtable(); } if (copy == null && copiedObjects.Contains(this)) { return((Agreement)copiedObjects[this]); } copy = copy ?? new Agreement(); if (!asNew) { copy.TransientId = this.TransientId; copy.Id = this.Id; } copy.StartDate = this.StartDate; copy.EndDate = this.EndDate; copy.FundedRate = this.FundedRate; copy.FundedAmount = this.FundedAmount; copy.CurrentAgreementStatus = this.CurrentAgreementStatus; copy.InterestRate = this.InterestRate; if (!copiedObjects.Contains(this)) { copiedObjects.Add(this, copy); } if (deep && this.investor != null) { if (!copiedObjects.Contains(this.investor)) { if (asNew && reuseNestedObjects) { copy.Investor = this.Investor; } else if (asNew) { copy.Investor = this.Investor.Copy(deep, copiedObjects, true); } else { copy.investor = this.investor.Copy(deep, copiedObjects, false); } } else { if (asNew) { copy.Investor = (Investor)copiedObjects[this.Investor]; } else { copy.investor = (Investor)copiedObjects[this.Investor]; } } } if (deep && this.supplier != null) { if (!copiedObjects.Contains(this.supplier)) { if (asNew && reuseNestedObjects) { copy.Supplier = this.Supplier; } else if (asNew) { copy.Supplier = this.Supplier.Copy(deep, copiedObjects, true); } else { copy.supplier = this.supplier.Copy(deep, copiedObjects, false); } } else { if (asNew) { copy.Supplier = (Supplier)copiedObjects[this.Supplier]; } else { copy.supplier = (Supplier)copiedObjects[this.Supplier]; } } } copy.fundedTransactions = new List <FundedTransaction>(); if (deep && this.fundedTransactions != null) { foreach (var __item in this.fundedTransactions) { if (!copiedObjects.Contains(__item)) { if (asNew && reuseNestedObjects) { copy.AddFundedTransactions(__item); } else { copy.AddFundedTransactions(__item.Copy(deep, copiedObjects, asNew)); } } else { copy.AddFundedTransactions((FundedTransaction)copiedObjects[__item]); } } } copy.agreementStatus = new List <AgreementStatus>(); if (deep && this.agreementStatus != null) { foreach (var __item in this.agreementStatus) { if (!copiedObjects.Contains(__item)) { if (asNew && reuseNestedObjects) { copy.AddAgreementStatus(__item); } else { copy.AddAgreementStatus(__item.Copy(deep, copiedObjects, asNew)); } } else { copy.AddAgreementStatus((AgreementStatus)copiedObjects[__item]); } } } if (deep && this.documentAgreement != null) { if (!copiedObjects.Contains(this.documentAgreement)) { if (asNew && reuseNestedObjects) { copy.DocumentAgreement = this.DocumentAgreement; } else if (asNew) { copy.DocumentAgreement = this.DocumentAgreement.Copy(deep, copiedObjects, true); } else { copy.documentAgreement = this.documentAgreement.Copy(deep, copiedObjects, false); } } else { if (asNew) { copy.DocumentAgreement = (DocumentAgreement)copiedObjects[this.DocumentAgreement]; } else { copy.documentAgreement = (DocumentAgreement)copiedObjects[this.DocumentAgreement]; } } } 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]); } } } return(copy); }