View ReportController Report Action.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} |
View ReportViewer.cshtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@model AlanJuden.MvcReportViewer.ReportViewerModel | |
@using AlanJuden.MvcReportViewer | |
@{ | |
ViewBag.Title = "ReportViewer"; | |
Layout = "~/Views/Shared/_Layout.cshtml"; | |
} | |
<h2>ReportViewer</h2> |
View ReportController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public enum ByteUnit | |
{ | |
[System.ComponentModel.Description("B")] | |
Byte = 0, | |
[System.ComponentModel.Description("kB")] | |
Kilobyte = 1, | |
[System.ComponentModel.Description("MB")] | |
Megabyte = 2, |
NewerOlder