public static void btnOK_OnClickStep(IQuickInsertAccountContact form, EventArgs args) { IUser currentUser = Sage.SalesLogix.API.MySlx.Security.CurrentSalesLogixUser; IContact contact = form.CurrentEntity as IContact; IAccount account = Sage.Platform.EntityFactory.Create <IAccount>(); IAddress ad = Sage.Platform.EntityFactory.Create <IAddress>(); ad.Description = contact.Address.Description; ad.Address1 = contact.Address.Address1; ad.Address2 = contact.Address.Address2; ad.Address3 = contact.Address.Address3; ad.Address4 = contact.Address.Address4; ad.City = contact.Address.City; ad.State = contact.Address.State; ad.PostalCode = contact.Address.PostalCode; ad.Country = contact.Address.Country; ad.County = contact.Address.County; ad.Salutation = contact.Address.Salutation; account.Address = ad; account.AccountName = form.txtAccount.Text; account.AccountManager = currentUser; account.Owner = currentUser.DefaultOwner; account.Type = form.pklType.PickListValue; account.MainPhone = form.phAccountMain.Text; //if ((string.IsNullOrEmpty(contact.LastName)&&(string.IsNullOrEmpty(contact.FirstName)))) //{ // contact.LastName = string.Format("New Contact for {0}",currentUser.UserInfo.UserName ); //} contact.Account = account; contact.AccountManager = currentUser; contact.Owner = currentUser.DefaultOwner; contact.SaveContactAccount(account); ISelectionService srv = ApplicationContext.Current.Services.Get <ISelectionService>(true); ISelectionContext sc = new SimpleSelectionContext(); SelectionInfo selInfo = new SelectionInfo(); SelectionItem item = new SelectionItem(); item.Id = contact.Id.ToString(); selInfo.Selections.Add(item); sc.Key = "QuickInsertAccountContact"; sc.SelectionInfo = selInfo; srv.SetSelectionContext(sc.Key, sc); Sage.Platform.WebPortal.Services.IPanelRefreshService refresher = form.Services.Get <Sage.Platform.WebPortal.Services.IPanelRefreshService>(); if (refresher != null) { refresher.RefreshAll(); } }
public static void btnOK_OnClickStep( IQuickInsertAccountContact form, EventArgs args) { IUser currentUser = Sage.SalesLogix.API.MySlx.Security.CurrentSalesLogixUser; IContact contact = form.CurrentEntity as IContact; IAccount account = Sage.Platform.EntityFactory.Create<IAccount>(); IAddress ad = Sage.Platform.EntityFactory.Create<IAddress>(); ad.Description = contact.Address.Description; ad.Address1 = contact.Address.Address1; ad.Address2 = contact.Address.Address2; ad.Address3 = contact.Address.Address3; ad.Address4 = contact.Address.Address4; ad.City = contact.Address.City; ad.State = contact.Address.State; ad.PostalCode = contact.Address.PostalCode; ad.Country = contact.Address.Country; ad.County = contact.Address.County; ad.Salutation = contact.Address.Salutation; account.Address = ad; account.AccountName = form.txtAccount.Text; account.AccountManager = currentUser; account.Owner = currentUser.DefaultOwner; account.Type = form.pklType.PickListValue; account.MainPhone = form.phAccountMain.Text; //if ((string.IsNullOrEmpty(contact.LastName)&&(string.IsNullOrEmpty(contact.FirstName)))) //{ // contact.LastName = string.Format("New Contact for {0}",currentUser.UserInfo.UserName ); //} contact.Account = account; contact.AccountManager = currentUser; contact.Owner = currentUser.DefaultOwner; contact.SaveContactAccount(account); ISelectionService srv = ApplicationContext.Current.Services.Get<ISelectionService>(true); ISelectionContext sc = new SimpleSelectionContext(); SelectionInfo selInfo = new SelectionInfo(); SelectionItem item = new SelectionItem(); item.Id = contact.Id.ToString(); selInfo.Selections.Add(item); sc.Key = "QuickInsertAccountContact"; sc.SelectionInfo = selInfo; srv.SetSelectionContext(sc.Key,sc); Sage.Platform.WebPortal.Services.IPanelRefreshService refresher = form.Services.Get<Sage.Platform.WebPortal.Services.IPanelRefreshService>(); if (refresher != null) { refresher.RefreshAll(); } }
public static void QFButton_OnClickStep(IInsertAccountContact form, EventArgs args) { IUser currentUser = MySlx.Security.CurrentSalesLogixUser; IContact contact = form.CurrentEntity as IContact; var account = form.lueAccount.LookupResultValue as IAccount; IAddress ad = EntityFactory.Create <IAddress>(); ad.Description = contact.Address.Description; ad.Address1 = contact.Address.Address1; ad.Address2 = contact.Address.Address2; ad.Address3 = contact.Address.Address3; ad.Address4 = contact.Address.Address4; ad.City = contact.Address.City; ad.State = contact.Address.State; ad.PostalCode = contact.Address.PostalCode; ad.Country = contact.Address.Country; ad.County = contact.Address.County; ad.Salutation = contact.Address.Salutation; contact.Account = account; contact.AccountManager = currentUser; contact.Owner = currentUser.DefaultOwner; contact.SaveContactAccount(account); var _parent = form.WorkItem.Services.Get <IEntityContextService>().GetEntity(); if (_parent is IERPBillTo) { var billToContact = EntityFactory.Create <IERPBillToContact>(); billToContact.Contact = contact; billToContact.ERPBillTo = (IERPBillTo)_parent; billToContact.Save(); } else if (_parent is IERPShipTo) { var shipToContact = EntityFactory.Create <IERPShipToContact>(); shipToContact.Contact = contact; shipToContact.ERPShipTo = (IERPShipTo)_parent; shipToContact.Save(); } else if (_parent is IERPPayFrom) { var payFromContact = EntityFactory.Create <IERPPayFromContact>(); payFromContact.Contact = contact; payFromContact.ERPPayFrom = (IERPPayFrom)_parent; payFromContact.Save(); } ISelectionService srv = ApplicationContext.Current.Services.Get <ISelectionService>(true); ISelectionContext sc = new SimpleSelectionContext(); SelectionInfo selInfo = new SelectionInfo(); SelectionItem item = new SelectionItem { Id = contact.Id.ToString() }; selInfo.Selections.Add(item); sc.Key = "InsertAccountContact"; sc.SelectionInfo = selInfo; srv.SetSelectionContext(sc.Key, sc); IPanelRefreshService refresher = form.Services.Get <IPanelRefreshService>(); if (refresher != null) { refresher.RefreshTabWorkspace(); } }