Skip to content

Instantly share code, notes, and snippets.

View alanjuden's full-sized avatar

Alan Juden alanjuden

View GitHub Profile
@alanjuden
alanjuden / ReportController Report Action.cs
Last active November 11, 2016 04:21
Custom MVC ReportViewer Report Action
public ActionResult MyReport(string namedParameter1, string namedParameter2)
{
var model = this.GetReportViewerModel(Request);
model.ReportPath = "/Folder/Report File Name";
model.AddParameter("Parameter1", namedParameter1);
model.AddParameter("Parameter2", namedParameter2);
return View("ReportViewer", model);
}
@alanjuden
alanjuden / ReportViewer.cshtml
Last active November 11, 2016 04:16
Custom ReportViewer View Example
@model AlanJuden.MvcReportViewer.ReportViewerModel
@using AlanJuden.MvcReportViewer
@{
ViewBag.Title = "ReportViewer";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>ReportViewer</h2>
@alanjuden
alanjuden / ReportController.cs
Last active November 9, 2016 20:44
Custom ReportViewer ReportController Example
public class ReportController : AlanJuden.MvcReportViewer.ReportController
{
protected override ICredentials NetworkCredentials
{
get
{
//Custom Domain authentication (be sure to pull the info from a config file)
//return new System.Net.NetworkCredential("username", "password", "domain");
//Default domain credentials (windows authentication)
using System;
using System.Text;
public static class ExceptionExtensions
{
public static string ExceptionToString(this Exception ex)
{
StringBuilder sb = new StringBuilder();
sb.AppendLine("Date/Time: " + DateTime.UtcNow.ToString());
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Epc
{
public interface TaskHost
{
bool IsClosing { get; set; }
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Epc
{
public class TestTaskHost : TaskHost
{
public List<Task> Tasks { get; set; }
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Epc
{
public abstract class Task
{
public abstract string TaskName { get; }
public class ByteConversion
{
///
/// Converts your number from the specified fromUnit to the toUnit
///
///Number to convert
///ByteUnit that the number is already in.
///ByteUnit that you want to convert your number too.
///
public static double Convert(double number, ByteUnit fromUnit, ByteUnit toUnit)
using System;
using System.Reflection;
using System.ComponentModel;
namespace YourNamespace
{
public static class Missing
{
public static string GetDescription(this Enum value)
{
public enum ByteUnit
{
[System.ComponentModel.Description("B")]
Byte = 0,
[System.ComponentModel.Description("kB")]
Kilobyte = 1,
[System.ComponentModel.Description("MB")]
Megabyte = 2,