public bool AtualidarLogradouro(LogradouroEntity oLogradouro) { bool returnSucess = false; try { using (var myModel = new ContextModel.Model()) { ClienteEntity updateCliente = new ClienteEntity(); myModel.Update(oLogradouro); myModel.SaveChanges(); returnSucess = true; } } catch (Exception ex) { throw ex; } return(returnSucess); }
public List <LogradouroEntity> ListarLogradouro(LogradouroEntity oLogradouro) { List <LogradouroEntity> returnListLogradouroEntity = new List <LogradouroEntity>(); returnListLogradouroEntity = base.ListarLogradouros(oLogradouro); return(returnListLogradouroEntity); }
public bool AtualidarLogradouro(LogradouroEntity oLogradouro) { bool returnSucess = false; returnSucess = base.AtualidarLogradouro(oLogradouro); return(returnSucess); }
public LogradouroEntity ConsultaCep(string cep) { string url = "http://www.midiaville.com.br/webservices/?cep=" + cep; XmlTextReader reader = new XmlTextReader(url); XmlDocument xmlDoc = new XmlDocument(); LogradouroEntity logradouro = new LogradouroEntity(); while (reader.Read()) { // Here we check the type of the node, in this case we are looking for element if (reader.NodeType == XmlNodeType.Element) { switch (reader.Name) { case "bairro": logradouro.bairro = reader.ReadString(); break; case "localidade": logradouro.cidade = reader.ReadString(); break; case "logradouro": logradouro.endereco = reader.ReadString(); break; case "uf": logradouro.uf = reader.ReadString(); break; default: break; } } } reader.Close(); XmlNodeList xnList = xmlDoc.GetElementsByTagName("root"); foreach (XmlNode node in xnList) { logradouro.bairro = node["bairro"].ToString(); logradouro.cidade = node["localidade"].ToString(); logradouro.endereco = node["logradouro"].ToString(); logradouro.uf = node["uf"].ToString(); } return(logradouro); }
public bool IncluirLogradouro(LogradouroEntity oLogradouro, ClienteEntity myCliente) { bool returnSucess = false; int intVerificarLogradouroPAraCliente = new LogradouroBusiness().SelecionarLogradouroPorCliente(myCliente, oLogradouro).Count ; if (intVerificarLogradouroPAraCliente > 1) // se não tem esse endereço cadastrado para esse cliente { returnSucess = this.IncluirLogradouro(oLogradouro); } return(returnSucess); }
public List <LogradouroEntity> ListarLogradouros(LogradouroEntity oLogradouro) { List <LogradouroEntity> returnListLogradouroEntity = new List <LogradouroEntity>(); try { using (var myModel = new ContextModel.Model()) { returnListLogradouroEntity = myModel.Query <LogradouroEntity>().ToList(); } } catch (Exception ex) { throw ex; } return(returnListLogradouroEntity); }
public bool IncluirLogradouro(LogradouroEntity oLogradouro) { bool returnSucess = false; try { using (ContextModel.Model myModel = new ContextModel.Model()) { myModel.Add(oLogradouro); myModel.SaveChanges(); returnSucess = true; } } catch (Exception ex) { throw ex; } return(returnSucess); }
public List <LogradouroEntity> SelecionarLogradouroCliente(ClienteEntity myCliente, LogradouroEntity myLogradouro) { List <LogradouroEntity> returnLogradouroEntity = new List <LogradouroEntity>(); returnLogradouroEntity = SelecionarLogradouroPorCliente(myCliente, myLogradouro); return(returnLogradouroEntity); }
internal List <LogradouroEntity> SelecionarLogradouroPorCliente(ClienteEntity myCliente, LogradouroEntity myLogradouro) { List <LogradouroEntity> retorno = new List <LogradouroEntity>(); try { using (var myModel = new ContextModel.Model()) { retorno = myModel.Query <LogradouroEntity>().ToList().Where(x => x.CEP == myLogradouro.CEP && x.Bairro == myLogradouro.Bairro && x.Endereco == myLogradouro.Endereco).ToList(); retorno = (from item in retorno join item2 in myModel.Query <ClienteLogradouroEntity>().ToList() on item.ID equals item2.IDLogradouro where item2.IDCliente == myCliente.ID select item).ToList(); } } catch (Exception ex) { throw ex; } return(retorno); }