Skip to content

Instantly share code, notes, and snippets.

View asebastian-aras's full-sized avatar

AJ Sebastian asebastian-aras

  • Aras Corporation
View GitHub Profile
@asebastian-aras
asebastian-aras / method-config.xml
Created March 31, 2020 15:07
modified method-config for app insights project
<MethodConfig>
<ReferencedAssemblies>
<name>System.dll</name>
<name>netstandard.dll</name>
<name>System.XML.dll</name>
<name>System.Web.dll</name>
<name>System.Data.dll</name>
<name>System.Core.dll</name>
<name>System.Runtime.Caching.dll</name>
<name>System.Xml.Linq.dll</name>
@asebastian-aras
asebastian-aras / labs_getCalendar.cs
Last active September 30, 2019 17:14
Code added as an onBeforeAdd to the business calendar year ItemType, which gathers a list of holidays for the given year/country and creates exceptions
/*
* There is a publicly available API that can be used to get a list of holidays for a given country
* in a given year. The goal of this method is to help automate the process of creating a business calendar
* by creating the Business Calendar Exceptions for an admin.
*
* Documentation for this API can be found at https://date.nager.at/Api
*/
Innovator inn = this.getInnovator();
// The URL we will be pinging to get the list of public holidays for our country
string dateApiUrl = "https://date.nager.at/api/v2";
@asebastian-aras
asebastian-aras / officeHour example
Created March 22, 2019 14:34
An example of an EnvironmentAttributeMethod
//MethodTemplateName=CSharp:Aras.Server.Core.AccessControl.EnvironmentAttributeMethod;
var startWorkTime = new TimeSpan(8, 0, 0);
var endWorkTime = new TimeSpan(20, 0, 0);
var currentDateTime = DateTime.Now;
var isWorkDay = DayOfWeek.Monday <= currentDateTime.DayOfWeek &&
currentDateTime.DayOfWeek <= DayOfWeek.Friday;
var isWorkTime = startWorkTime <= currentDateTime.TimeOfDay &&
currentDateTime.TimeOfDay <= endWorkTime;
var isWorkHours = isWorkDay && isWorkTime;
attribute.SetValue(isWorkHours);
@asebastian-aras
asebastian-aras / labspartLinkGenerator.cs
Last active February 19, 2019 21:33
Link example content generator
//MethodTemplateName=CSharp:Aras.TDF.ContentGenerator(Strict);
ItemDocumentElement targetItem = targetElement as ItemDocumentElement;
if (targetItem != null) {
targetItem.ClearChilds();
// if referenced item was set, then
if (!targetItem.IsEmpty)
{
TableDocumentElement tableElement = (TableDocumentElement) this.Factory.NewTable("Table", 3, 3);
asdfasdfasdfasdf
dim inv as innovator = Me.getInnovator()
dim newPart as item
dim test as new Foo
'newPart = Me.getInnovator.newResult(test.BlankPart)
newPart = test.BlankPart(inv)
return newPart
End Function ' <-- End Function must be used here in order to define the classes below