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 moradores RetornaItem(int id) { conservadoraEntities model = Conexao.getInstance(); IQueryable <moradores> query = from p in model.moradores where p.idmoradores == id select p; return(query.First()); }
public ata RetornaItem(int id) { conservadoraEntities model = Conexao.getInstance(); IQueryable <ata> query = from p in model.atas where p.idata == id select p; return(query.First()); }
public bool AdicionaBalancete(balancete balancetesp) { try { conservadoraEntities model = Conexao.getInstance(); IQueryable <balancete> i = from p in model.balancetes select p; IEnumerable <balancete> max = i.OrderBy(p => p.idbalancete); if (max.Count() > 0) { balancetesp.idbalancete = max.Last().idbalancete == null ? 1 : max.Last().idbalancete + 1; } else { balancetesp.idbalancete = 1; } model.AddTobalancetes(balancetesp); model.SaveChanges(); return(true); } catch (Exception e) { var x = e.InnerException; return(false); } }
public List <condominio> RetornaLista() { conservadoraEntities model = Conexao.getInstance(); IQueryable <condominio> query = from p in model.condominios select p; return(query.ToList()); }
public balancete RetornaItem(int id) { conservadoraEntities model = Conexao.getInstance(); IQueryable <balancete> query = from p in model.balancetes where p.idbalancete == id select p; return(query.First()); }
public condominio RetornaItem(int id) { conservadoraEntities model = Conexao.getInstance(); IQueryable <condominio> query = from p in model.condominios where p.idcondominios == id select p; return(query.First()); }
public bool Salvacondominios(List <condominio> condominios, int moradorid) { try { conservadoraEntities model = Conexao.getInstance(); IQueryable <condominios_moradores> query = from p in model.condominios_moradores where p.moradore.idmoradores == moradorid select p; foreach (condominios_moradores c in query.ToArray()) { model.DeleteObject(c); } model.SaveChanges(); foreach (condominio c in condominios.ToArray()) { condominios_moradores condo = new condominios_moradores(); condo.idcondominios = c.idcondominios; condo.idmoradores = moradorid; model.AddTocondominios_moradores(condo); model.SaveChanges(); } return(true); } catch (Exception e) { return(false); } }
public List <balancete> RetornaLista() { conservadoraEntities model = Conexao.getInstance(); IQueryable <balancete> query = from p in model.balancetes select p; return(query.ToList()); }
public bool AdicionaCondominio(condominio condominio) { try { conservadoraEntities model = Conexao.getInstance(); IQueryable <condominio> i = from p in model.condominios select p; IEnumerable <condominio> max = i.OrderBy(p => p.idcondominios); if (max.Count() > 0) { condominio.idcondominios = max.Last().idcondominios == null ? 1 : max.Last().idcondominios + 1; } else { condominio.idcondominios = 1; } model.AddTocondominios(condominio); model.SaveChanges(); return(true); } catch (Exception e) { return(false); } }
public List <condominio> Retornacondominios(int id) { conservadoraEntities model = Conexao.getInstance(); IQueryable <condominio> query = from p in model.condominios_moradores where p.idmoradores == id select p.condominio; return(query.ToList()); }
public bool AdicionaAta(ata atap) { try { conservadoraEntities model = Conexao.getInstance(); IQueryable <ata> i = from p in model.atas select p; IEnumerable <ata> max = i.OrderBy(p => p.idata); if (max.Count() > 0) { atap.idata = max.Last().idata == null ? 1 : max.Last().idata + 1; } else { atap.idata = 1; } atap.condominio = (from p in model.condominios where p.idcondominios == atap.idcondominios select p).FirstOrDefault(); model.AddToatas(atap); model.SaveChanges(); return(true); } catch (Exception e) { var x = e.InnerException; return(false); } }
public List <ata> RetornaAtasPorMorador(moradores mor) { conservadoraEntities model = Conexao.getInstance(); var q = from p in model.atas join c in model.condominios_moradores on p.idcondominios equals c.idcondominios join d in model.moradores on c.idmoradores equals d.idmoradores where d.idmoradores == mor.idmoradores || p.idcondominios == (from x in model.condominios where x.Sindico == mor.idmoradores select x.idcondominios).FirstOrDefault() select p; return(q.ToList()); }
public moradores RetornaItem(string id) { conservadoraEntities model = Conexao.getInstance(); IQueryable <moradores> query = from p in model.moradores where p.login == id select p; try { return(query.First()); } catch (Exception e) { var a = e.InnerException; return(null); } }
public bool Apagar(int id) { try { conservadoraEntities model = Conexao.getInstance(); IQueryable <condominio> i = from p in model.condominios where p.idcondominios == id select p; condominio condo = i.First(); model.DeleteObject(condo); model.SaveChanges(); return(true); } catch (Exception e) { return(false); } }
public bool SalvaCondominio(condominio condominio) { try { conservadoraEntities model = Conexao.getInstance(); IQueryable <condominio> query = from p in model.condominios where p.idcondominios == condominio.idcondominios select p; condominio condominio2 = query.First(); condominio2.nome = condominio.nome; condominio2.endereco = condominio.endereco; condominio2.Sindico = condominio.Sindico; model.SaveChanges(); return(true); } catch (Exception e) { return(false); } }
public bool SalvaRecado(recado recado) { try { conservadoraEntities model = Conexao.getInstance(); IQueryable <recado> query = from p in model.recados where p.idrecados == recado.idrecados select p; recado recado2 = query.First(); recado2.idcondominios = recado.idcondominios; recado2.Título = recado.Título; recado2.Texto = recado.Texto; model.SaveChanges(); return(true); } catch (Exception e) { return(false); } }
public bool SalvaMorador(moradores morador) { try { conservadoraEntities model = Conexao.getInstance(); IQueryable <moradores> query = from p in model.moradores where p.idmoradores == morador.idmoradores select p; moradores morador2 = query.First(); morador2.nome = morador.nome; morador2.cpf = morador.cpf; morador2.login = morador.login; morador2.email = morador.email; model.SaveChanges(); return(true); } catch (Exception e) { return(false); } }
public bool SalvaBalancete(balancete balancetesp) { try { conservadoraEntities model = Conexao.getInstance(); IQueryable <balancete> query = from p in model.balancetes where p.idbalancete == balancetesp.idbalancete select p; balancete balancetes2 = query.First(); balancetes2.idbalancete = balancetesp.idbalancete; balancetes2.data = balancetesp.data; balancetes2.caminhoArquivo = balancetesp.caminhoArquivo; balancetes2.idcondominios = balancetesp.idcondominios; 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); } }
public bool SalvaAta(ata atap) { try { conservadoraEntities model = Conexao.getInstance(); IQueryable <ata> query = from p in model.atas where p.idata == atap.idata select p; ata ata2 = query.First(); ata2.idata = atap.idata; ata2.data = atap.data; ata2.caminhoArquivo = atap.caminhoArquivo; ata2.idcondominios = atap.idcondominios; model.SaveChanges(); return(true); } catch (Exception e) { var x = e.InnerException; return(false); } }
public bool Apagar(int id) { try { conservadoraEntities model = Conexao.getInstance(); IQueryable <boleto> i = from p in model.boletos where p.idboletos == id select p; boleto boletop = i.First(); if ((File.Exists(boletop.caminhoArquivo))) { File.Delete(boletop.caminhoArquivo); } model.DeleteObject(boletop); model.SaveChanges(); return(true); } catch (Exception e) { return(false); } }
public int AdicionaMorador(moradores morador) { try { conservadoraEntities model = Conexao.getInstance(); IQueryable <moradores> i = from p in model.moradores select p; IEnumerable <moradores> max = i.OrderBy(p => p.idmoradores); if (max.Count() > 0) { morador.idmoradores = max.Last().idmoradores == null ? 1 : max.Last().idmoradores + 1; } else { morador.idmoradores = 1; } model.AddTomoradores(morador); model.SaveChanges(); RegisterModel rm = new RegisterModel(); rm.UserName = morador.login; rm.Password = morador.cpf; rm.Email = morador.email; AccountMembershipService ac = new AccountMembershipService(); ac.CreateUser(rm.UserName, rm.Password, rm.Email); return(morador.idmoradores); } catch (Exception e) { return(-1); } }