Skip to content

Instantly share code, notes, and snippets.

Alan Juden alanjuden

Block or report user

Report or block alanjuden

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@alanjuden
alanjuden / ReportController Report Action.cs
Last active Nov 11, 2016
Custom MVC ReportViewer Report Action
View ReportController Report Action.cs
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 Nov 11, 2016
Custom ReportViewer View Example
View ReportViewer.cshtml
@model AlanJuden.MvcReportViewer.ReportViewerModel
@using AlanJuden.MvcReportViewer
@{
ViewBag.Title = "ReportViewer";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>ReportViewer</h2>
@alanjuden
alanjuden / ReportController.cs
Last active Nov 9, 2016
Custom ReportViewer ReportController Example
View ReportController.cs
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)
View ExceptionExtensions.cs
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());
View Epc.WindowsService.TaskHost.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Epc
{
public interface TaskHost
{
bool IsClosing { get; set; }
View Epc.WindowsService.TestTaskHost.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Epc
{
public class TestTaskHost : TaskHost
{
public List<Task> Tasks { get; set; }
View Epc.WindowsService.Task.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Epc
{
public abstract class Task
{
public abstract string TaskName { get; }
View Byte Conversion Class.cs
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)
View ByteConversion Extension Method.cs
using System;
using System.Reflection;
using System.ComponentModel;
namespace YourNamespace
{
public static class Missing
{
public static string GetDescription(this Enum value)
{
View Byte Conversion Enum
public enum ByteUnit
{
[System.ComponentModel.Description("B")]
Byte = 0,
[System.ComponentModel.Description("kB")]
Kilobyte = 1,
[System.ComponentModel.Description("MB")]
Megabyte = 2,
You can’t perform that action at this time.