Skip to content

Instantly share code, notes, and snippets.

@KevM
Created March 20, 2009 17:13
Show Gist options
  • Save KevM/82449 to your computer and use it in GitHub Desktop.
Save KevM/82449 to your computer and use it in GitHub Desktop.
//Here is some code that assumes you have references to the Dovetail SDK assemblies.
//First off here is what needs to be in the app settings part of the web.config file.
<appSettings>
<!-- Settings from the Configuring fcSDK documentation -->
<add key="fchoice.connectionstring" value="connectionstring"/>
<add key="fchoice.dbtype" value="mssql"/>
<add key="fchoice.disableloginfromfcapp" value="false"/>
<add key="fchoice.nocachefile" value="true"/>
</appSettings>
//Next up here is a basic web services class that has one method hard coded to create a part request detail:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using FChoice.Foundation.Clarify;
using FChoice.Toolkits.Clarify;
using FChoice.Toolkits.Clarify.Logistics;
namespace WebService1
{
/// <summary>
/// Summary description for Service1
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class Service1 : System.Web.Services.WebService
{
[WebMethod]
public void HelloClarify()
{
ClarifyApplication.Initialize();
ClarifySession session = ClarifyApplication.Instance.CreateSession();
LogisticsToolkit logisticsToolkit = new LogisticsToolkit(session);
CreatePartRequestDetailSetup setup = CreatePartRequestDetailSetup();
ToolkitResult result = logisticsToolkit.CreatePartRequestDetail(setup);
if(result.ReturnCode != 0)
{
throw new ApplicationException("Could not create the part request detail.");
}
session.CloseSession();
}
//hardcoded example, this is left as a place to do your setup
public CreatePartRequestDetailSetup CreatePartRequestDetailSetup()
{
return new CreatePartRequestDetailSetup("header id","part num", "domain", "revision", 1);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment