Skip to content

Instantly share code, notes, and snippets.

@oexenhave
oexenhave / MachineConfigurationManager
Created October 31, 2016 20:56
A ConfigurationManager wrapper that allows the developer to store credentials and a like settings in a machine specific config file that takes precedence when loading over web.config
public class MachineConfigurationManager
{
private const string ConfigFileCacheKey = "ConfigFileCacheKey";
private static readonly ILog Logger = LogManager.GetLogger(typeof(MachineConfigurationManager));
public static void Init()
{
var _file = GetConfigFile();
if (!_file.Exists)
@oexenhave
oexenhave / CsvReader.cs
Last active August 29, 2015 14:16
CsvReader
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace TimeLog.IO
{
public class CsvReader
{
public bool HasHeaders { get; private set; }
@oexenhave
oexenhave / TLPAPIScaffolding2
Created January 2, 2014 10:30
TimeLog Project API Scaffolding method example
using log4net;
using log4net.Config;
using System;
using System.Linq;
using System.Diagnostics;
using System.IO;
namespace APIScaffolding
{
public class App
@oexenhave
oexenhave / TLPAPIScaffolding
Created January 2, 2014 09:50
TimeLog Project API Scaffolding class
using System;
using System.Configuration;
using System.Linq;
namespace APIScaffolding
{
public class TimelogServices
{
private TimeLogSecurityService.SecurityServiceClient _securityService;
public TimeLogSecurityService.SecurityServiceClient SecurityService
@oexenhave
oexenhave / TLPFetchTasks
Created May 20, 2013 14:55
Controller method for getting tasks from the TimeLog Project API and returning it as JSON
/// <summary>
/// Gets a list of tasks allocated to the currently authenticated user
/// </summary>
/// <returns>A JsonResult with tasks</returns>
public ActionResult Get()
{
// Prepare the envelope with a faulty state
JsonEnvelope<IEnumerable<Task>> result = new JsonEnvelope<IEnumerable<Task>> { Success = false, Data = new List<Task>(), Message = "No tasks" };
// Query the TimeLog Project web service for tasks allocated to the employee
@oexenhave
oexenhave / TLPTaskFetch
Created May 20, 2013 14:47
Angular code for fetching tasks
function DashboardCtrl($scope) {
// ¤¤¤ Property definitions ¤¤¤
$scope.tasks = [];
$scope.query = '';
// ¤¤¤ Method definitions ¤¤¤
$scope.getTasks = function () {
// Fetch the list of tasks from the web service
$.getJSON(root + 'Task/Get', {}, function (data) {
$scope.$apply(function (scope) {
@oexenhave
oexenhave / TLPTaskView
Created May 20, 2013 14:32
AngularJS task view
<div ng-controller="DashboardCtrl">
...
<h2>Tasks</h2>
<p>Search: <input type="text" id="query" ng-change="filterChange()" ng-model="query" /></p>
<div class="contentband" id="registrationBand">
<label class="overflow gridCol-04 posLeft" title="{{selectedTask}}">{{selectedTask}}</label>:
<input type="text" ng-model="registrationHours" id="registrationHours" class="gridCol-01" /> hours -
<input type="text" ng-model="registrationText" id="registrationText" class="gridCol-02" /></div>
<table id="tasks">
<tr>