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 FormMain : Form | |
{ | |
private void btLupa_Click(object sender, EventArgs e) | |
{ | |
var form = new FormPesquisa(umaListaComOsDados); | |
form.ShowDialog(); | |
if(!string.IsNullOrEmpty(form.Retorno)) | |
textBox.Text = form.Retorno; | |
} |
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
values = [1, 4, 5, 2, 3, 6, 9, 7, 8] | |
for i in sorted(values): | |
print(i) | |
#[print(v) for v in sorted(values)] ou assim usando compreensão | |
soma = sum(values) | |
print('soma %d' % soma) |
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
[Table("Pessoas")] | |
public class Pessoa | |
{ | |
[Key] | |
public int Id { get; set; } | |
public string NomePrincipal { get; set; } | |
public string Nome { get; set; } | |
public bool Ativo { get; set; } | |
public virtual List<PessoaAtributoValor> Atributos { get; set; } |
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 static class DatabaseLogger | |
{ | |
public static void Log(string query) | |
{ | |
var words = query.Split(' '); | |
if (words.FirstOrDefault()?.ToUpper() == "UPDATE") | |
{ | |
//aqui salva o log de update | |
} |
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 CamelCaseControllerConfigAttribute : Attribute, IControllerConfiguration | |
{ | |
public void Initialize(HttpControllerSettings controllerSettings, HttpControllerDescriptor controllerDescriptor) | |
{ | |
var formatter = controllerSettings.Formatters.OfType<JsonMediaTypeFormatter>().Single(); | |
controllerSettings.Formatters.Remove(formatter); | |
formatter = new JsonMediaTypeFormatter | |
{ | |
SerializerSettings = { ContractResolver = new CamelCasePropertyNamesContractResolver() } |
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
[Key, ForeignKey("Entity")] | |
public int EntityId { get; set; } | |
public virtual Entity Entity { get; set; } | |
[ForeignKey("Headquarter")] | |
public int HeadquarterId { get; set; } | |
public virtual Customer Headquarter { get; set; } | |
public virtual List<Customer> Branches { get; set; } |
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
protected static T GetFromEntityModel<T>(Entity entityModel) where T : EntityBaseViewModel, new() | |
{ | |
var derivedTypes = GetDerivedClasses<T>().ToList(); | |
var typeToConvert = (from type in derivedTypes | |
let properties = type.GetProperties().Where(prop => Attribute.IsDefined(prop, typeof(SpecificInfoPerCountryAttribute))) | |
where properties != null | |
where entityModel.SpecificInfoPerCountry.Count > 0 && | |
entityModel.SpecificInfoPerCountry.All(attr => properties.Any(prop => prop.Name == attr.Description)) | |
select type).SingleOrDefault() ?? typeof(T); |
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
// JS array equivalents to C# LINQ methods - by Dan B. | |
// Here's a simple array of "person" objects | |
var people = [ | |
{ name: "John", age: 20 }, | |
{ name: "Mary", age: 35 }, | |
{ name: "Arthur", age: 78 }, | |
{ name: "Mike", age: 27 }, | |
{ name: "Judy", age: 42 }, | |
{ name: "Tim", age: 8 } |
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
100 - Move on! Get outta my way! | |
101 - | |
102 - | |
204 - I've nothing to say | |
401 - You have no power here! | |
403 - Se tu não mora aqui, vaza. | |
404 - This shit even exists? | |
405 - |
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
<div class="row"> | |
@foreach(var item in Model) | |
{ | |
<div class="col-md-4"> | |
<div class="thumbnail"> | |
<h3 style="padding-left:17px;padding:0; background-color:orangered; margin:0; text-align:center;color:white;">@Html.DisplayFor(model => item.Titulo)</h3> | |
<img src="~/Uploads/Imagens/teste.jpg" class="col-md-12 " style="padding:0;" /> | |
<div> | |
@Html.DisplayFor(model => item.Resumo); | |
</div> |
OlderNewer