Skip to content

Instantly share code, notes, and snippets.

View dshookowsky's full-sized avatar

Daniel Shookowsky dshookowsky

View GitHub Profile
@dshookowsky
dshookowsky / gist:6529572
Last active December 22, 2015 20:49
Calling dynamic stored procedure results
[WebInvoke(BodyStyle = WebMessageBodyStyle.Wrapped, Method = "POST", UriTemplate = "ExecuteReportData", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
public string ExecuteReportData(int parameter1, string reportName)
{
try
{
List<dynamic> returnList = new List<dynamic>();
if (isApprovedUser())
{
using (var db = new MyReportingEntities())
@dshookowsky
dshookowsky / ParameterExtension.cs
Created September 11, 2013 21:00
Extension to add parameters to dbCommand.
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Linq;
using System.Web;
namespace CustomExtensions
{
/// <summary>
/// Add a convenient method to add parameters to a dbCommand with value.
@dshookowsky
dshookowsky / gist:6529765
Created September 11, 2013 21:04
Reader object to expando
private dynamic SqlDataReaderToExpando(DbDataReader reader)
{
var expandoObject = new ExpandoObject() as IDictionary<string, object>;
for (var i = 0; i < reader.FieldCount; i++)
expandoObject.Add(reader.GetName(i), reader[i]);
return expandoObject;
}
@dshookowsky
dshookowsky / _layout.cshtml
Created April 10, 2014 14:06
Views/Shared/_layout.cshtml
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>@ViewBag.Title</title>
@dshookowsky
dshookowsky / _ViewStart.cshtml
Created April 10, 2014 14:07
Views/_ViewStart.cshtml
@{
Layout = "~/Views/Shared/_layout.cshtml";
}
@dshookowsky
dshookowsky / Index.cshtml
Created April 10, 2014 14:08
Views/Home/Index.cshtml
@{
ViewBag.Title = "Home";
}
<h2>Home</h2>
<span class="welcome">Welcome</span>
@dshookowsky
dshookowsky / HomeController.cs
Created April 10, 2014 14:09
Controllers/HomeController.cs
using System.Web.Mvc;
namespace Branding.Controllers
{
public class HomeController : Controller
{
//
// GET: /Home/
public ActionResult Index()
@dshookowsky
dshookowsky / StyleController.cs
Created April 10, 2014 14:10
Controllers/StyleController.cs
using System.IO;
using System.Web.Mvc;
using System.Xml;
using System.Xml.XPath;
using System.Xml.Xsl;
namespace Branding.Controllers
{
public class StyleController : Controller
{
@dshookowsky
dshookowsky / structure.css
Created April 10, 2014 14:11
Content/css/structure.css
body {
margin: 0px;
padding: 0px;
}
.titlebar {
height: 44px;
width: 100%;
text-align: center;
}
@dshookowsky
dshookowsky / brand.xml
Created April 10, 2014 14:11
Content/xml/brand.xml
<?xml version="1.0" encoding="utf-8" ?>
<style>
</style>