public async Task <IActionResult> Edit(int id, [Bind("IdRua,BairroIdBairro,NomeRua")] Rua rua) { if (id != rua.IdRua) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(rua); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RuaExists(rua.IdRua)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["BairroIdBairro"] = new SelectList(_context.Bairro, "IdBairro", "NomeBairro", rua.BairroIdBairro); return(View(rua)); }
public ActionResult Novo(Rua rua) { rua.RowKey = Guid.NewGuid().ToString(); new BuscaRuaDao().SaveOrUpdate(rua); return(RedirectToAction("Index")); }
public ClienteViewModels GetClienteViewModels() { Estado estado = 0; Sexo sexo = 0; Enum.TryParse(Estado, true, out estado); Enum.TryParse(Sexo, out sexo); return(new ClienteViewModels { ApplicationUserId = ApplicationUserId, Bairro = Bairro?.ToUpper(), Cep = Cep, Cidade = Cidade?.ToUpper(), Complemento = Complemento?.ToUpper(), Cpf = Cpf, DataNascimento = DataNascimento.Value, DddCelular = DddCelular, DddFixo = DddFixo, Email = Email, Estado = estado, Id = Id, Nome = Nome?.ToUpper(), Numero = Numero, Rua = Rua?.ToUpper(), Sexo = sexo, TelefoneCelular = TelefoneCelular, TelefoneFixo = TelefoneFixo, Ibge = codigo_num_ibge, red_cliente = red_cliente?.ToUpper() }); }
/// <summary> /// 点击下载队列 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DownloadListTapped(object sender, TappedRoutedEventArgs e) { if (Rua.CurrentSourcePageType != typeof(DownloadList)) { Rua.Navigate(typeof(DownloadList), null, new DrillInNavigationTransitionInfo()); } }
/// <summary> /// 点击本地视频 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void LocalVideoTapped(object sender, TappedRoutedEventArgs e) { if (Rua.CurrentSourcePageType != typeof(LocalVideo)) { Rua.Navigate(typeof(LocalVideo), null, new DrillInNavigationTransitionInfo()); } }
private void carregar_cliente_inicio(Cliente cliente) { Cliente novo_cliente = new Cliente(); Cidade cidade = new Cidade(); Endereco endereco = new Endereco(); Bairro_vila bairro = new Bairro_vila(); Rua rua = new Rua(); novo_cliente = regra_atendimento.puxar_cliente(cliente); endereco = regra_atendimento.puxar_endereco_cliente(novo_cliente); //-----[LEVA DADOS PARA TEXTBOX ATUAL]----------------------- cx_codCliente.Text = novo_cliente.Clie_codigo.ToString(); cx_nomeCliente.Text = novo_cliente.Clie_nome; cx_rg_re.Text = novo_cliente.Clie_rg_re; cx_cpf_cnpj.Text = novo_cliente.Clie_cpf_cnpj; if (endereco != null) { cidade = endereco.cidade; bairro = endereco.bairro; rua = endereco.rua; cx_cidade.Text = endereco.cidade.Cid_nome; cx_bairro.Text = endereco.bairro.Bai_descricao; cx_rua.Text = endereco.rua.Rua_descricao; cx_cep.Text = endereco.rua.Rua_cep; cx_numero_casa.Text = endereco.End_numero_casa; cx_numero_casa_2.Text = cx_numero_casa.Text; } }
public string FormataLogradouro(int?tamanhoFinal = null) //TODO: refatorar { string endereçoCompleto = string.Empty; if (Número.Length != 0) { endereçoCompleto += " " + Número; } if (Complemento.Length != 0) { endereçoCompleto += " " + Complemento; } if (tamanhoFinal == 0) { return(Rua + endereçoCompleto); } if (Rua.Length + endereçoCompleto.Length <= tamanhoFinal) { return(Rua + endereçoCompleto); } return(Rua.Substring(0, tamanhoFinal.Value - endereçoCompleto.Length)); }
private void atualizar_endereco(Cliente cliente) { var acao = 0; Cidade cidade = new Cidade(); Endereco endereco_novo = new Endereco(); Endereco endereco_antigo = new Endereco(); Bairro_vila bairro = new Bairro_vila(); Rua rua = new Rua(); cidade.Cid_ID = Convert.ToInt32(cb_cidade_ID.Text); bairro.Bai_ID = Convert.ToInt32(cb_bairro_ID.Text); rua.Rua_ID = Convert.ToInt32(cb_rua_ID.Text); endereco_antigo = regra_atendimento.puxar_endereco_cliente(cliente); try { endereco_novo.End_ID = endereco_antigo.End_ID; endereco_novo.cidade = cidade; endereco_novo.bairro = bairro; endereco_novo.rua = rua; endereco_novo.End_numero_casa = cx_numero_casa_2.Text; acao = regra_atendimento.upt_endereco_cliente(endereco_novo); } catch (Exception erro) { var r = erro.Message; } MessageBox.Show(msg_resultado(acao), "Atenção!!"); }
public ActionResult DeleteConfirmed(int id) { Rua rua = db.Rua.Find(id); db.Rua.Remove(rua); db.SaveChanges(); return(RedirectToAction("Index")); }
/// <summary> /// 点击搜索 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Search_Tapped(object sender, TappedRoutedEventArgs e) { //打开搜索页面 if (Rua.CurrentSourcePageType != typeof(Search)) { Rua.Navigate(typeof(Search), null, new DrillInNavigationTransitionInfo()); } }
private void Index_Tapped(object sender, TappedRoutedEventArgs e) { if (Rua.CurrentSourcePageType != typeof(Index)) { App.Link.BackStack.Clear(); Rua.Navigate(typeof(Index), null, new DrillInNavigationTransitionInfo()); } }
/// <summary> /// 点击设置 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Setting_Tapped(object sender, TappedRoutedEventArgs e) { HamburgerMenu.IsPaneOpen = false; if (Rua.CurrentSourcePageType != typeof(Setting)) { Rua.Navigate(typeof(Setting), null, new DrillInNavigationTransitionInfo()); } }
public ActionResult Excluir(int id) { Rua rua = db.Rua.Find(id); ViewBag.FkBairro = new SelectList(db.Bairro, "IdBairro", "Nome"); ViewBag.FkTipoComercio = new SelectList(db.TipoComercio, "IdComercio", "Nome"); return(View(rua)); }
private void puxa_Dados_Clientes_DB() { var novo_cliente = new Cliente(); Cidade cidade = new Cidade(); Endereco endereco = new Endereco(); Bairro_vila bairro = new Bairro_vila(); Rua rua = new Rua(); try { novo_cliente.Clie_ID = Convert.ToInt32(dg_mostra_pesquisa.SelectedCells[0].Value); novo_cliente.Fili_ID = filial.Fili_ID; novo_cliente = regra_atendimento.puxar_cliente(novo_cliente); endereco = regra_atendimento.puxar_endereco_cliente(novo_cliente); //-----[LEVA DADOS PARA TEXTBOX ATUAL]----------------------- cx_codigo_atual.Text = novo_cliente.Clie_codigo.ToString(); cx_nome_atual.Text = novo_cliente.Clie_nome; cx_rg_re.Text = novo_cliente.Clie_rg_re; cx_cpf_cnpj.Text = novo_cliente.Clie_cpf_cnpj; if (endereco != null) { cidade = endereco.cidade; bairro = endereco.bairro; rua = endereco.rua; cx_cidade.Text = endereco.cidade.Cid_nome; cx_bairro.Text = endereco.bairro.Bai_descricao; cx_rua.Text = endereco.rua.Rua_descricao; cx_cep.Text = endereco.rua.Rua_cep; cx_numero_casa.Text = endereco.End_numero_casa; } lbl_qtd_atendimento.Text = novo_cliente.Qtd_atendimento.ToString(); if (novo_cliente.Clie_codigo > 0) { bt_alterar.Enabled = true; } else { bt_alterar.Enabled = false; } } catch (Exception err) { var e = err.Message; cx_codigo_atual.Text = ""; cx_nome_atual.Text = ""; cx_rg_re.Text = ""; cx_cpf_cnpj.Text = ""; cx_cidade.Text = ""; cx_bairro.Text = ""; cx_rua.Text = ""; cx_cep.Text = ""; cx_numero_casa.Text = ""; lbl_qtd_atendimento.Text = "0"; } }
static void Main(string[] args) { Rua r1 = new Rua("Rua 1", 10000); Rua r2 = new Rua("Rua 2", 10000); Rua r3 = new Rua("Rua 3", 10000); Rua r4 = new Rua("Rua 4", 10000); Caminho caminho1 = new Caminho(); caminho1.Add(r1); caminho1.Add(r2); Caminho caminho2 = new Caminho(); caminho2.Add(r1); caminho2.Add(r4); Cruzamento cz1 = new Cruzamento(r1, r2, r3, r4); Controlador ct1 = new Controlador(cz1); Carro c1 = new Carro("Carro 1", caminho1); c1.Velocidade = 180; c1.TrocaDeRua += new Carro.CarroTrocaHandler(c1_TrocaDeRua); c1.TerminoCaminho += new Carro.CarroTerminoHandler(c1_TerminoCaminho); c1.AguardandoSemaforo += new Carro.CarroAguardandoHandler(c1_AguardandoSemaforo); c1.ImpedimentoDeProgresso += new Carro.CarroImpedidoHandler(c1_ImpedimentoDeProgresso); c1.InicioCaminho += new Carro.CarroInicioHandler(c1_InicioCaminho); Carro c2 = new Carro("Carro 2", caminho2); c2.Velocidade = 360; c2.TrocaDeRua += new Carro.CarroTrocaHandler(c1_TrocaDeRua); c2.TerminoCaminho += new Carro.CarroTerminoHandler(c1_TerminoCaminho); c2.AguardandoSemaforo += new Carro.CarroAguardandoHandler(c1_AguardandoSemaforo); c2.ImpedimentoDeProgresso += new Carro.CarroImpedidoHandler(c1_ImpedimentoDeProgresso); c2.InicioCaminho += new Carro.CarroInicioHandler(c1_InicioCaminho); c1.Iniciar(); while (carros > 0) { ct1.Avancar(); if (tempo == 26) { c2.Iniciar(); } c1.Mover(); c2.Mover(); tempo++; } Console.ReadLine(); }
public ActionResult Alterar(Rua rua) { if (ModelState.IsValid) { db.Entry(rua).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.FkBairro = new SelectList(db.Bairro, "IdBairro", "Nome"); ViewBag.FkTipoComercio = new SelectList(db.TipoComercio, "IdComercio", "Nome"); return(View(rua)); }
public ActionResult Detalhes(int id) { Rua rua = db.Rua.Find(id); ViewBag.FkBairro = new SelectList(db.Bairro, "IdBairro", "Nome"); ViewBag.FkTipoComercio = new SelectList(db.TipoComercio, "IdComercio", "Nome"); if (rua == null) { return(HttpNotFound()); } return(View(rua)); }
public async Task <IActionResult> Create([Bind("IdRua,BairroIdBairro,NomeRua")] Rua rua) { if (ModelState.IsValid) { _context.Add(rua); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["BairroIdBairro"] = new SelectList(_context.Bairro, "IdBairro", "NomeBairro", rua.BairroIdBairro); return(View(rua)); }
public ActionResult Inserir(Rua rua) { if (ModelState.IsValid) { db.Rua.Add(rua); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.FkBairro = new SelectList(db.Bairro, "IdBairro", "Nome"); ViewBag.FkTipoComercio = new SelectList(db.TipoComercio, "IdComercio", "Nome"); return(View(rua)); }
public ActionResult Edit([Bind(Include = "IdRua,FkBairro,FkTipoComercio,Nome,CEP")] Rua rua) { if (ModelState.IsValid) { db.Entry(rua).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.FkBairro = new SelectList(db.Bairro, "IdBairro", "Cidade", rua.FkBairro); ViewBag.FkTipoComercio = new SelectList(db.TipoComercio, "IdComercio", "Descricao", rua.FkTipoComercio); return(View(rua)); }
public bool Validar(out string Alertas) { StringBuilder msg = new StringBuilder(); if (string.IsNullOrEmpty(Nome.Trim())) { msg.Append("Insira o Nome do Cliente."); msg.AppendLine(); } else if (string.IsNullOrEmpty(Sobrenome.Trim())) { msg.Append("Insira o Sobrenome do Cliente."); msg.AppendLine(); } else if (string.IsNullOrEmpty(Cpf.Trim())) { msg.Append("Insira o CPF do Cliente."); msg.AppendLine(); } else if (string.IsNullOrEmpty(Telefone.Trim())) { msg.Append("Insira o Numero de Telefone do Cliente."); msg.AppendLine(); } else if (string.IsNullOrEmpty(Rua.Trim())) { msg.Append("Insira o Logradouro do Cliente."); msg.AppendLine(); } else if (string.IsNullOrEmpty(Numero.Trim())) { msg.Append("Insira o Numero do Cliente."); msg.AppendLine(); } else if (string.IsNullOrEmpty(Bairro.Trim())) { msg.Append("Insira o Bairro do Cliente."); msg.AppendLine(); } else if (string.IsNullOrEmpty(UF.Trim())) { msg.Append("Insira a UF do Cliente."); msg.AppendLine(); } else if (string.IsNullOrEmpty(CEP.Trim())) { msg.Append("Insira o Cep do Cliente."); msg.AppendLine(); } Alertas = msg.ToString(); return(msg.Length == 0); }
public ActionResult EfetuarExclusao(int id) { try { Rua rua = db.Rua.Find(id); db.Rua.Remove(rua); db.SaveChanges(); return(RedirectToAction("Index")); } catch { return(RedirectToAction("ErroExcluir")); } }
// GET: Rua/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Rua rua = db.Rua.Find(id); if (rua == null) { return(HttpNotFound()); } return(View(rua)); }
private void bt_pesquisa_rua_Click(object sender, EventArgs e) { string rua = cx_pesquisa_rua.Text; Rua r = new Rua(); if (cb_pesquisa_rua.Text == "RUA") { r.Rua_descricao = rua; } else if (cb_pesquisa_rua.Text == "CEP") { r.Rua_cep = rua; } dg_config.mostra_Rua(dg_mostra_rua, bairro_add_rua, r); }
public bool Validar(out string Alertas) { StringBuilder msg = new StringBuilder(); if (string.IsNullOrEmpty(Nome.Trim())) { msg.Append("É necessário informar o nome do Funcionario."); msg.AppendLine(); } else if (string.IsNullOrEmpty(Sobrenome.Trim())) { msg.Append("É necessário informar o sobrenome do Funcionario."); msg.AppendLine(); } else if (string.IsNullOrEmpty(Rua.Trim())) { msg.Append("É necessário informar a rua do Funcionario."); msg.AppendLine(); } else if (string.IsNullOrEmpty(Cidade.Trim())) { msg.Append("É necessário informar a cidade do Funcionario."); msg.AppendLine(); } else if (string.IsNullOrEmpty(Bairro.Trim())) { msg.Append("É necessário informar o Bairro do Funcionario."); msg.AppendLine(); } else if (string.IsNullOrEmpty(CEP.Trim())) { msg.Append("É necessário informar o CEP do Funcionario."); msg.AppendLine(); } else if (string.IsNullOrEmpty(UF.Trim())) { msg.Append("É necessário informar o UF do Funcionario."); msg.AppendLine(); } else if (string.IsNullOrEmpty(Telefone.Trim())) { msg.Append("É necessário informar o Telefone do Funcionario."); msg.AppendLine(); } Alertas = msg.ToString(); return(msg.Length == 0); }
// GET: Rua/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Rua rua = db.Rua.Find(id); if (rua == null) { return(HttpNotFound()); } ViewBag.FkBairro = new SelectList(db.Bairro, "IdBairro", "Cidade", rua.FkBairro); ViewBag.FkTipoComercio = new SelectList(db.TipoComercio, "IdComercio", "Descricao", rua.FkTipoComercio); return(View(rua)); }
private void pequisar_atualizar_endereço(string procurar) { Cidade cidade = new Cidade(); try { switch (procurar) { case "": break; case "BAIRRO": Bairro_vila bairro = new Bairro_vila(); cidade.Cid_ID = ((Cidade)cb_cidade_alterar.SelectedItem).Cid_ID; bairro.Cid_ID = cidade.Cid_ID; bairro.Bai_descricao = cx_pesquisar_endereco.Text; mostra_bairro_rua_grid(bairro, null); break; case "RUA": var rua = new Rua(); cidade.Cid_ID = ((Cidade)cb_cidade_alterar.SelectedItem).Cid_ID; rua.Cid_ID = cidade.Cid_ID; rua.Rua_descricao = cx_pesquisar_endereco.Text; rua.Rua_cep = ""; mostra_bairro_rua_grid(null, rua); break; case "CEP": var rua_c = new Rua(); cidade.Cid_ID = ((Cidade)cb_cidade_alterar.SelectedItem).Cid_ID; rua_c.Cid_ID = cidade.Cid_ID; rua_c.Rua_descricao = ""; rua_c.Rua_cep = cx_pesquisar_endereco.Text; mostra_bairro_rua_grid(null, rua_c); break; case null: default: break; } } catch { } }
private void bt_cancelar_Click(object sender, EventArgs e) { bairro_upt = null; rua_upt = null; bt_atualizar.Enabled = false; bt_cancelar.Enabled = false; cx_atualizar_bairro.ReadOnly = true; cx_atualizar_rua.ReadOnly = true; cx_atualizar_cep.ReadOnly = true; cx_atualizar_bairro.Text = ""; cx_atualizar_rua.Text = ""; cx_atualizar_cep.Text = ""; }
public Cliente GetCliente() { return(new Cliente { ApplicationUserId = ApplicationUserId, Bairro = Bairro?.ToUpper(), Cep = Cep, Cidade = Cidade?.ToUpper(), Complemento = Complemento?.ToUpper(), Cpf = Cpf, DataNascimento = DataNascimento, DddCelular = DddCelular, DddFixo = DddFixo, Email = Email, Estado = Estado.ToString().ToUpper(), Id = Id, Nome = Nome?.ToUpper(), Numero = Numero, Rua = Rua?.ToUpper(), Sexo = Sexo.ToString().ToUpper(), TelefoneCelular = TelefoneCelular, TelefoneFixo = TelefoneFixo, BairroC = Bairro?.ToUpper(), BairroE = Bairro?.ToUpper(), CepC = Cep, CepE = Cep, CidadeC = Cidade?.ToUpper(), CidadeE = Cidade?.ToUpper(), Contato = Nome?.Split(' ')[0]?.ToUpper(), EmailXml = Email, EnderecoC = Rua?.ToUpper(), EnderecoE = Rua?.ToUpper(), NumeroC = Numero, NumeroE = Numero, Referencia = Complemento?.ToUpper(), UfC = Estado.ToString().ToUpper(), UfE = Estado.ToString().ToUpper(), NumeroCliente = Numero, codigo_num_ibge = Ibge, codigo_num_ibgeC = Ibge, codigo_num_ibgeE = Ibge, red_cliente = Nome?.Split(' ')[0]?.ToUpper() }); }
private void cb_cidade_alterar_SelectedIndexChanged(object sender, EventArgs e) { Bairro_vila bairro = new Bairro_vila(); Rua rua = new Rua(); try { bairro.Cid_ID = ((Bairro_vila)cb_cidade_alterar.SelectedItem).Cid_ID; rua.Rua_descricao = ""; rua.Rua_cep = ""; } catch (Exception) { bairro.Cid_ID = 0; rua.Rua_descricao = ""; rua.Rua_cep = ""; } mostra_bairro_rua_grid(bairro, rua); }