Skip to content

Instantly share code, notes, and snippets.

View jmprado's full-sized avatar

João Prado jmprado

  • Magix Tecnologia
  • Belo Horizonte, Brasil
View GitHub Profile
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace MvcTemplates_I.Models
{
/// <summary>
/// Model usado como exemplo
/// </summary>
@model DateTime?
@{
//Salva o valor como uma string validando a nulidade do objeto passado
string dateValue = Model.HasValue ? Model.Value.ToString("dd/MM/yyyy") : string.Empty;
}
@Html.TextBox("", dateValue, new { @class = "datepicker", maxlength = 10, @readonly = true })
<div class="editor-label">
@Html.LabelFor(model => model.TestDate1)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.TestDate1)
@Html.ValidationMessageFor(model => model.TestDate1)
</div>
<div class="editor-label">
<label for="TestDate1">TestDate1</label>
</div>
<div class="editor-field">
<input class="datepicker" data-val="true" data-val-required="The TestDate1 field is required." id="TestDate1" maxlength="10" name="TestDate1" readonly="True" type="text" value="" />
<span class="field-validation-valid" data-valmsg-for="TestDate1" data-valmsg-replace="true"></span>
</div>
<link href="@Url.Content("~/Content/themes/base/jquery.ui.all.css")" rel="stylesheet" type="text/css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"
type="text/javascript"></script>
<script type="text/javascript">
$(function(){
$(".datepicker").datepicker();
});
</script>
/* Portuguese initialisation for the jQuery UI date picker plugin. */
jQuery(function ($) {
$.datepicker.regional['pt'] = {
closeText: 'Fechar',
prevText: '<Anterior',
nextText: 'Seguinte',
currentText: 'Hoje',
monthNames: ['Janeiro', 'Fevereiro', 'Mar&ccedil;o', 'Abril', 'Maio', 'Junho',
'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'],
monthNamesShort: ['Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun',
<script src="@Url.Content("~/scripts/jquery.maskedinput.js")" type="text/javascript"></script>
<script type="text/javascript">
$(function(){
$(".datepicker").datepicker();
$(".number").setMask("decimal");
});
</script>
@jmprado
jmprado / DynamicLibrary.cs
Created February 24, 2014 19:46
DynamicLibrary.dll
//Copyright (C) Microsoft Corporation. All rights reserved.
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Reflection.Emit;
using System.Threading;