Tuesday, July 24, 2012

New Image for NuGet Redblack Tree Component

New image for my RedBlack Tree component on NuGet


Thursday, February 9, 2012

Axosoft OnTime get a list of all contact with company name, email, phone using Axosoft OnTime SDK and Powershell


clear

$securityToken="your guid here"

$customerUrl="http://[your url here]/ontimesdk/customerservice.asmx"

$onTimeCustomer = New-WebServiceProxy $customerUrl -Namespace customers

$customerHandler = New-Object customers.CustomerHandler

$dataset2 = $customerHandler.GetAllCustomerContacts($securityToken)

foreach ($contactRow in $dataset2.Tables[0].Rows)
{
if ($contactRow.CanLogin)
{
$contactRow.CompanyName
" " + $contactRow.FirstName + " " + $contactRow.LastName
" " + $contactRow.Email + " " + $contactRow.Phone
" "
}
}

Wednesday, February 8, 2012

Axosoft Ontime Getting all projects using Powershell and Axosoft Ontime SDK


clear
$securityToken="[your guid here]"

$projectUrl="http://[your url here]/ontimesdk/projectservice.asmx"

$onTimeProject = New-WebServiceProxy $projectUrl -Namespace projects

$projectHandler = New-Object projects.ProjectHandler

$dataset = $projectHandler.GetAllProjects($securityToken)

foreach ($row in $dataset.Tables[0].Rows)
{
''+$row.ProjectId + ' - ' + $row.Name
}

Tuesday, January 31, 2012

Axosoft OnTime Web Event Provider – Create Incidents Automatically with WebEventProvider OnTimeWebEventProvider

Prerequisites:




  1. Make sure you have installed your OnTime SDK on a Web Server and that it is functional/tested




  2. Make sure you have your Security GUID Ready to talking to the OnTime SDK




  3. Create a project (C#) and create a web reference that points to
    “http://your sdk server url goes here/OnTimeSdk/IncidentService.asmx?op=AddIncident”
    and call it “OnTime”




  4. Make sure you have the following references:
    image




Here is the source code for the actual WebEventProvider:


 


using System;
using System.Collections.Specialized;
using System.Web.Management;
using OnTimeWebEventProvider.Properties;

namespace OnTimeWebEventProvider
{
public class OnTimeWebEventProvider : BufferedWebEventProvider
{
private const string StrOnTimeWebEventProvider = "OnTimeWebEventProvider";
private const string StrDescription = "description";
private const string StrProjectId = "ProjectID";
private const string StrCreatedById = "CreatedByID";
private const string StrWorkflowStepId = "WorkflowStepID";
private const string StrPriorityId = "PriorityID";
private const string StrStatusId = "StatusID";
private const string StrAssignedToId = "AssignedToID";
private const string StrSeverityId = "SeverityID";
private const string StrReportedById = "ReportedByID";
private const string StrEscalationLevelId = "EscalationLevelID";
private const string StrCustomerById = "CustomerByID";
private const string StrOnTimeGuid = "OnTimeGuid";
private const string StrMessage = "Message";

private Guid _providerSecurityToken;
private int _providerProjectId;
private int _providerCreatedById;
private int _providerWorkflowStepId;
private int _providerPriorityId;
private int _providerStatusId;
private int _providerAssignedToId;
private int _providerSeverityId;
private int _providerReportedById;
private int _providerEscalationLevelId;
private int _providerCustomerById;
private String _providerMessage;

public override void Initialize(string name, NameValueCollection config)
{
if (config == null)
throw new ArgumentNullException(Resources.NullConfig);

if (string.IsNullOrEmpty(name))
name = StrOnTimeWebEventProvider;

if (string.IsNullOrEmpty(config[StrDescription]))
{
config.Remove(StrDescription);
config.Add(StrDescription, Resources.DefaultDescription);
}

if (!string.IsNullOrEmpty(config[StrOnTimeGuid]))
{
this._providerSecurityToken = new Guid(config[StrOnTimeGuid]);
config.Remove(StrOnTimeGuid);
}

VerifyAndSetConfigSetting(config, StrProjectId, out this._providerProjectId);

VerifyAndSetConfigSetting(config, StrCreatedById, out this._providerCreatedById);

VerifyAndSetConfigSetting(config, StrWorkflowStepId, out this._providerWorkflowStepId);

VerifyAndSetConfigSetting(config, StrPriorityId, out this._providerPriorityId);

VerifyAndSetConfigSetting(config, StrStatusId, out this._providerStatusId);

VerifyAndSetConfigSetting(config, StrAssignedToId, out this._providerAssignedToId);

VerifyAndSetConfigSetting(config, StrSeverityId, out this._providerSeverityId);

VerifyAndSetConfigSetting(config, StrReportedById, out this._providerReportedById);

VerifyAndSetConfigSetting(config, StrEscalationLevelId, out this._providerEscalationLevelId);

VerifyAndSetConfigSetting(config, StrCustomerById, out this._providerCustomerById);

if (!string.IsNullOrEmpty(config[StrMessage]))
{
this._providerMessage = config[StrMessage];
config.Remove(StrMessage);
}
else
{
this._providerMessage = String.Empty;
}

base.Initialize(name, config);
}

private static void VerifyAndSetConfigSetting(NameValueCollection config, string strConfigId, out int intProviderProjectId)
{
intProviderProjectId = 0;
if (!string.IsNullOrEmpty(config[strConfigId]))
if (int.TryParse(config[strConfigId], out intProviderProjectId))
config.Remove(strConfigId);
}

public override void ProcessEventFlush(WebEventBufferFlushInfo flushInfo)
{
foreach (WebBaseEvent anEvent in flushInfo.Events)
{
OnTime.Incident incident =
new OnTime.Incident
{
CreatedById = this._providerCreatedById,
WorkflowStepId = this._providerWorkflowStepId,
ProjectId = this._providerProjectId,
Name =
String.Format("Exception in Application: {0} {1}",
anEvent.EventSource, this._providerMessage),
Description = anEvent.ToString(),
ReportedDate = DateTime.Now,
PriorityTypeId = this._providerPriorityId,
StatusTypeId = this._providerStatusId,
AssignedToId = this._providerAssignedToId,
SeverityTypeId = this._providerSeverityId,
ReportedById = this._providerReportedById,
EscalationLevelId = this._providerEscalationLevelId,
ReportedByCustomerContactId = this._providerCustomerById
};

OnTime.IncidentHandler incidentHandler = new OnTime.IncidentHandler();

incidentHandler.AddIncident(this._providerSecurityToken, incident);
}
}
}
}


Here is an example use of the OnTimeWebEventProvider:


Make sure that you have a reference to the OnTimeWebEventProvider assembly (project or compiled assembly) so that it is properly copied to the ASP.NET’s directory to run the example.


(ASP.NET HTML)


<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="TestOnTimeWebEventProvider._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html xmlns="http://www.w3.org/1999/xhtml">
<
head runat="server">
<
title></title>
</
head>
<
body>
<
form id="form1" runat="server">
<
div>
<
asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
</
div>
</
form>
</
body>
</
html>


(ASP.NET .ASPX)


using System;

namespace TestOnTimeWebEventProvider
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{ }

protected void Button1_Click(object sender, EventArgs e)
{
throw new Exception("Wow, something really bad just blew up!");
}
}
}


