Skip to content

Instantly share code, notes, and snippets.

View SimonDoy's full-sized avatar

Simon Doy SimonDoy

View GitHub Profile
'use strict'
var constantsModule = angular.module('applicationConstantsModule', []);
constantsModule.constant('applicationConstants', {
'clientId':'{clientguidhere}',
'tenantName':'ithinksharepoint.com',
'instance':'https://login.microsoftonline.com/',
'endpoints': {'https://{apiurlhere}.azurewebsites.net/api':'https://ithinksharepoint.com/Itsp365.InvoiceFormApp.Api.Mark2'},
'apiUrl': 'https://{apiurlhere}.azurewebsites.net/api'
});
$sometext = "#;FirstName LastName";
$regex = "(#;)";
[System.Text.RegularExpressions.Regex]::Replace($sometext, $regex, "");
<appSettings>
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="documentDb:Endpoint" value="https://{url}.documents.azure.com:443/"/>
<add key="documentDb:PrimaryKey" value={primarykey}
<add key="documentDb:SecondaryKey" value="{secondarykey}
<add key="documentDb:DatabaseName" value="invoicedatabase" />
<add key="documentDb:DocumentCollectionName" value="invoicesdocumentcollection" />
</appSettings>
private IOrderedQueryable<InvoiceForm> GetAllQuery()
{
var feedOptions = new FeedOptions { MaxItemCount = -1 };
var documentCollectionUri = new Uri(_dataContext.DocumentCollection.DocumentCollection.AltLink, UriKind.RelativeOrAbsolute);
var query = _dataContext.Database.Client.CreateDocumentQuery<InvoiceForm>(documentCollectionUri, feedOptions);
return query;
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
using Itsp365.InvoiceFormApp.Api.Models.Entities;
using ITSP365.InvoiceFormApp.Api.DataAccess;
using Microsoft.ApplicationInsights;
using Microsoft.Azure.Documents;
using Microsoft.Azure.Documents.Client;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using System.Web.Http;
using Itsp365.InvoiceFormApp.Api.Models.Entities;
using Itsp365.InvoiceFormApp.Api.Repositories;
@SimonDoy
SimonDoy / InvoiceDataContext.cs
Created May 24, 2016 20:29
initial implementation of InvoiceDataContext
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
namespace ITSP365.InvoiceFormApp.Api.DataAccess
{
public class InvoiceDataContext
{
@SimonDoy
SimonDoy / InvoiceDocumentCollection.cs
Created May 24, 2016 20:28
Initial implementation of document collection for azure documentdb
using Microsoft.Azure.Documents;
using Microsoft.Azure.Documents.Client;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using System.Web;
namespace ITSP365.InvoiceFormApp.Api.DataAccess
@SimonDoy
SimonDoy / InvoiceDatabase.cs
Created May 24, 2016 20:25
Implementation of InvoiceDatabase object
using Microsoft.Azure.Documents;
using Microsoft.Azure.Documents.Client;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Net;
using System.Threading.Tasks;
using Microsoft.ApplicationInsights;
@SimonDoy
SimonDoy / DatabaseConfig.cs
Created May 24, 2016 20:20
The initial database configuration file
using System.Collections.Specialized;
using System.Configuration;
using System.Linq;
namespace ITSP365.InvoiceFormApp.Api.DataAccess
{
internal class DatabaseConfig
{
internal string DatabaseEndPoint {
get