/// <summary> /// Sets the forms toolbar buttons visibility based on the display mode of the product. /// </summary> /// <param name="form">The product details form.</param> /// <param name="args">The <see cref="System.EventArgs"/> instance containing the event data.</param> public static void OnFormLoad(IProductDetails form, EventArgs args) { Sage.Platform.WebPortal.SmartParts.EntityBoundSmartPart smartpart = form.NativeForm as Sage.Platform.WebPortal.SmartParts.EntityBoundSmartPart; Sage.Platform.WebPortal.EntityPage page = (Sage.Platform.WebPortal.EntityPage)smartpart.Page; if (page != null) { Sage.Platform.SData.IAppIdMappingService mappingService = Sage.Platform.Application.ApplicationContext.Current.Services.Get <Sage.Platform.SData.IAppIdMappingService>(true); if (mappingService.IsIntegrationEnabled()) { form.clIntegrationContract.Visible = true; form.curCost.Enabled = false; //form.txtDescription.Enabled = false; form.txtName.Enabled = false; form.txtSKU.Enabled = false; form.pklFamily.Enabled = false; form.pklStatus.Enabled = false; form.pklType.Enabled = false; form.lueUnitOfMeasure.Enabled = false; form.btnDelete.Visible = false; form.btnSave.Visible = false; form.btnInsertSave.Visible = false; } else { form.clIntegrationContract.Visible = false; bool bInsertMode = page.ModeId.ToUpper().Equals("INSERT"); form.btnDelete.Visible = !bInsertMode; form.btnSave.Visible = !bInsertMode; form.btnInsertSave.Visible = bInsertMode; } } }
/// <summary> /// Invokes the Quick Insert Account view. /// </summary> /// <param name="form">The Insert Sales Order form.</param> /// <param name="args">The <see cref="System.EventArgs"/> instance containing the event data.</param> public static void btnAddNewAccount_OnClickStep(IInsertSalesOrder form, EventArgs args) { Sage.Platform.WebPortal.SmartParts.EntityBoundSmartPart smartpart = form.NativeForm as Sage.Platform.WebPortal.SmartParts.EntityBoundSmartPart; Sage.Platform.WebPortal.Services.IWebDialogService dialogService = smartpart.DialogService; if (dialogService != null) { dialogService.SetSpecs(20, 20, 300, 800, "QuickInsertAccountContact", "", true); dialogService.EntityType = typeof(IContact); dialogService.ShowDialog(); } }
public static void OnLoad1Step(IQualificationCategoryDetail form, EventArgs args) { Sage.Platform.WebPortal.SmartParts.EntityBoundSmartPart smartpart = form.NativeForm as Sage.Platform.WebPortal.SmartParts.EntityBoundSmartPart; Sage.Platform.WebPortal.EntityPage page = (Sage.Platform.WebPortal.EntityPage)smartpart.Page; if (page != null) { bool bInsertMode = page.ModeId.ToUpper().Equals("INSERT"); form.btnDelete.Visible = !bInsertMode; form.btnInsertSave.Visible = bInsertMode; } }
public static void ToggleDetailInsert(IRoleDetails form, EventArgs args) { Sage.Platform.WebPortal.SmartParts.EntityBoundSmartPart smartpart = form.NativeForm as Sage.Platform.WebPortal.SmartParts.EntityBoundSmartPart; Sage.Platform.WebPortal.EntityPage page = (Sage.Platform.WebPortal.EntityPage)smartpart.Page; if (page != null) { bool bInsertMode = page.ModeId.ToUpper().Equals("INSERT"); form.btnDelete.Visible = !bInsertMode; form.btnSave.Visible = !bInsertMode; form.btnInsert.Visible = bInsertMode; } }
/// <summary> /// Sets the forms toolbar buttons visibility based on the display mode of the package. /// </summary> /// <param name="form">The package details form.</param> /// <param name="args">The <see cref="System.EventArgs"/> instance containing the event data.</param> public static void OnLoadPackageForm(IPackageDetails form, EventArgs args) { Sage.Platform.WebPortal.SmartParts.EntityBoundSmartPart smartpart = form.NativeForm as Sage.Platform.WebPortal.SmartParts.EntityBoundSmartPart; Sage.Platform.WebPortal.EntityPage page = (Sage.Platform.WebPortal.EntityPage)smartpart.Page; if (page != null) { bool bInsertMode = page.ModeId.ToUpper().Equals("INSERT"); form.btnDelete.Visible = !bInsertMode; form.btnSave.Visible = !bInsertMode; form.btnInsertSave.Visible = bInsertMode; form.ctrlstCreateModProps.Visible = !bInsertMode; } }
/// <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(); } } } } } }
/// <summary> /// Invokes the association lookup for competitors. /// </summary> /// <param name="form">the instance of the OpportunityCompetitor dialog</param> /// <param name="args">empty</param> public static void lueAssociateCompetitor_OnChangeStep(IOpportunityCompetitors form, EventArgs args) { if (form.lueAssociateCompetitor.LookupResultValue != null) { Sage.Entity.Interfaces.IOpportunity parentEntity = form.CurrentEntity as Sage.Entity.Interfaces.IOpportunity; Sage.Entity.Interfaces.ICompetitor relatedEntity = form.lueAssociateCompetitor.LookupResultValue as Sage.Entity.Interfaces.ICompetitor; Sage.Platform.WebPortal.SmartParts.EntityBoundSmartPart smartpart = form.NativeForm as Sage.Platform.WebPortal.SmartParts.EntityBoundSmartPart; Sage.Platform.WebPortal.EntityPage page = (Sage.Platform.WebPortal.EntityPage)smartpart.Page; if ((parentEntity != null) && (relatedEntity != null)) { // check for duplicates bool found = false; foreach (Sage.Entity.Interfaces.IOpportunityCompetitor oc in parentEntity.Competitors) { if (oc.Competitor == relatedEntity) { found = true; break; } } if (found) { if (smartpart != null && smartpart.DialogService != null) { string msg = string.Format(form.GetResource("DuplicateCompetitorMsg").ToString(), relatedEntity.CompetitorName); smartpart.DialogService.ShowMessage(msg, form.GetResource("DuplicateCompetitorMsgTitle").ToString()); } } else { Sage.Entity.Interfaces.IOpportunityCompetitor relationshipEntity = Sage.Platform.EntityFactory.Create <Sage.Entity.Interfaces.IOpportunityCompetitor>(); relationshipEntity.Opportunity = parentEntity; relationshipEntity.Competitor = relatedEntity; parentEntity.Competitors.Add(relationshipEntity); if (page.ModeId.ToUpper() != "INSERT") { parentEntity.Save(); } if (smartpart.DialogService != null) { smartpart.DialogService.SetSpecs(0, 0, 400, 600, "EditOpportunityCompetitor", string.Empty, true); smartpart.DialogService.EntityType = typeof(Sage.Entity.Interfaces.IOpportunityCompetitor); string id = string.Empty; smartpart.DialogService.CompositeKeyNames = "OpportunityId,CompetitorId"; id = string.Format("{0},{1}", relationshipEntity.OpportunityId, relationshipEntity.CompetitorId); if (Sage.Platform.WebPortal.PortalUtil.ObjectIsNewEntity(relationshipEntity)) { id = relationshipEntity.InstanceId.ToString(); Sage.Platform.ChangeManagement.ChangeManagementEntityFactory.RegisterInstance(relationshipEntity, relationshipEntity.InstanceId); if (relationshipEntity != null && relatedEntity != null) { relationshipEntity.SetOppCompetitorDefaults(relatedEntity); } } smartpart.DialogService.EntityID = id; smartpart.DialogService.ShowDialog(); } } } form.lueAssociateCompetitor.LookupResultValue = null; //34026 } }