(ASP.NET web.config)


<?xml version="1.0"?>
<
configuration>
<
appSettings/>
<
connectionStrings/>
<
system.web>
<
healthMonitoring>
<
providers>
<
add name="OnTimeWebEventProvider"
type="OnTimeWebEventProvider.OnTimeWebEventProvider"
bufferMode="Notification"
buffer="true"
OnTimeGuid="your OnTime SDK guid goes here"
ProjectID="24"
WorkflowStepID="13"
CreatedByID="1"
PriorityID="1"
StatusID="1"
AssignedToID="2"
SeverityID="2"
ReportedByID="2"
EscalationLevelID="0"
CustomerByID="0"
Message="TEST"/>
</
providers>
<
rules>
<
add name="LogAllEvents" eventName="All Errors" provider="OnTimeWebEventProvider"/>
</
rules>
</
healthMonitoring>
<
compilation debug="false" targetFramework="4.0"/>
<
authentication mode="Windows"/>
<
pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
</
system.web>
</
configuration>


That’s all folks, feedback welcome

Monday, January 30, 2012

Axosoft Ontime retrieve all worklog types using PowerShell and OnTime SDK


clear
$securityToken="your guid here"

$typeUrl="http://your url here/ontimesdk/typeservice.asmx"

$onTimeTypeServer = New-WebServiceProxy $typeUrl -Namespace types

$typeHandler = New-Object types.TypeHandler

$dataset = $typeHandler.GetWorkLogTypes($securityToken)

foreach ($row in $dataset.Tables[0].Rows)
{
"" + $row.Name + " - " + $row.WorkLogTypeId
}

Sunday, January 29, 2012

Axosoft OnTime retrieve all workflow statuses for a single workflow using PowerShell and OnTime SDK


clear

$securityToken="your guid here"
$workflowId=1

$workflowUrl="http://your url here/ontimesdk/workflowservice.asmx"

$onTimeWorkflow = New-WebServiceProxy $workflowUrl -Namespace workflows

$workflowHandler = New-Object workflows.WorkflowHandler

$dataset = $workflowHandler.GetStepsByWorkflowId($securityToken,$workflowId)

foreach ($row in $dataset.Tables[0].Rows)
{
foreach ($field in $row)
{
$field
}
}

Saturday, January 28, 2012

Axosoft OnTime Retrieve all incidents using PowerShell and OnTime SDK


clear

$securityToken="your guid here"


$incidentUrl="http://your url here/ontimesdk/incidentservice.asmx"

$onTimeServerIncident = New-WebServiceProxy $incidentUrl -Namespace incidents

$incidentHandler = New-Object incidents.IncidentHandler

$dataset = $incidentHandler.GetAllIncidents($securityToken)

foreach ($row in $dataset.Tables[0].Rows)
{
foreach ($field in $row)
{
$field
}
}