/// <summary> /// Adds the selected competitor as a new opportunity competitor. /// </summary> /// <param name="form">The form.</param> /// <param name="args">The <see cref="System.EventArgs"/> instance containing the event data.</param> public static void LoadAction1Step1(IOpportunityCompetitors form, EventArgs args) { Sage.Platform.WebPortal.SmartParts.WebActionEventArgs e = args as Sage.Platform.WebPortal.SmartParts.WebActionEventArgs; if (e != null) { ICompetitor competitor = form.lueAssociateCompetitor.LookupResultValue as ICompetitor; IOpportunityCompetitor opportunityCompetitor = e.PassThroughObject as IOpportunityCompetitor; if (opportunityCompetitor != null && competitor != null) { opportunityCompetitor.SetOppCompetitorDefaults(competitor); } } form.lueAssociateCompetitor.LookupResultValue = null; //34026 }
/// <summary> /// Adds the selected contact as a new opportunity contact. /// </summary> /// <param name="form">The opportunity contacts form.</param> /// <param name="args">The <see cref="System.EventArgs"/> instance containing the event data.</param> public static void SetDefaultOppContactInfo(IOpportunityContacts form, EventArgs args) { Sage.Platform.WebPortal.SmartParts.WebActionEventArgs e = args as Sage.Platform.WebPortal.SmartParts.WebActionEventArgs; if (e != null) { IContact contact = form.lueAssociateContact.LookupResultValue as IContact; IOpportunityContact opportunityContact = e.PassThroughObject as IOpportunityContact; if (opportunityContact != null && contact != null) { opportunityContact.SetOppContactDefaults(contact); } } form.lueAssociateContact.LookupResultValue = null; //34026 }
/// <summary> /// Creates a new instance of an account product (asset) and associates it with the ticket activity. /// </summary> /// <param name="form">The ticket activity items form.</param> /// <param name="args">The <see cref="System.EventArgs"/> instance containing the event data.</param> public static void CreateAsset(ITicketActivityItems form, EventArgs args) { Sage.Platform.WebPortal.SmartParts.WebActionEventArgs e = args as Sage.Platform.WebPortal.SmartParts.WebActionEventArgs; if (e != null) { Sage.Entity.Interfaces.ITicketActivityItem item = e.PassThroughObject as Sage.Entity.Interfaces.ITicketActivityItem; if (item != null && item.Product != null) { IAccountProduct asset; if (item.AccountProduct != null) { asset = item.AccountProduct; } else { asset = Sage.Platform.EntityFactory.Create <IAccountProduct>(); item.AccountProduct = asset; } IProduct product = item.Product; asset.Product = product; asset.ProductDescription = product.Description; asset.ProductName = product.Name; asset.ActualId = product.ActualId; item.ItemQuantity = 1; item.ItemAmount = Convert.ToDouble(product.DefaultPrice); Sage.Platform.WebPortal.SmartParts.EntityBoundSmartPart smartpart = form.NativeForm as Sage.Platform.WebPortal.SmartParts.EntityBoundSmartPart; if (smartpart != null) { Sage.Platform.WebPortal.EntityPage page = smartpart.Page as Sage.Platform.WebPortal.EntityPage; if (page != null) { if (page.ModeId.ToUpper() != "INSERT") { item.Save(); } } } } } }