Skip to content

Instantly share code, notes, and snippets.

Avatar

Simon Doy SimonDoy

View GitHub Profile
View SomePowershellForDan.ps1
$sometext = "#;FirstName LastName";
$regex = "(#;)";
[System.Text.RegularExpressions.Regex]::Replace($sometext, $regex, "");
View snippet from web.config
<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>
View GetAll-Snippet-InvoiceRepository.cs
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;
}
View InvoiceController.cs
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;
View InvoiceRepository.cs
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;
@SimonDoy
SimonDoy / InvoiceDataContext.cs
Created May 24, 2016
initial implementation of InvoiceDataContext
View InvoiceDataContext.cs
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
Initial implementation of document collection for azure documentdb
View InvoiceDocumentCollection.cs
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
Implementation of InvoiceDatabase object
View InvoiceDatabase.cs
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
The initial database configuration file
View DatabaseConfig.cs
using System.Collections.Specialized;
using System.Configuration;
using System.Linq;
namespace ITSP365.InvoiceFormApp.Api.DataAccess
{
internal class DatabaseConfig
{
internal string DatabaseEndPoint {
get
View edit-invoice.html
<div class="container">
<div class="row">
<div class="col-md-4 col-sd-12">
<button class="btn btn-default" type="button" title="Save" ng-click="saveInvoice()">Save</button>
&nbsp;
<button class="btn" type="button" title="Cancel" ng-click="cancel()">Cancel</button>
</div>
<div class="col-md-8 col-sd-12">
<span ng-show="status !== ''">{{status}}</span>