public bool AdicionaBoleto(boleto boletop) { try { conservadoraEntities model = Conexao.getInstance(); IQueryable<boleto> i = from p in model.boletos select p; IEnumerable<boleto> max = i.OrderBy(p => p.idboletos); if (max.Count() > 0) boletop.idboletos = max.Last().idboletos == null ? 1 : max.Last().idboletos + 1; else boletop.idboletos = 1; model.AddToboletos(boletop); model.SaveChanges(); return true; } catch (Exception e) { return false; } }
public bool SalvaBoleto(boleto boletop) { try { conservadoraEntities model = Conexao.getInstance(); IQueryable<boleto> query = from p in model.boletos where p.idboletos == boletop.idboletos select p; boleto boleto2 = query.First(); boleto2.idboletos = boletop.idboletos; boleto2.sitiuacao = boletop.sitiuacao; boleto2.data = boletop.data; boleto2.caminhoArquivo = boletop.caminhoArquivo; boleto2.idmoradores = boletop.idmoradores; model.SaveChanges(); return true; } catch (Exception e) { return false; } }
/// <summary> /// Create a new boleto object. /// </summary> /// <param name="idboletos">Initial value of the idboletos property.</param> /// <param name="idmoradores">Initial value of the idmoradores property.</param> public static boleto Createboleto(global::System.Int32 idboletos, global::System.Int32 idmoradores) { boleto boleto = new boleto(); boleto.idboletos = idboletos; boleto.idmoradores = idmoradores; return boleto; }
public bool SalvaBoleto(boleto boletop, string acesso) { if (acesso != Conexao.SenhaAcesso) throw new Exception(); return controle.SalvaBoleto(boletop); }
/// <summary> /// Deprecated Method for adding a new object to the boletos EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToboletos(boleto boleto) { base.AddObject("boletos", boleto); }