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 NoCacheAttribute : ActionFilterAttribute | |
{ | |
public override void OnResultExecuting(ResultExecutingContext filterContext) | |
{ | |
filterContext.HttpContext.Response.Cache.SetExpires(DateTime.UtcNow.AddDays(-1)); | |
filterContext.HttpContext.Response.Cache.SetValidUntilExpires(false); | |
filterContext.HttpContext.Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches); | |
filterContext.HttpContext.Response.Cache.SetCacheability(HttpCacheability.NoCache); | |
filterContext.HttpContext.Response.Cache.SetNoStore(); |
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
/* Drop all non-system stored procs */ | |
DECLARE @name VARCHAR(128) | |
DECLARE @SQL VARCHAR(254) | |
SELECT @name = (SELECT TOP 1 [name] FROM sysobjects WHERE [type] = 'P' AND category = 0 ORDER BY [name]) | |
WHILE @name is not null | |
BEGIN | |
SELECT @SQL = 'DROP PROCEDURE [dbo].[' + RTRIM(@name) +']' | |
EXEC (@SQL) |
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
.placeholder(@rules){ | |
&::-webkit-input-placeholder{ | |
@rules(); | |
} | |
&:-moz-placeholder{ | |
@rules(); | |
} | |
&::-moz-placeholder{ |
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 override int SaveChanges() | |
{ | |
//verificar adiciona a data atual em todos os elementos que forem adicionados no banco | |
foreach (var entry in ChangeTracker.Entries().Where(entry => entry.Entity.GetType().GetProperty("DataInclusao") != null)) | |
{ | |
if (entry.State == EntityState.Added) | |
{ | |
entry.Property("DateCreated").CurrentValue = DateTime.Now; | |
} | |
else if (entry.State == EntityState.Modified) |
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
<configuration> | |
<system.webServer> | |
<rewrite> | |
<rules> | |
<clear /> | |
<rule name="Redirect to https" stopProcessing="true"> | |
<match url=".*" /> | |
<conditions> | |
<add input="{HTTPS}" pattern="off" ignoreCase="true" /> | |
</conditions> |
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.Web; | |
using System.Configuration; | |
using System.Net.Mail; | |
namespace Utilities | |
{ | |
public static class Email |
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
Response.AppendHeader("Content-Type", "application/force-download;"); | |
Response.AppendHeader("Content-Disposition", "attachment; filename="+ FileName); |
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
$("#CidadeTelefone").keyup(function(){ | |
var tel = $(this).val(); | |
phone = tel.replace(/\D/g, ''); | |
element = $(this); | |
element.unsetMask(); | |
if(phone.length > 10) { | |
element.setMask("(99) 99999-9999"); | |
} else { | |
element.setMask("(99) 9999-99999"); | |
} |
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
#region License | |
/* Copyright (C) 2009 Tim Coulter | |
* | |
* This file is part of ExtremeML. | |
* | |
* ExtremeML is free software: you can redistribute it and/or | |
* modify it under the terms of the GNU General Public License | |
* as published by the Free Software Foundation either version | |
* 2 of the License, or (at your option) any later version. | |
* |
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
HttpContext.Response.ContentType = "application/vnd.ms-excel"; | |
HttpContext.Response.AddHeader("content-disposition", "attachment;filename=exportar.xls"); | |
HttpContext.Response.Charset = "utf-8"; | |
HttpContext.Response.ContentEncoding = System.Text.Encoding.GetEncoding("windows-1250"); |
NewerOlder