private async void PopularLista() { var api = new ApiCall(); await api.GetResponse <ObservableCollection <Estoque> >("estoques").ContinueWith((t) => { if (t.IsCompleted) { Device.BeginInvokeOnMainThread(() => { ListaEstoque = t.Result; Estoques = ListaEstoque.Select(e => $"{e.Nome} - R$ {e.Valor.ToString("N2")}").ToArray(); }); } }); await api.GetResponse <ObservableCollection <Cliente> >("clientes").ContinueWith((t) => { if (t.IsCompleted) { Device.BeginInvokeOnMainThread(() => { ListaCliente = t.Result; Clientes = ListaCliente.Select(e => e.Nome).ToArray(); }); } }); }
public ActionResult Lista() { var listaclientes = new ListaCliente(); var lista = listaclientes.Clientes(); return(View(lista)); }
public void atualizarListaCliente(int pagina) { try { using (ServicoConciliacaoContabilClient serv = new ServicoConciliacaoContabilClient()) { if (pagina == 0) { primeiroResultado = 0; } else if (pagina > 0) { primeiroResultado += QUANTIDADE_PAGINA; } else if (pagina < 0) { primeiroResultado -= QUANTIDADE_PAGINA; } List <ClienteDTO> listaServ = serv.selectClientePagina(primeiroResultado, QUANTIDADE_PAGINA, new ClienteDTO()); ListaCliente.Clear(); foreach (ClienteDTO objAdd in listaServ) { ListaCliente.Add(objAdd); } ClienteSelected = null; } } catch (Exception ex) { throw ex; } }
public async Task GetAll() { try { var x = await Repository.GetAllAsync(Page, Opcion); if (x.Count == 0) { PaginaMaxima = true; } else { if (Opcion > 1) { ListaCliente.Clear(); } foreach (var item in x) { ListaCliente.Add(item); } PaginaMaxima = false; } } catch (Exception ex) { throw ex; } }
private void btnListaClienteClick(object sender, EventArgs e) { ListaCliente listaCliente = new ListaCliente(this); listaCliente.Show(); this.Hide(); }
public void OnEditar(int id) { var item = ListaCliente.First(e => e.Id == id); var cadastroPage = new CadastroClientePage(item); Navigation.PushAsync(cadastroPage); }
public IActionResult IndiceCliente() { ListaCliente cliente = new ListaCliente() { ListaClientes = db.Cliente.ToList().Where(c => !c.Removed == true), }; return(View(cliente)); }
public IActionResult FormularioCrearCliente() { ListaCliente cliente = new ListaCliente() { ListaClientes = db.Cliente.ToList(), }; return(View(cliente)); }
private void onFinishUpdateClient(int clieID) { ClientesDao clientesDao = new ClientesDao(); Cliente cli = clientesDao.getClientePorId(clieID); listaClientes.Insert(indexClienteSeleccionado, cli); ListaCliente.BeginUpdate(); ListaCliente.Items.RemoveAt(indexClienteSeleccionado); ListaCliente.Items.Insert(indexClienteSeleccionado, getItemFromClient(cli)); ListaCliente.EndUpdate(); }
private void onFormCloseNewClient(object sender, FormClosedEventArgs eve) { ListaCliente.BeginUpdate(); ClientesDao clieDao = new ClientesDao(); clieDao.getClientesMayoresAId(((Cliente)ListaCliente.Items[ListaCliente.Items.Count].Tag).id).ForEach(elem => { ListaCliente.Items.Add(getItemFromClient(elem)); }); ListaCliente.EndUpdate(); }
public IActionResult FormularioEditCliente(int ClienteId) { ListaCliente lc = new ListaCliente() { //Id = AreaId, //Nombre = db.Area.FirstOrDefault(c => c.Id == AreaId).Nombre, //RutJefe = db.Area.FirstOrDefault(c => c.Id == AreaId).RutJefe, //ListaPersonas = db.Persona.ToList(), ClienteUnico = db.Cliente.FirstOrDefault(c => c.Id == ClienteId), }; return(View(lc)); }
public async Task GetAll() { try { var x = await _repository.GetCliente(); ListaCliente.Clear(); foreach (var item in x) { ListaCliente.Add(item); } } catch (Exception ex) { throw ex; } }
public void AtualizarListaCliente(int pagina) { try { using (ServiceServidor Servico = new ServiceServidor()) { if (pagina == 0) { IndiceNavegacao = 0; } else if (pagina > 0 && ListaCliente.Count == QuantidadePagina) { IndiceNavegacao += QuantidadePagina; } else if (pagina < 0 && IndiceNavegacao != 0) { IndiceNavegacao -= QuantidadePagina; } Cliente Cli = new Cliente(); Cli.pessoa = new Pessoa(); if (!Filtro.Trim().Equals("")) { Cli.pessoa.nome = Filtro; } IList <Cliente> ListaServ = Servico.SelectClientePagina(IndiceNavegacao, true, QuantidadePagina, true, Cli); ListaCliente.Clear(); foreach (Cliente objAdd in ListaServ) { ListaCliente.Add(objAdd); } ClienteSelected = null; } QuantidadeCarregada = ListaCliente.Count; ControlarNavegacao(); } catch (Exception ex) { throw ex; } }
public async Task <IActionResult> FormularioEditCliente(ListaCliente model) { if (ModelState.IsValid) { Cliente updateCliente = db.Cliente.FirstOrDefault(c => c.Id == model.ClienteUnico.Id); updateCliente.Nombre = model.nombre; db.Cliente.Update(updateCliente); db.SaveChanges(); return(RedirectToAction("IndiceCliente")); } else { return(FormularioEditCliente(model.ClienteUnico.Id)); } }
public async Task GetBusqueda() { try { var x = await Repository.GetBusquedaAsync(this.Busqueda); ListaCliente.Clear(); foreach (var item in x) { ListaCliente.Add(item); } } catch (Exception ex) { throw ex; } }
public async Task <IActionResult> FormularioCrearCliente(ListaCliente model) { if (ModelState.IsValid) { Cliente c = new Cliente() { Nombre = model.nombre, Removed = false, }; db.Cliente.Add(c); db.SaveChanges(); return(RedirectToAction("IndiceCliente")); } else { return(FormularioCrearCliente()); } }
// GET: api/Cliente public HttpResponseMessage Get(string idCliente) { try { ServiciosLogica Srv = new ServiciosLogica(); ListaCliente Lista = Srv.ObtenerClientes(idCliente); var response = Request.CreateResponse <IEnumerable <Cliente> >(HttpStatusCode.Created, Lista); return(response); } catch (Exception ex) { var resp = new HttpResponseMessage(HttpStatusCode.NotFound) { Content = new StringContent(string.Format(ex.Message)), ReasonPhrase = "Error al Obtener Lista de Clientes: " + ex.Message.Replace("\n", "").Replace("\r", "") }; throw new HttpResponseException(resp); } }
public ListaCliente ObtenerClientes(string idCliente) { ListaCliente lista = new ListaCliente(); MySqlConnection conexion = ServiciosBD.ObtenerConexion(); try { StringBuilder sentencia = new StringBuilder(" SELECT ID, ID_CLIENTE, NOMBRE, APEPAT, APEMAT, FECHANACIMIENTO, DIRECCION, " + "CORREO, TELEFONO, FECHAALTA, FECHAMODIFICACION, PASSWORD, FOTO, SEXO FROM CLIENTES "); sentencia.AppendLine(" WHERE 1 = 1 "); if (idCliente != "All") { sentencia.AppendLine(" AND ID_CLIENTE = @IDCLIENTE "); } MySqlCommand comando = ServiciosBD.ObtenerComando(conexion, sentencia.ToString()); if (idCliente != "All") { comando.Parameters.Add(new MySqlParameter("IDCLIENTE", idCliente)); } comando.CommandText = sentencia.ToString(); MySqlDataReader lector = comando.ExecuteReader(); while (lector.Read()) { Cliente entidad = ConvertirEntidad(lector); lista.Add(entidad); } lector.Close(); } catch (Exception ex) { throw new Exception(ex.Message); } finally { conexion.Close(); MySqlConnection.ClearPool(conexion); } return(lista); }
static void Main(string[] args) { List <Cliente> cli = new List <Cliente>(); cli.Add(new Cliente { Id = 1, Nome = "Fulano", Telefone = "2524-5784" }); cli.Add(new Cliente { Id = 2, Nome = "Ciclano", Telefone = "3245-2567" }); cli.Add(new Cliente { Id = 3, Nome = "Beltrano", Telefone = "3234-3657" }); cli.Add(new Cliente { Id = 4, Nome = "Dunha", Telefone = "2524-1258" }); cli.Add(new Cliente { Id = 5, Nome = "Locha", Telefone = "3233-3185" }); /* * foreach (var item in cli) * { * Console.WriteLine(item.Id + " - " + item.Nome + " - " + item.Telefone); * } */ Console.WriteLine(); cli.ForEach(item => { Console.WriteLine(item.Id + " - " + item.Nome + " - " + item.Telefone); }); ListaCliente lCli = new ListaCliente(cli); lCli.Listar(); Console.ReadKey(); }
private void btn_ListaClientesClick(object sender, EventArgs e) { ListaCliente listaClienteClick = new ListaCliente(this); listaClienteClick.Show(); }
private void listaClienteToolStripMenuItem_Click(object sender, EventArgs e) { ListaCliente form = new ListaCliente(); form.ShowDialog(); }
public static ListaCliente RetornarCliente() { try { con = ConnectionFactory.getConnection(); con.Open(); comando = "SELECT Nome, CPF, Usuario, Telefone, NomeRole " + "FROM Usuario INNER JOIN Role ON Usuario.IdRole = Role.IdRole " + "ORDER BY NomeRole;"; XmlSerializer ser = new XmlSerializer(typeof(ListaCliente)); list = new ListaCliente(); using (var cmd = con.CreateCommand()) { cmd.CommandText = comando.ToString(); using (var rdr = cmd.ExecuteReader()) { while (rdr.Read()) { list.Items.Add(new Cliente { Nome = rdr.GetString(0), CPF = rdr.GetString(1), Usuario = rdr.GetString(2), Telefone = rdr.GetString(3), Role = rdr.GetString(4) }); } } cmd.Dispose(); } return(list); } catch (Exception ex) { throw new Exception(ex.ToString()); } finally { try { if (con != null) { con.Close(); } } catch (Exception ex) { throw new Exception(ex.ToString()); } try { if (rdr != null) { rdr.Close(); } } catch (Exception ex) { throw new Exception(ex.ToString()); } try { if (cmd != null) { cmd.Dispose(); } } catch (Exception ex) { throw new Exception(ex.ToString()); } } }
private void button3_Click(object sender, EventArgs e) { ListaCliente listaCliente = new ListaCliente(_dbm); listaCliente.Show(); }