Skip to content

Instantly share code, notes, and snippets.

@luisrudge
luisrudge / gist:3750939
Created September 19, 2012 17:26
utilizando proc com entity framework
/// <summary>
/// Recupera o relatório de questionários respondidos
/// </summary>
/// <param name="userId">Código do usuário</param>
/// <param name="startDate">Data de filtro: De</param>
/// <param name="endDate">Data de filtro: Até</param>
/// <param name="trainingId">Código do treinamento</param>
/// <returns></returns>
public IEnumerable<UserReportDTO> GetReports(int userId, DateTime? startDate, DateTime? endDate, string trainingId)
{
@luisrudge
luisrudge / gist:3853754
Created October 8, 2012 17:27
exemplo de paginação
--tamanho da página
DECLARE @PageSize INT
SET @PageSize = 25
--Índice da página (começa em 1)
DECLARE @Page INT
SET @Page = 4
--Índice do primeiro registro a ser exibido (não precisa ser um parâmetro, pode ser calculado internamente)
DECLARE @PageStartIndex INT
SET @PageStartIndex = ((@Page - 1) * @PageSize); --qual o primeiro registro da página
public interface IDomainEntity
{
object Id { get; set; }
}
public interface IRepository<T> : IDisposable where T : IDomainEntity
{
IQueryable<T> GetAll();
IQueryable<T> Query(string sql, params object[] args);
IQueryable<T> PagedQuery(long pageNumber, long pageSize, string sql, params object[] args);
@luisrudge
luisrudge / app.js
Created December 18, 2012 17:13 — forked from anonymous/app.js
/// <reference path="../ts/sammyjs-0.7.d.ts" />
/// <reference path="../ts/jquery-1.8.d.ts" />
/// <reference path="../ts/knockout-2.2.d.ts" />
/// <reference path="bootstrapper.ts" />
module dashboard {
export class queryParameters {
constructor (campaignId: string, interval: string, date?: Date, from?: Date, to?: Date) {
this.campaignId = campaignId;
this.interval = interval;
var dashboard;
(function (dashboard) {
var queryParameters = (function () {
function queryParameters(campaignId, interval, date, from, to) {
this.campaignId = campaignId;
this.interval = interval;
this.date = date;
this.from = from;
this.to = to;
}
<script type="text/html" id="base-report-template">
<div class="loading" data-bind="visible: visibleCondition"></div>
<h2 data-bind="text: title"></h2>
<div data-bind="template: { name: 'error-template' }, visible: iteratedCollection.length === 0"></div>
<div data-bind="visibility: !visibleCondition && iteratedCollection.length > 0">
<div class="span12" data-bind="css: { 'plot-wrapper': wrap }, style: { height: wrap ? height : 'auto' }">
<table class="table table-hover">
<thead>
<tr>
@luisrudge
luisrudge / subscriber.cs
Created January 17, 2013 13:19
does this makes sense?
using System;
using System.Threading.Tasks;
using Microsoft.AspNet.SignalR.Client;
using Microsoft.AspNet.SignalR.Client.Hubs;
using TecUnica.Core;
namespace TecUnica.PubSub
{
public class Subscriber : ISubscriber
{
@luisrudge
luisrudge / Program.cs
Last active December 11, 2015 06:18
signalr pubsub
class Program
{
static void Main(string[] args)
{
var s = new Subscriber();
const string topic = "Topic.Name";
s.Subscribe<string>(topic, msg => Console.WriteLine("NOTIFIED: " + msg)).Wait();
var p = new Publisher();
<rule name="RemoveDirectory">
<match url="directory/(.*)" />
<action type="Rewrite" url="/{R:1}" />
<conditions>
<add input="{HTTP_HOST}" pattern="^www.mysite.com$" />
</conditions>
</rule>
@luisrudge
luisrudge / Brand.cs
Last active December 15, 2015 12:19
some ideas around petapoco external mapping
public class Brand
{
public int Id { get; set; }
public string Name { get; set; }
public int? ParentBrandId { get; set; }
}