protected override void OnFormBound() { if (!IsClosing) { Sage.SalesLogix.HighLevelTypes.LookupPreFilter targetAcctFilter = new Sage.SalesLogix.HighLevelTypes.LookupPreFilter(); targetAcctFilter.LookupEntityName = "Sage.Entity.Interfaces.IAccount"; targetAcctFilter.PropertyName = "Id"; targetAcctFilter.OperatorCode = "!="; targetAcctFilter.FilterValue = Contact.Account.Id.ToString(); targetAcctFilter.PropertyType = "System.String"; lueTargetAccount.LookupPreFilters.Add(targetAcctFilter); lueSourceContact.LookupResultValue = Contact; txtSourceAccount.Text = Contact.AccountName; lueReassignActivity.SeedValue = Contact.Account.Id.ToString(); lueReassignNotesHistory.SeedValue = Contact.Account.Id.ToString(); lueReassignOpenItems.SeedValue = Contact.Account.Id.ToString(); lueReassignClosedItems.SeedValue = Contact.Account.Id.ToString(); lueReassignSupportItems.SeedValue = Contact.Account.Id.ToString(); lueTargetAccount.Focus(); ScriptManager.RegisterClientScriptInclude(this, GetType(), "MoveContact", Page.ResolveUrl("~/SmartParts/Contact/MoveContact.js")); var script = new StringBuilder(); if (Page.IsPostBack) { script.Append(" Sage.UI.Forms.MoveContact.init({workspace: '" + getMyWorkspace() + "'} );"); } else { script.Append("dojo.ready(function () {Sage.UI.Forms.MoveContact.init({workspace: '" + getMyWorkspace() + "'} ); });"); } ScriptManager.RegisterStartupScript(this, GetType(), "initialize_MoveContact", script.ToString(), true); } base.OnFormBound(); }
protected override void OnFormBound() { if ((Contact != null) & !IsClosing) { IContact contact = DialogService.DialogParameters["SourceContact"] as IContact; lueSourceContact.LookupResultValue = contact; txtSourceAccount.Text = contact.AccountName; Sage.SalesLogix.HighLevelTypes.LookupPreFilter targetAcctFilter = new Sage.SalesLogix.HighLevelTypes.LookupPreFilter(); targetAcctFilter.LookupEntityName = "Sage.Entity.Interfaces.IAccount"; targetAcctFilter.PropertyName = "Id"; targetAcctFilter.OperatorCode = "!="; targetAcctFilter.FilterValue = Contact.Account.Id.ToString(); targetAcctFilter.PropertyType = "System.String"; lueTargetAccount.LookupPreFilters.Add(targetAcctFilter); // set focus on target account lookup lueTargetAccount.Focus(); } base.OnFormBound(); }
public static void OnLoad1Step( IInsertSalesOrder form, EventArgs args) { ISalesOrder so = form.CurrentEntity as ISalesOrder; if (so == null) return; if (String.IsNullOrEmpty(form.rdgSOType.SelectedValue)) { form.rdgSOType.SelectedValue = "SalesOrder"; } Sage.Platform.SData.IAppIdMappingService oMappingService = Sage.Platform.Application.ApplicationContext.Current.Services.Get<Sage.Platform.SData.IAppIdMappingService>(false); if (oMappingService != null && oMappingService.IsIntegrationEnabled()) { form.clIntegrationContract.Visible = true; object oValue = form.lueERPApplication.LookupResultValue; string sValue = string.Empty; if (oValue != null) { sValue = oValue.ToString(); } if (string.IsNullOrEmpty(sValue)) { form.luePriceList.Text = string.Empty; form.luePriceList.LookupResultValue = null; form.luePriceList.Enabled = false; } else { form.luePriceList.Enabled = true; } Sage.SalesLogix.HighLevelTypes.LookupPreFilter filterAppId = new Sage.SalesLogix.HighLevelTypes.LookupPreFilter(); filterAppId.LookupEntityName = "Sage.Entity.Interfaces.IAppIdMapping"; filterAppId.PropertyName = "Id"; filterAppId.OperatorCode = "!="; filterAppId.FilterValue = oMappingService.LocalAppId; filterAppId.PropertyType = "System.String"; form.lueERPApplication.LookupPreFilters.Add(filterAppId); } else { form.clIntegrationContract.Visible = false; } ISelectionService srv = ApplicationContext.Current.Services.Get<ISelectionService>(true); if( srv != null) { ISelectionContext sc = srv.GetSelectionContext("QuickInsertAccountContact"); if(sc != null) { List<string> sels = sc.GetSelectedIds(); if(sels.Count > 0) { string newContactId = sels[0]; IContact newContact = Sage.Platform.EntityFactory.GetById<IContact>(newContactId); IAccount newAccount = newContact.Account; so.Account = newAccount; so.AccountManager = newAccount.AccountManager; so.BillingContact = newContact; so.ShippingContact = newContact; so.BillToName = newContact.NameLF; so.ShipToName = newContact.NameLF; if(so.BillingAddress == null) { ISalesOrderAddress billAddr = Sage.Platform.EntityFactory.Create<ISalesOrderAddress>(); so.BillingAddress = billAddr; } so.BillingAddress.Address1 = newContact.Address.Address1; so.BillingAddress.Address2 = newContact.Address.Address2; so.BillingAddress.Address3 = newContact.Address.Address3; so.BillingAddress.Address4 = newContact.Address.Address4; so.BillingAddress.City = newContact.Address.City; so.BillingAddress.State = newContact.Address.State; so.BillingAddress.Country = newContact.Address.Country; so.BillingAddress.County = newContact.Address.County; so.BillingAddress.PostalCode = newContact.Address.PostalCode; if(so.ShippingAddress == null) { ISalesOrderAddress shipAddr = Sage.Platform.EntityFactory.Create<ISalesOrderAddress>(); so.ShippingAddress = shipAddr; } so.ShippingAddress.Address1 = newContact.Address.Address1; so.ShippingAddress.Address2 = newContact.Address.Address2; so.ShippingAddress.Address3 = newContact.Address.Address3; so.ShippingAddress.Address4 = newContact.Address.Address4; so.ShippingAddress.City = newContact.Address.City; so.ShippingAddress.State = newContact.Address.State; so.ShippingAddress.Country = newContact.Address.Country; so.ShippingAddress.County = newContact.Address.County; so.ShippingAddress.PostalCode = newContact.Address.PostalCode; srv.SetSelectionContext("QuickInsertAccountContact", null); } } } }
protected override void OnFormBound() { if (!IsClosing) { Sage.SalesLogix.HighLevelTypes.LookupPreFilter targetAcctFilter = new Sage.SalesLogix.HighLevelTypes.LookupPreFilter(); targetAcctFilter.LookupEntityName = "Sage.Entity.Interfaces.IAccount"; targetAcctFilter.PropertyName = "Id"; targetAcctFilter.OperatorCode = "!="; targetAcctFilter.FilterValue = Contact.Account.Id.ToString(); targetAcctFilter.PropertyType = "System.String"; lueTargetAccount.LookupPreFilters.Add(targetAcctFilter); lueSourceContact.LookupResultValue = Contact; txtSourceAccount.Text = Contact.AccountName; lueReassignActivity.SeedValue = Contact.Account.Id.ToString(); lueReassignNotesHistory.SeedValue = Contact.Account.Id.ToString(); lueReassignOpenItems.SeedValue = Contact.Account.Id.ToString(); lueReassignClosedItems.SeedValue = Contact.Account.Id.ToString(); lueReassignSupportItems.SeedValue = Contact.Account.Id.ToString(); lueTargetAccount.Focus(); ScriptManager.RegisterClientScriptInclude(this, GetType(), "MoveContact", Page.ResolveUrl("~/SmartParts/Contact/MoveContact.js")); var script = new StringBuilder(); if (Page.IsPostBack) { script.Append(" Sage.UI.Forms.MoveContact.init({workspace: '" + getMyWorkspace() + "'} );"); } else { script.Append("dojo.ready(function () {Sage.UI.Forms.MoveContact.init({workspace: '" + getMyWorkspace() + "'} ); });"); } ScriptManager.RegisterStartupScript(this, GetType(), "initialize_MoveContact", script.ToString(), true); } base.OnFormBound(); }
protected override void OnFormBound() { if ((Contact != null) & !IsClosing) { IContact contact = DialogService.DialogParameters["SourceContact"] as IContact; lueSourceContact.LookupResultValue = contact; txtSourceAccount.Text = contact.AccountName; Sage.SalesLogix.HighLevelTypes.LookupPreFilter targetAcctFilter = new Sage.SalesLogix.HighLevelTypes.LookupPreFilter(); targetAcctFilter.LookupEntityName = "Sage.Entity.Interfaces.IAccount"; targetAcctFilter.PropertyName = "Id"; targetAcctFilter.OperatorCode = "!="; targetAcctFilter.FilterValue = Contact.Account.Id.ToString(); targetAcctFilter.PropertyType = "System.String"; lueTargetAccount.LookupPreFilters.Add(targetAcctFilter); // set focus on target account lookup lueTargetAccount.Focus(); } base.OnFormBound(); }
public static void OnLoad1Step(IInsertSalesOrder form, EventArgs args) { ISalesOrder so = form.CurrentEntity as ISalesOrder; if (so == null) { return; } if (String.IsNullOrEmpty(form.rdgSOType.SelectedValue)) { form.rdgSOType.SelectedValue = "SalesOrder"; } Sage.Platform.SData.IAppIdMappingService oMappingService = Sage.Platform.Application.ApplicationContext.Current.Services.Get <Sage.Platform.SData.IAppIdMappingService>(false); if (oMappingService != null && oMappingService.IsIntegrationEnabled()) { form.clIntegrationContract.Visible = true; object oValue = form.lueERPApplication.LookupResultValue; string sValue = string.Empty; if (oValue != null) { sValue = oValue.ToString(); } if (string.IsNullOrEmpty(sValue)) { form.luePriceList.Text = string.Empty; form.luePriceList.LookupResultValue = null; form.luePriceList.Enabled = false; } else { form.luePriceList.Enabled = true; } Sage.SalesLogix.HighLevelTypes.LookupPreFilter filterAppId = new Sage.SalesLogix.HighLevelTypes.LookupPreFilter(); filterAppId.LookupEntityName = "Sage.Entity.Interfaces.IAppIdMapping"; filterAppId.PropertyName = "Id"; filterAppId.OperatorCode = "!="; filterAppId.FilterValue = oMappingService.LocalAppId; filterAppId.PropertyType = "System.String"; form.lueERPApplication.LookupPreFilters.Add(filterAppId); } else { form.clIntegrationContract.Visible = false; } ISelectionService srv = ApplicationContext.Current.Services.Get <ISelectionService>(true); if (srv != null) { ISelectionContext sc = srv.GetSelectionContext("QuickInsertAccountContact"); if (sc != null) { List <string> sels = sc.GetSelectedIds(); if (sels.Count > 0) { string newContactId = sels[0]; IContact newContact = Sage.Platform.EntityFactory.GetById <IContact>(newContactId); IAccount newAccount = newContact.Account; so.Account = newAccount; so.AccountManager = newAccount.AccountManager; so.BillingContact = newContact; so.ShippingContact = newContact; so.BillToName = newContact.NameLF; so.ShipToName = newContact.NameLF; if (so.BillingAddress == null) { ISalesOrderAddress billAddr = Sage.Platform.EntityFactory.Create <ISalesOrderAddress>(); so.BillingAddress = billAddr; } so.BillingAddress.Address1 = newContact.Address.Address1; so.BillingAddress.Address2 = newContact.Address.Address2; so.BillingAddress.Address3 = newContact.Address.Address3; so.BillingAddress.Address4 = newContact.Address.Address4; so.BillingAddress.City = newContact.Address.City; so.BillingAddress.State = newContact.Address.State; so.BillingAddress.Country = newContact.Address.Country; so.BillingAddress.County = newContact.Address.County; so.BillingAddress.PostalCode = newContact.Address.PostalCode; if (so.ShippingAddress == null) { ISalesOrderAddress shipAddr = Sage.Platform.EntityFactory.Create <ISalesOrderAddress>(); so.ShippingAddress = shipAddr; } so.ShippingAddress.Address1 = newContact.Address.Address1; so.ShippingAddress.Address2 = newContact.Address.Address2; so.ShippingAddress.Address3 = newContact.Address.Address3; so.ShippingAddress.Address4 = newContact.Address.Address4; so.ShippingAddress.City = newContact.Address.City; so.ShippingAddress.State = newContact.Address.State; so.ShippingAddress.Country = newContact.Address.Country; so.ShippingAddress.County = newContact.Address.County; so.ShippingAddress.PostalCode = newContact.Address.PostalCode; srv.SetSelectionContext("QuickInsertAccountContact", null); } } } }