Skip to content

Instantly share code, notes, and snippets.

View SimonDoy's full-sized avatar

Simon Doy SimonDoy

View GitHub Profile
<div class="container">
<div class="row">
<div ng-show="loggedIn && showInvoiceList" class="col-md-10 col-sd-3">
<div class="table-responsive">
<table class="table table-striped">
<thead>
<th>Date</th>
<th>Invoice Reference</th>
<div class="container">
<div class="row">
<div class="col-md-4 col-sd-12">
<button class="btn btn-default" type="button" title="Edit" ng-click="editInvoice()">Edit</button>
<span ng-show="error">Error: {{error}}</span>
</div>
</div>
<form>
<div id="invoiceDiv" class="row">
<h2>Invoice: {{invoice.reference}}</h2>
@SimonDoy
SimonDoy / app.js
Last active May 20, 2016 19:20
app.js added the new modules for invoiceDataService.js and invoiceController.js etc
'use strict';
var invoiceFormApp = angular.module('itspInvoiceFormApp',
[
'ngRoute', 'invoiceControllersModule', 'dataModelService', 'AdalAngular', 'applicationConstantsModule', 'configurationServiceModule', 'settingsController', 'invoiceDataService'
]);
var appStart = function($routeProvider, $httpProvider, adalProvider, applicationConstants, configurationServiceProvider) {
$routeProvider.when('/invoices/add', {
'use strict'
var invoiceControllersModule = angular.module('invoiceControllersModule', ['invoiceDataService']);
invoiceControllersModule.controller('listInvoicesController', ['$scope', '$location', 'adalAuthenticationService', 'invoiceDataService', function ($scope, $location, adalService, invoiceDataService) {
$scope.invoices = [];
$scope.error="";
$scope.showInvoiceList=function(){
'use strict';
var invoiceDataServiceModule = angular.module('invoiceDataService', ['AdalAngular', 'configurationServiceModule']);
invoiceDataServiceModule.service('invoiceDataService', ['$http', '$q', 'configurationService', 'adalAuthenticationService', invoiceDataServiceFactory]);
function invoiceDataServiceFactory($http, $q, configurationService, adalService)
{
var invoiceDataServiceDefinition={};
invoiceDataServiceDefinition.getInvoices=function getInvoices(){
var url=configurationService.settings.apiUrl + "/invoice";
@SimonDoy
SimonDoy / snippet of WebApiConfig.cs
Created May 20, 2016 19:04
Snippet from WebApiConfig.cs which shows how to setup the CamelCasePropertyName Json formatter
GlobalConfiguration.Configuration.Formatters.Remove(config.Formatters.XmlFormatter);
var jsonFormatter = GlobalConfiguration.Configuration.Formatters.JsonFormatter;
jsonFormatter.UseDataContractJsonSerializer = false;
jsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
GlobalConfiguration.Configuration.Formatters.Add(jsonFormatter);
.\Update-SPContentTypeDocumentTemplate.ps1 –Url https://sharepoint -ContentTypeName "Policy Document" -DocumentTemplatePath "c:\dev\documents\policydocumenttemplate.dotx" -DocumentTemplateFileName "policydocumenttemplatev2.dotx" -UpdateChildren
param
(
[Parameter(Mandatory=$true, HelpMessage='Url for Site Collection hosting content type')]
[string]$Url = "https://sharepoint.ithinksharepoint.com",
[Parameter(Mandatory=$true, HelpMessage='Name of the Content Type to apply document template to')]
[string]$ContentTypeName = "Policy Document",
[Parameter(Mandatory=$true, HelpMessage='File path of the document template to upload')]
[string]$DocumentTemplatePath = "",
[Parameter(Mandatory=$false, HelpMessage='Filename to store the file in SharePoint as')]
[string]$DocumentTemplateFileName = "",
public class InvoiceForm
{
public InvoiceForm()
{
this.InvoiceLines = new List<InvoiceLine>();
}
public long Id { get; set; }
public string Reference { get; set; }
public string CompanyName { get; set; }
@SimonDoy
SimonDoy / InvoiceRepository.cs
Created May 15, 2016 21:00
Implemented with GetAll, Add, Update
public class InvoiceRepository
{
private static InvoiceRepository _instance = null;
private List<InvoiceForm> _repository;
private InvoiceRepository()
{
_repository = new List<InvoiceForm>();
var invoice = new InvoiceForm();
invoice.Id = 1;