private void NovoItem() { var emprestimo = new EmprestimoCaixaTransporte(); if (Util.Repositorio.ObterLista <EmprestimoCaixaTransporte>().Any()) { var maxAtual = Util.Repositorio.ObterLista <EmprestimoCaixaTransporte>().Max(p => p.Numero); emprestimo.Numero = ++maxAtual; } else { emprestimo.Numero = 1; } this.Emprestimo = emprestimo; ExpanderAberto = false; }
private static EmprestimoCaixaTransporte VerificaConflitoEmprestimo(IEnumerable <EmprestimoCaixaTransporte> lista, EmprestimoCaixaTransporte esteEmprestimo) { var conflito = lista.FirstOrDefault(p => p.Id != esteEmprestimo.Id && p.CaixaTransporte.Identificacao.Equals(esteEmprestimo.CaixaTransporte.Identificacao) && (p.DataRetorno > esteEmprestimo.DataSaida || p.DataSaida > esteEmprestimo.DataRetorno)); return(conflito); }