Add Related Party
Name | Type | Length | Description |
---|---|---|---|
locationID | numeric | 9 | [Required] Location ID |
rpTypeCode | System.String | 2 | [Required] Related Party Type Code. P=Parcel Related Party |
relatedPartyName | System.String | 30 | Company or Person Name |
companyPerson | numeric | 1 | Company or Person 1=Company, 2=Person |
address1 | System.String | 30 | Address line 1 |
address2 | System.String | 30 | Address line 2 |
address3 | System.String | 30 | Address line 3 |
zipCode | System.String | 9 | Zip code. 9 char total |
phoneNumber | numeric | 10 | Phone number. Includes area code |
carrierRoute | System.String | 4 | Carrier Route |
recordStatus | System.String | 1 | Record Status. Blank=Active, H=History |
deliveryPoint | System.String | 3 | Delivery point |
dateOfBirth | numeric | 7 | Date of Birth. Format=CyyMMdd |
effectiveDate | numeric | 7 | Effective Date. Format=CyyMMdd |
POST http://localhost/FusionServices/v3/Naviline/Land/AddRelatedParty
Name | Description |
---|---|
ErrorCode | 0=Success |
LastChangedDate | Last changed date. Format=CyyMMdd |
LastChangedJob | Last changed job |
LastChangedUser | Last changed user |
RelatedPartyCode | Related Party Code |
using System.Net;
using Newtonsoft.Json.Linq;
public void MethodName(parms)
{
string uri = "http://localhost/FusionServices/v3/Naviline/Land/AddRelatedParty";
System.Collections.Specialized.NameValueCollection postParms =
new System.Collections.Specialized.NameValueCollection();
// Set paramater values
postParms.Add("locationID",System.Web.HttpUtility.UrlEncode("39796"));
postParms.Add("rpTypeCode",System.Web.HttpUtility.UrlEncode("p"));
postParms.Add("relatedPartyName",System.Web.HttpUtility.UrlEncode("Ellis Electric"));
postParms.Add("companyPerson",System.Web.HttpUtility.UrlEncode("1"));
postParms.Add("address1",System.Web.HttpUtility.UrlEncode("124 W Denman Ave"));
postParms.Add("address2",System.Web.HttpUtility.UrlEncode("Suite 207"));
postParms.Add("zipCode",System.Web.HttpUtility.UrlEncode("759043807"));
postParms.Add("phoneNumber",System.Web.HttpUtility.UrlEncode("8885551212"));
WebClient req = new WebClient();
wc.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
wc.Headers.Set("X-APPID", "YOURID");
wc.Headers.Set("X-APPKEY", "YOURKEY");
byte[] responseBytes = wc.UploadValues(new Uri(uri), "POST", postParms);
string stringResult = Encoding.UTF8.GetString(responseBytes);
JObject response = JObject.Parse(stringResult);
string error = response["OutputParms"]["ErrorCode"].ToString();
if (error == "0")
{
// TODO - YOUR CODE HERE
}
}
using System;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using System.Collections.Specialized;
using FusionServiceHelper.Models;
// NOTE: Use the namespace generated when you add the class, so that it is correct.
namespace FusionRazor.Models
{
public class PostAddRelatedParty
{
// Add property for each input param in order to map a field to it
[Required(ErrorMessage = "Required")]
[RegularExpression("[0-9]{0,9}", ErrorMessage = "Numeric values only. Must be 9 digits or less. ")]
public string locationID{get; set;}
[Required(ErrorMessage = "Required")]
[RegularExpression("^(?=.{0,2}$).*", ErrorMessage = "Must be 2 characters or less. ")]
public string rpTypeCode{get; set;}
[RegularExpression("^(?=.{0,30}$).*", ErrorMessage = "Must be 30 characters or less. ")]
public string relatedPartyName{get; set;}
[RegularExpression("[0-9]{0,1}", ErrorMessage = "Numeric values only. Must be 1 digits or less. ")]
public string companyPerson{get; set;}
[RegularExpression("^(?=.{0,30}$).*", ErrorMessage = "Must be 30 characters or less. ")]
public string address1{get; set;}
[RegularExpression("^(?=.{0,30}$).*", ErrorMessage = "Must be 30 characters or less. ")]
public string address2{get; set;}
[RegularExpression("^(?=.{0,30}$).*", ErrorMessage = "Must be 30 characters or less. ")]
public string address3{get; set;}
[RegularExpression("^(?=.{0,9}$).*", ErrorMessage = "Must be 9 characters or less. ")]
public string zipCode{get; set;}
[RegularExpression("[0-9]{0,10}", ErrorMessage = "Numeric values only. Must be 10 digits or less. ")]
public string phoneNumber{get; set;}
[RegularExpression("^(?=.{0,4}$).*", ErrorMessage = "Must be 4 characters or less. ")]
public string carrierRoute{get; set;}
[RegularExpression("^(?=.{0,1}$).*", ErrorMessage = "Must be 1 characters or less. ")]
public string recordStatus{get; set;}
[RegularExpression("^(?=.{0,3}$).*", ErrorMessage = "Must be 3 characters or less. ")]
public string deliveryPoint{get; set;}
[RegularExpression("[0-9]{0,7}", ErrorMessage = "Numeric values only. Must be 7 digits or less. ")]
public string dateOfBirth{get; set;}
[RegularExpression("[0-9]{0,7}", ErrorMessage = "Numeric values only. Must be 7 digits or less. ")]
public string effectiveDate{get; set;}
public PostAddRelatedParty()
{
//Set any defaults here
}
}
}
@* NOTE: Use Add->View to add the View. *@
@* NOTE: Check the 'Create strongly-typed view checkbox, and select the PostAddRelatedParty class. *@
@* NOTE: Select Edit as the Scaffold template. *@
@* NOTE: Use the @model line that is generated at the top. Replace the rest with the lines below.
@model FusionRazor.Models.PostAddRelatedParty
@{
ViewBag.Title = "PostAddRelatedParty";
}
<h2>PostAddRelatedParty</h2>
@using (Html.BeginForm()) {
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)
<fieldset>
<legend>PostAddRelatedParty</legend>
<div class="editor-label">
@Html.LabelFor(model => model.locationID)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.locationID)
@Html.ValidationMessageFor(model => model.locationID)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.rpTypeCode)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.rpTypeCode)
@Html.ValidationMessageFor(model => model.rpTypeCode)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.relatedPartyName)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.relatedPartyName)
@Html.ValidationMessageFor(model => model.relatedPartyName)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.companyPerson)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.companyPerson)
@Html.ValidationMessageFor(model => model.companyPerson)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.address1)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.address1)
@Html.ValidationMessageFor(model => model.address1)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.address2)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.address2)
@Html.ValidationMessageFor(model => model.address2)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.address3)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.address3)
@Html.ValidationMessageFor(model => model.address3)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.zipCode)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.zipCode)
@Html.ValidationMessageFor(model => model.zipCode)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.phoneNumber)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.phoneNumber)
@Html.ValidationMessageFor(model => model.phoneNumber)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.carrierRoute)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.carrierRoute)
@Html.ValidationMessageFor(model => model.carrierRoute)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.recordStatus)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.recordStatus)
@Html.ValidationMessageFor(model => model.recordStatus)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.deliveryPoint)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.deliveryPoint)
@Html.ValidationMessageFor(model => model.deliveryPoint)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.dateOfBirth)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.dateOfBirth)
@Html.ValidationMessageFor(model => model.dateOfBirth)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.effectiveDate)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.effectiveDate)
@Html.ValidationMessageFor(model => model.effectiveDate)
</div>
<p>
<input type="submit" value="Submit"/>
</p>
</fieldset>
}
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
}
using System;
using System.Collections.Specialized;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using FusionServiceHelper.Models;
// NOTE: Replace 'MyController' with the name of your controller.
//
// GET: /MyController/PostAddRelatedParty
public ActionResult PostAddRelatedParty()
{
// Create a new instance of the model to pick up any default values.
PostAddRelatedParty model = new PostAddRelatedParty();
// pass model to set to default values
// NOTE: Change 'MyFolderPath' to the path to the .cshtml file.
return View("~/Views/MyFolderPath/PostAddRelatedParty.cshtml", model);
}
//
// POST: /MyController/PostAddRelatedParty
[HttpPost]
public ActionResult PostAddRelatedParty(FormCollection collection)
{
string url = "v3/Naviline/Land/AddRelatedParty";
// Get the value from each input field
NameValueCollection inputParms = new NameValueCollection();
inputParms.Add("locationID", collection["locationID"]);
inputParms.Add("rpTypeCode", collection["rpTypeCode"]);
inputParms.Add("relatedPartyName", collection["relatedPartyName"]);
inputParms.Add("companyPerson", collection["companyPerson"]);
inputParms.Add("address1", collection["address1"]);
inputParms.Add("address2", collection["address2"]);
inputParms.Add("address3", collection["address3"]);
inputParms.Add("zipCode", collection["zipCode"]);
inputParms.Add("phoneNumber", collection["phoneNumber"]);
inputParms.Add("carrierRoute", collection["carrierRoute"]);
inputParms.Add("recordStatus", collection["recordStatus"]);
inputParms.Add("deliveryPoint", collection["deliveryPoint"]);
inputParms.Add("dateOfBirth", collection["dateOfBirth"]);
inputParms.Add("effectiveDate", collection["effectiveDate"]);
try
{
// Send the request
FusionServiceRequest request = new FusionServiceRequest();
FusionServiceResult result = request.Post(url, inputParms);
return View("Result", result);
}
catch(Exception e)
{
HandleErrorInfo info = new HandleErrorInfo(e, "MyController", "PostAddRelatedParty");
return View("Error", info);
}
}