Ejemplo n.º 1
0
    private static IOpportunityContact GetOppContact(string opportunityContactId)
    {
        IOpportunityContact oppcon = null;

        oppcon = EntityFactory.GetById <IOpportunityContact>(opportunityContactId);
        return(oppcon);
    }
    /// <summary>
    /// Gets the opp contact.
    /// </summary>
    /// <param name="opportunityContactId">The opportunity contact id.</param>
    /// <returns></returns>
    private static IOpportunityContact GetOppContact(string opportunityContactId)
    {
        IOpportunityContact oppcon = null;

        using (ISession session = new SessionScopeWrapper())
        {
            oppcon = EntityFactory.GetById <IOpportunityContact>(opportunityContactId);
        }
        return(oppcon);
    }
Ejemplo n.º 3
0
 /// <summary>
 /// Adds the selected contact as a new opportunity contact.
 /// </summary>
 /// <param name="form">The opportunity contacts form.</param>
 /// <param name="args">The <see cref="System.EventArgs"/> instance containing the event data.</param>
 public static void SetDefaultOppContactInfo(IOpportunityContacts form, EventArgs args)
 {
     Sage.Platform.WebPortal.SmartParts.WebActionEventArgs e = args as Sage.Platform.WebPortal.SmartParts.WebActionEventArgs;
     if (e != null)
     {
         IContact            contact            = form.lueAssociateContact.LookupResultValue as IContact;
         IOpportunityContact opportunityContact = e.PassThroughObject as IOpportunityContact;
         if (opportunityContact != null && contact != null)
         {
             opportunityContact.SetOppContactDefaults(contact);
         }
     }
     form.lueAssociateContact.LookupResultValue = null;             //34026
 }
Ejemplo n.º 4
0
    private string ResolveOppContact(string opportunityContactId)
    {
        string contactId = string.Empty;

        try
        {
            IOpportunityContact oppcon = GetOppContact(opportunityContactId);
            if (oppcon != null)
            {
                contactId = oppcon.Contact.Id.ToString();
            }
        }
        catch
        {
            contactId = "";
        }
        return(contactId);
    }
        /// <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();
            }
        }