Last active
January 14, 2016 09:14
-
-
Save Microsofttechies/21450660812d3eda2d14 to your computer and use it in GitHub Desktop.
Aras innovator create an item ApplyAML
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Note for item create use action='add'...for below code -Don't use merge | |
| HttpServerConnection objCon = IomFactory.CreateHttpServerConnection("http://localhost/InnovatorServer/Server/InnovatorServer.aspx", "MyDB", "Admin", "innovator"); | |
| Item objItemRes = objCon.Login(); | |
| if (objItemRes.isError()) | |
| { | |
| throw new Exception("Login Error"); | |
| } | |
| Innovator innovator = objItemRes.getInnovator(); | |
| ////Option 1 | |
| var varResult = innovator.applyAML("<AML><Item type='Part' action='add'><classification>Assembly</classification><description> Welcome desc</description><item_number>0665099-35</item_number> <name>0665099-35</name></Item></AML>"); | |
| if (varResult.isError()) | |
| { | |
| Console.WriteLine("Item not found: " + varResult.getErrorDetail()); | |
| return; | |
| } | |
| var returnCount = varResult.getItemCount(); | |
| for (int returnI = 0; returnI < returnCount; ++returnI) | |
| { | |
| var varReturnItem = varResult.getItemByIndex(returnI); | |
| } | |
| //2nd Way | |
| string strAML = "<AML><Item type='Part' action='add'><classification>Assembly</classification><description> Welcome desc</description><item_number>1231-35</item_number><name>1231-35</name></Item></AML>"; | |
| Item oitm = innovator.newItem(); | |
| oitm.loadAML(strAML); | |
| var varResult1 = oitm.apply(); | |
| if (varResult.isError()) | |
| { | |
| Console.WriteLine("Item not found: " + varResult1.getErrorDetail()); | |
| return; | |
| } | |
| var returnCount1 = varResult.getItemCount(); | |
| for (int returnI = 0; returnI < returnCount1; ++returnI) | |
| { | |
| var varReturnItem = varResult.getItemByIndex(returnI); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment