/// <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; } } }
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> /// 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 } }