Update Related Party
Name | Type | Length | Description |
---|---|---|---|
function | System.String | 1 | [Required] Function. H=History, blank=Update |
locationID | numeric | 9 | [Required] Location ID |
rpTypeCode | System.String | 2 | [Required] Related Party Type Code. |
relatedPartyName | System.String | 30 | [Required] Company or Person Name |
address1 | System.String | 30 | [Required] Address line 1 |
address2 | System.String | 30 | Address line 2 |
address3 | System.String | 30 | Address line 3 |
zipCode | System.String | 9 | [Required] 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/UpdateRelatedParty
using System.Net;
using Newtonsoft.Json.Linq;
public void MethodName(parms)
{
string uri = "http://localhost/FusionServices/v3/Naviline/Land/UpdateRelatedParty";
System.Collections.Specialized.NameValueCollection postParms =
new System.Collections.Specialized.NameValueCollection();
// Set paramater values
postParms.Add("locationID",System.Web.HttpUtility.UrlEncode("1004"));
postParms.Add("function",System.Web.HttpUtility.UrlEncode("H"));
postParms.Add("rpTypeCode",System.Web.HttpUtility.UrlEncode("P"));
postParms.Add("relatedPartyName",System.Web.HttpUtility.UrlEncode("Faith Hist"));
postParms.Add("address1",System.Web.HttpUtility.UrlEncode("123 TestH St"));
postParms.Add("zipCode",System.Web.HttpUtility.UrlEncode("32745"));
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 == "0000")
{
// 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 PostUpdateRelatedParty
{
// Add property for each input param in order to map a field to it
[Required(ErrorMessage = "Required")]
[RegularExpression("^(?=.{0,1}$).*", ErrorMessage = "Must be 1 characters or less. ")]
public string function{get; set;}
[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;}
[Required(ErrorMessage = "Required")]
[RegularExpression("^(?=.{0,30}$).*", ErrorMessage = "Must be 30 characters or less. ")]
public string relatedPartyName{get; set;}
[Required(ErrorMessage = "Required")]
[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;}
[Required(ErrorMessage = "Required")]
[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 PostUpdateRelatedParty()
{
//Set any defaults here
}
}
}
@* NOTE: Use Add->View to add the View. *@
@* NOTE: Check the 'Create strongly-typed view checkbox, and select the PostUpdateRelatedParty 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.PostUpdateRelatedParty
@{
ViewBag.Title = "PostUpdateRelatedParty";
}
<h2>PostUpdateRelatedParty</h2>
@using (Html.BeginForm()) {
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)
<fieldset>
<legend>PostUpdateRelatedParty</legend>
<div class="editor-label">
@Html.LabelFor(model => model.function)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.function)
@Html.ValidationMessageFor(model => model.function)
</div>
<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.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/PostUpdateRelatedParty
public ActionResult PostUpdateRelatedParty()
{
// Create a new instance of the model to pick up any default values.
PostUpdateRelatedParty model = new PostUpdateRelatedParty();
// pass model to set to default values
// NOTE: Change 'MyFolderPath' to the path to the .cshtml file.
return View("~/Views/MyFolderPath/PostUpdateRelatedParty.cshtml", model);
}
//
// POST: /MyController/PostUpdateRelatedParty
[HttpPost]
public ActionResult PostUpdateRelatedParty(FormCollection collection)
{
string url = "v3/Naviline/Land/UpdateRelatedParty";
// Get the value from each input field
NameValueCollection inputParms = new NameValueCollection();
inputParms.Add("function", collection["function"]);
inputParms.Add("locationID", collection["locationID"]);
inputParms.Add("rpTypeCode", collection["rpTypeCode"]);
inputParms.Add("relatedPartyName", collection["relatedPartyName"]);
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", "PostUpdateRelatedParty");
return View("Error", info);
}
}