/// <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(); } } } } } }
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(); } } } } } }
/// <summary> /// Resets the result value of the insert asset lookup control. /// </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 ResetAddPartLookup(ITicketActivityItems form, EventArgs args) { form.lueAddPart.LookupResultValue = null; }