private void next_Click(object sender, RoutedEventArgs e) { LojasController lc = new LojasController(); Lojas loja = lc.Next(int.Parse(txCod.Text)); FillLoja(loja); }
private void prev_Click(object sender, RoutedEventArgs e) { if ((int.Parse(txCod.Text) - 1) <= 0) { LimparCampos(); return; } LojasController lc = new LojasController(); Lojas loja = lc.Prev(int.Parse(txCod.Text)); FillLoja(loja); }
public void Start(Iniciando ini) { LojasController lc = new LojasController(); Lojas loja = null; try { this.Visibility = Visibility.Hidden; loja = lc.Search("").FirstOrDefault(); if (loja == null) { CadLoja cadatroLoja = new CadLoja(); cadatroLoja.ShowDialog(); loja = lc.Search("").FirstOrDefault(); } txCod_loja.Text = loja.Id.ToString(); txNome_loja.Text = loja.Razao_social; txUsuario.Focus(); this.Visibility = Visibility.Visible; ini.EnabledClose = true; ini.Close(); } catch (Exception ex) { MessageBox.Show(@"Não foi possível conectar-se com o servidor. Verifique a configuração de rede do computador. Verifique se o cabo de rede ou Wi-Fi está conectado e tente novamente. Caso o problema persista, acione o suporte Doware.", "Erro", MessageBoxButton.OK, MessageBoxImage.Error); Environment.Exit(0); } feito = true; }
private void Salvar() { LojasController lc = new LojasController(); Lojas loja = (int.Parse(txCod.Text) == 0 ? new Lojas() : lc.Find(int.Parse(txCod.Text))); loja.Id = int.Parse(txCod.Text); loja.Razao_social = txRazao_s.Text; loja.Nome_fantasia = txNome_f.Text; loja.Cnpj = txCnpj.Text; loja.Logradouro = txLogradouro.Text; loja.Bairro = txBairro.Text; loja.Municipio = txMunicipio.Text; int numero = 0; if (int.TryParse(txNumero.Text, out numero)) { loja.Numero = int.Parse(txNumero.Text); } else { loja.Numero = 0; } loja.Uf = txUF.Text; loja.Responsavel = txResponsavel.Text; loja.Telefone = txTelefone.Text; loja.Celular = txCelular.Text; if (lc.Save(loja)) { LimparCampos(); } }
private void Pesquisar() { List <Lojas> list = new LojasController().Search(txPesquisa.Text); dataGrid.ItemsSource = list; }