public void CargarTablaTipoServicio() { dgTipoServicios.ItemsSource = null; DataTable dt = new DataTable(); Tipos_EstadosNEG tipos_EstadosNEG = new Tipos_EstadosNEG(); try { List <TIPO_SERVICIO> lista = tipos_EstadosNEG.ListarTServicios(); dt.Columns.Add("ID"); dt.Columns.Add("NOMBRE"); dt.Columns.Add("FECHA_CREACION"); dt.Columns.Add("FECHA_ACTUALIZACION"); if (lista.Count > 0) { foreach (var x in lista) { dt.Rows.Add(x.ID, x.NOMBRE, x.FECHA_CREACION, x.FECHA_ULTIMO_UPDATE); } } dgTipoServicios.ItemsSource = dt.DefaultView; } catch (Exception ex) { MessageBox.Show("Error:\n" + ex.TargetSite + "\n" + ex.Message.ToString()); } }
public void CargarCombos() { Tipos_EstadosNEG tiposNEG = new Tipos_EstadosNEG(); SucursalNEG sucursalNEG = new SucursalNEG(); try { List <TIPO_SERVICIO> listaTServicios = tiposNEG.ListarTServicios(); if (listaTServicios.Count > 0) { cbxTipoServicio.ItemsSource = listaTServicios; cbxTipoServicio.DisplayMemberPath = "NOMBRE"; cbxTipoServicio.SelectedValuePath = "ID"; } List <ESTADO_SERVICIO> listaEServicios = tiposNEG.ListarEServicios(); if (listaEServicios.Count > 0) { cbxEstadoServicio.ItemsSource = listaEServicios; cbxEstadoServicio.DisplayMemberPath = "NOMBRE"; cbxEstadoServicio.SelectedValuePath = "ID"; } List <SUCURSAL> listaSucursales = sucursalNEG.ListarSucuralesActivas(); if (listaSucursales.Count > 0) { cbxSucursal.ItemsSource = listaSucursales; cbxSucursal.DisplayMemberPath = "NOMBRE"; cbxSucursal.SelectedValuePath = "ID"; } } catch (Exception ex) { MessageBox.Show("Error:\n" + ex.TargetSite + "\n" + ex.Message.ToString()); } }