Skip to main content

Examples

tip

More examples can be found in the repo.

Creating a job

Here is a simple application that creates or updates a job through the API. A job in Dime.Scheduler is the equivalent of an order (service, sales, project, production, etc.) in the real world.

See the inline comments for the steps required to complete a request successfully.

public class Program
{
public static async Task Main(string[] args)
{
Console.WriteLine("Adding/updating a job to Dime.Scheduler");

Job job = new()
{
SourceApp = "MY APPLICATION",
SourceType = "SERVICE_ORDER_0001",
JobNo = "CUSTOMER_XYZ_REPAIRCODE_012",
ShortDescription = "Repair jobs 2023 for customer XYZ"
};

DimeSchedulerClient client = new("mykey");
await client.Import.ProcessAsync(job, TransactionType.Append);

Console.ReadLine();
}
}

This will have inserted a job into Dime.Scheduler. The next step then would be to insert a task. You may reuse the instance of the client:

Task jobTask = new()
{
SourceApp = "MY APPLICATION", // Same as job
SourceType = "SERVICE_ORDER_0001", // Same as job
JobNo = "CUSTOMER_XYZ_REPAIRCODE_012", // Same as job
TaskNo = "Repair HVAC machine code 9900109 in storage room X", // Unique for this task
ShortDescription = "Repair HVAC Customer XYZ"
};

await client.Import.ProcessAsync(jobTask, TransactionType.Append);

More examples can be found on Github.

Updating live locations of resources

After running this command, you will find that resource Geoffrey (resource with no. "GEOFFREY") is in Amsterdam:

 ResourceGpsTracking model = new()
{
ResourceNo = "GEOFFREY",
Latitude = 52.372746, ,
Longitude =- 4.893086
};

Result response = await client.Resources.CreateAsync(model);

Send a message to all online users

Message model = new()
{
Severity = Severity.Warning,
Text = "Have a great day, fellow coworkers!",
};

Result response = await client.Messages.PostAsync(model);