public static void LoadAction1Step1( IEditOpportunityContact form, EventArgs args) { Sage.Entity.Interfaces.IOpportunityContact oppContact = form.CurrentEntity as Sage.Entity.Interfaces.IOpportunityContact; foreach(Sage.Entity.Interfaces.IOpportunityContact contact in oppContact.Opportunity.Contacts) { if(!oppContact.InstanceId.Equals(contact.InstanceId)) { if (oppContact.IsPrimary.HasValue && oppContact.IsPrimary.Value) { contact.IsPrimary = false; } } } }
/// <summary> /// Iterates through the opportunity contacts collection and sets the primary flag of the opportunity /// contact to false if this instance of the opportunity contact is set to be the primary. /// </summary> /// <param name="form">The form.</param> /// <param name="args">The <see cref="System.EventArgs"/> instance containing the event data.</param> public static void cmdOK_OnClick(IEditOpportunityContact form, EventArgs args) { IOpportunityContact newOppContact = form.CurrentEntity as IOpportunityContact; foreach(IOpportunityContact oppContact in newOppContact.Opportunity.Contacts) { if(!newOppContact.Equals(oppContact)) { if (newOppContact.IsPrimary.HasValue && newOppContact.IsPrimary.Value) { oppContact.IsPrimary = false; } } } if (newOppContact.Opportunity.Id != null) newOppContact.Save(); }
/// <summary> /// Iterates through the opportunity contacts collection and sets the primary flag of the opportunity /// contact to false if this instance of the opportunity contact is set to be the primary. /// </summary> /// <param name="form">The form.</param> /// <param name="args">The <see cref="System.EventArgs"/> instance containing the event data.</param> public static void cmdOK_OnClick(IEditOpportunityContact form, EventArgs args) { IOpportunityContact newOppContact = form.CurrentEntity as IOpportunityContact; foreach (IOpportunityContact oppContact in newOppContact.Opportunity.Contacts) { if (!newOppContact.Equals(oppContact)) { if (newOppContact.IsPrimary.HasValue && newOppContact.IsPrimary.Value) { oppContact.IsPrimary = false; } } } if (newOppContact.Opportunity.Id != null) { newOppContact.Save(); } }