Exigo Developer Resources

This database contains the documentation for Exigo's OData API's, as well as C# sample code and fully-realized demo applications ready to be customized for your needs. Start building downline viewers, reporting tools and shopping carts on the Exigo platform today!


Create an account Sign In

Address Book

Overview

An address book application that allows a distributor to add, edit, view and delete contacts from their presonal address book.

Namespaces

This sample requires the following namespaces:

using ExigoOData;
using ExigoWebService;
using Exigo.WebControls;
using System.Data.Services.Client;
using System.Text;
using System.Linq.Expressions;
using System.Reflection;
using System.ComponentModel;

Exigo API Authentication

This sample accesses OData using the ExigoContext object:

    public ExigoContext ExigoOData
    {
        get
        {
            var context = new ExigoOData.ExigoContext(new Uri("http://api.exigo.com/4.0/" + exigoAPICompany + "/model"));
            context.IgnoreMissingProperties = true;
            var credentials = Convert.ToBase64String(Encoding.ASCII.GetBytes(exigoAPILoginName + ":" + exigoAPIPassword));
            context.SendingRequest +=
                (object s, SendingRequestEventArgs e) =>
                    e.RequestHeaders.Add("Authorization", "Basic " + credentials);
            return context;
        }
    }
    

This sample also accesses the web service using the ExigoApi object:

    public ExigoApi Exigo
    {
        get
        {
            return new ExigoApi
            {
                ApiAuthenticationValue = new ApiAuthentication
                {
                    LoginName = exigoAPILoginName,
                    Password = exigoAPIPassword,
                    Company = exigoAPICompany
                }
            };
        }
    }
    

jQuery

We use jQuery UI Themes for styling.

<link href="<%=this.ResolveUrl("../../Themes/start/jquery-ui.custom.css") %>" rel="stylesheet" type="text/css" />
<script src="<%=this.ResolveUrl("../../Scripts/jquery.min.js") %>" type="text/javascript"></script>
<script src="<%=this.ResolveUrl("../../Scripts/jquery-ui.min.js") %>" type="text/javascript"></script>

jqGrid GridView Framework

We are also using jqGrid (http://trirand.com/blog/jqgrid/jqgrid.html) to display our data. To learn more about the jqGrid and Exigo's custom C# wrapper used in this sample, check out the jqGrid Report sample's documentation.

<link href="<%=this.ResolveUrl("../../Plugins/jquery.jqGrid/css/ui.jqgrid.css") %>" rel="stylesheet" type="text/css" />
<script src="<%=this.ResolveUrl("../../Plugins/jquery.jqGrid/js/i18n/grid.locale-en.js") %>" type="text/javascript"></script>
<script src="<%=this.ResolveUrl("../../Plugins/jquery.jqGrid/js/jquery.jqGrid.min.js") %>" type="text/javascript"></script>

Fetching A Specific Customer Contact

To fetch a specific customer contact, we call the CustomerContacts OData query, passing in the customer entity ID.

            Contact = ExigoOData.CustomerContacts
                           .Where(c => c.CustomerID == customerID 
                               && c.CustomerEntityID == contactId)
                           .FirstOrDefault();
            

Creating Customer Contacts

To create a customer contact, we call the web service's CreateCustomerContact method.

        Exigo.CreateCustomerContact(new CreateCustomerContactRequest
        {
            CustomerID              = customerID,
            FirstName               = this.FirstName,
            LastName                = this.LastName,
            Company                 = this.Company,
            Email                   = this.Email,
            BusinessPhone           = this.BusinessPhone,
            HomePhone               = this.HomePhone,
            Fax                     = this.Fax,
            Mobile                  = this.Mobile,
            BirthDate               = this.Birthday,
            Notes                   = this.Notes,
            Address1                = this.Address1,
            Address2                = this.Address2,
            City                    = this.City,
            State                   = this.State,
            Zip                     = this.Zip,
            Country                 = this.Country
        });
        

Updating Customer Contacts

To update an existing customer contact, we call the web service's UpdateCustomerContact method. This method requires the CustomerEntityID, of course.

        Exigo.UpdateCustomerContact(new UpdateCustomerContactRequest
        {
            CustomerContactID       = contactId, // Required
            CustomerID              = customerID,
            FirstName               = this.FirstName,
            LastName                = this.LastName,
            Company                 = this.Company,
            Email                   = this.Email,
            BusinessPhone           = this.BusinessPhone,
            HomePhone               = this.HomePhone,
            Fax                     = this.Fax,
            Mobile                  = this.Mobile,
            BirthDate               = this.Birthday,
            Notes                   = this.Notes,
            Address1                = this.Address1,
            Address2                = this.Address2,
            City                    = this.City,
            State                   = this.State,
            Zip                     = this.Zip,
            Country                 = this.Country
        });