Skip to content

Instantly share code, notes, and snippets.

View YoannArasLab's full-sized avatar

Yoann Maingon YoannArasLab

View GitHub Profile
@YoannArasLab
YoannArasLab / loadViz.js
Last active July 19, 2018 08:25
Function to load a gantt-like (timeline) of a workflow (using vis.js)
function loadViz(){
var now = moment().minutes(0).seconds(0).milliseconds(0);
// create a dataset with items
var items = new vis.DataSet();
var groups = new vis.DataSet();
@YoannArasLab
YoannArasLab / BOMReportXSLT.xslt
Created June 15, 2018 14:52
BOM Report stylesheet
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:exslt="http://exslt.org/common" xmlns:local="urn:local" extension-element-prefixes="exslt" xmlns:aras="http://www.aras-corp.com">
<xsl:output method="html" omit-xml-declaration="yes" standalone="yes" indent="yes"/>
<msxsl:script language="CSharp" implements-prefix="local">
public string dateTimeNow()
{
return DateTime.Now.ToString("yyyy/MM/dd HH:mm");
}
</msxsl:script>
<xsl:template match="/">
<html>
@YoannArasLab
YoannArasLab / printReportInPDF.cs
Created June 15, 2018 10:25
Print Aras Report In PDF
Innovator inn = this.getInnovator();
// Current User
String userId = inn.getUserID();
Item user = inn.getItemById("User", userId);
String creator = user.getProperty ("first_name", "") + " " + user.getProperty ("last_name", "");
// Item properties
String id = this.getProperty("id");
String item_number = this.getProperty("item_number");
@YoannArasLab
YoannArasLab / YM_AddFromPolytoItemtype.cs
Created February 22, 2018 08:08
[Aras] Distribute a new property on a polyitemtype to the polysources
// Get innovator ref
Innovator inn = this.getInnovator();
// retrieve the Poly-itemtype
Item polyItemType = inn.getItemById("ItemType", this.getProperty("source_id"));
// retrieve the added property name
String newPropertyName = this.getProperty("name");
// test if the itemtype is a polyitemtype
@YoannArasLab
YoannArasLab / YM_UpdateNewMorphaeProperties.cs
Created February 22, 2018 08:06
[Aras] Updates a polysource item to get the properties existing on the polyitemtype
// Get innovator ref
Innovator inn = this.getInnovator();
// Init new properties created boolean
Boolean hasNewProperties = false;
// retrieve the Poly-itemtype
Item polyItemType = inn.getItemById("ItemType", this.getProperty("source_id"));
// retrieve MorphaeItemType
@YoannArasLab
YoannArasLab / ArasDatamodelToGraphML.vb
Created February 13, 2018 15:32
VisualBasic.net script to Convert an Aras Innovator datamodel to a graphml file
Imports Aras.IOM
Imports System.Xml
Imports System.Xml.Schema
Imports System.Linq
Imports System.Xml.Linq
Imports <xmlns="http://graphml.graphdrawing.org/xmlns">
imports <xmlns:java="http://www.yworks.com/xml/yfiles-common/1.0/java">
Imports <xmlns:sys="http://www.yworks.com/xml/yfiles-common/markup/primitives/2.0">
imports <xmlns:x="http://www.yworks.com/xml/yfiles-common/markup/2.0">
Imports <xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
@YoannArasLab
YoannArasLab / FED_GetForeignCustomers.cs
Last active December 1, 2017 17:29
onAfterGet Method for inter-Aras Instance federation
// Retrieve Local Innovator instance
Innovator inn = this.getInnovator();
// make connection
HttpServerConnection foreignAras = IomFactory.CreateHttpServerConnection("http://localhost/InnovatorServer","InnovatorDBName", "<loginName>", "<md5password>");
Item login = foreignAras.Login();
// test if login succeeded
if (login.isError()) {
// if failed return Error
@YoannArasLab
YoannArasLab / SFT_getGitLabCommits.cs
Created June 21, 2017 09:04
Aras PLM - Get GitLab Commits
// to be set on after get
//if (System.Diagnostics.Debugger.Launch()) System.Diagnostics.Debugger.Break();
// innovator
var inn = this.getInnovator();
// retrieve gitlab token stored in a variable
string token= inn.getItemById("Variable","33E4B1E863BD4052B186D42D5F9B5AA8").getProperty("value","");
// retrieve gitlab url stored in a variable
string username = "myuser";
string password = "mypassword";
string encoded = System.Convert.ToBase64String(System.Text.Encoding.GetEncoding("ISO-8859-1").GetBytes(username+":"+password));
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://myJiraServer/jira/rest/api/2/issue/");
request.ContentType="application/json";
request.Method="POST";
request.Headers.Add("Authorization","Basic "+encoded);
using(var streamWriter = new StreamWriter(request.GetRequestStream())){
// to be set on after get
// setup (should be moved to variables)
string username= "user";
string password="mypassword1234";
// build search string
string ids="(";
for (int i=0;i<this.getItemCount();i++){
if (i!=0){