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
@section estilo { | |
<link href="@Url.Content("~/Scripts/uploadify/uploadify.css")" rel="stylesheet" type="text/css" /> | |
<link href="@Url.Content("~/Content/themes/smoothness/jquery-ui.css")" rel="stylesheet" type="text/css" /> | |
<link href="@Url.Content("~/Content/jquery.Jcrop.css")" rel="stylesheet" type="text/css" /> | |
} | |
@section scripts { | |
@JavaScriptHelper.CadastroDeCurso() @* Isto não deveria estar aqui *@ | |
} | |
@using (Html.BeginForm("Cadastrar", "Curso", FormMethod.Post, new { id = "frmCadastro", enctype = "multipart/form-data" })) | |
{ |
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
create table categoria ( | |
id int not null identity primary key, | |
nome varchar(100) not null, | |
) | |
create table produto ( | |
id int not null identity primary key, | |
nome varchar(100) not null, | |
preco money not null, | |
categoria_id int not null foreign key references categoria(id) |
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
select count(*) from categoria | |
where id not in (select categoria_id from produto) |
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
select count(*) from categoria c | |
left outer join produto p on c.Id = p.categoria_id | |
where p.id is null |
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
-- inserindo categorias | |
insert into categoria (nome) values ('categoria ') | |
go 2000 | |
-- inserindo produtos até demais... | |
declare @i int = 0 | |
while @i < 100000 | |
begin | |
insert into produto (nome, preco, categoria_id) |
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
private int[] dataSetToArray(DataSet dataset) | |
{ | |
return dataset.Tables[0].Select() | |
.Select(row => Convert.ToInt32(row["ANO"])) | |
.ToArray(); | |
} |
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 Mock<IUnitOfWork> MockUnitOfWork() | |
{ | |
var mockUnitOfWork = new Mock<IUnitOfWork>(); | |
var mockUnitOfWorkFactory = new Mock<IUnitOfWorkFactory>(); | |
mockUnitOfWorkFactory.Setup(_ => _.Criar()) | |
.Returns(mockUnitOfWork.Object); | |
var mockServiceLocator = new Mock<IServiceLocator>(); | |
mockServiceLocator.Setup(_ => _.GetInstance<IUnitOfWorkFactory>()) |
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
[TestMethod] | |
public void CadastrarPacoteDeDesconto_deve_chamar_o_repositorio_inserindo_o_pacotes_de_descontos_numa_transação() | |
{ | |
// arrange | |
var pacote = new PacoteDesconto(); | |
var mockUnitOfWork = TestHelper.MockUnitOfWork(); | |
using (Sequence.Create()) | |
{ |
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
tf undo $/Root/Folder/file.txt /workspace:"Maquina";[email protected] /s:https://SERVER.tfspreview.com/DefaultCollection |
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
private static readonly byte[] iv = // array de 16 bytes | |
private static string decrypt(string message, string key) | |
{ | |
var encryptedBytes = Convert.FromBase64String(message); | |
var aesAlg = makeAesCryptoServiceProvider(key); | |
var decryptor = aesAlg.CreateDecryptor(); | |
using (var memory = new MemoryStream(encryptedBytes)) |