Orphan Capture
Overview
A simple application that informs the user they must have a referrer, and provides a search to find their enroller by either ID, first or last name.
Namespaces
This sample requires the following namespaces:
using ExigoOData; using System.Text; using System.Data.Services.Client;
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; } }
Fetching Customers By Name
This sample fetches a list of customers from OData that have either a first or last name that contain the provided string.
return (from c in ExigoOData.Customers where c.LastName.Contains(searchName) || c.FirstName.Contains(searchName) select new Customer() { CustomerID = c.CustomerID, FirstName = c.FirstName, LastName = c.LastName, MainCity = c.MainCity, MainState = c.MainState }).ToList();
Fetching Customers By ID
This sample fetches a list of customers from OData where their customer ID matches the provided customer ID.
return (from c in ExigoOData.Customers where c.CustomerID == searchID select new Customer() { CustomerID = c.CustomerID, FirstName = c.FirstName, LastName = c.LastName, MainCity = c.MainCity, MainState = c.MainState }).FirstOrDefault();