//carga el modal con la data del maestro detalle seleccionado para ser modificado private void imgModificar_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { Image img = sender as Image; cMaestrosDetalleDesktop row = img.DataContext as cMaestrosDetalleDesktop; cMaestrosDetalleDesktop MD = new cMaestrosDetalleDesktop(); MD.idMaestroCabecera = row.idMaestroCabecera; MD.descripcion = row.descripcion; MD.indActivo = row.indActivo; uiModificarMaestros modificar = new uiModificarMaestros(MD.idMaestroCabecera, MD.descripcion, MD.indActivo, this, pw); AplicarEfecto(); modificar.ShowDialog(); }
//metodo que carga la data de los maestros detalles en el listview public void cargarMDetalles(Int64 id) { cMaestrosDetalleDesktop MDD = new cMaestrosDetalleDesktop(); listaMaestrosDetalle.ItemsSource = MDD.CargarLista(id); }
/// <summary> /// @Autor:Simon Vera, Jose Perez , Pedro Marval /// @Fecha:12/09/2018 /// @Descripcion: método para retornar los maestros detalles que coincidan con los parámetros de búsquedas que se le pasen /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnBuscar_Click(object sender, RoutedEventArgs e) { bool? bandera = null; string desde; string hasta; try { if (!(BtnBDia.IsVisible)) { desde = hasta = dpFecha.Text != "" ? dpFecha.Text : "0001-01-01"; if (cmbIndActivo.Text == "Activo") { bandera = true; } if (cmbIndActivo.Text == "Inactivo") { bandera = false; } List <cMaestrosDetalleDesktop> result = new List <cMaestrosDetalleDesktop>(); var lista = svc.ConsultarMaestroDetalle(-1, id, txtBuscarDescripcion.Text, bandera, desde, hasta); foreach (MasterOfMasterModels.cMaestrosDetalle MD in lista) { cMaestrosDetalleDesktop datos = new cMaestrosDetalleDesktop(); datos.idMaestroDetalle = MD.idMaestroDetalle; datos.descripcion = MD.descripcion; datos.idMaestroCabecera = MD.idMaestroCabecera; datos.idUsuarioActualiza = MD.idUsuarioActualiza; datos.idUsuarioCreador = MD.idUsuarioCreador; datos.indActivo = MD.indActivo; datos.fechaCreacion = MD.fechaCreacion.ToShortDateString(); datos.fechaOcurrencia = MD.fechaOcurrencia.ToShortDateString(); result.Add(datos); } if (!(result.Count > 0)) { MessageBox.Show("No se encontraron resultados", "Información "); } listaMaestrosDetalle.ItemsSource = result; } else { desde = dpFechaInicial.Text; hasta = dpFechaFinal.Text; bool flag = true; if (desde == "" && hasta != "") { flag = false; MessageBox.Show("Debe ingresar la fecha de inicio", "Alerta"); } if (desde != "" && hasta == "") { flag = false; MessageBox.Show("Debe ingresar la fecha fin", "Alerta"); } if (Convert.ToDateTime(desde) > Convert.ToDateTime(hasta)) { flag = false; MessageBox.Show("La fecha de inicio (Desde) debe ser menor a la fecha fin (Hasta)", "Alerta"); } if (flag) { if (cmbIndActivo.Text == "Activo") { bandera = true; } if (cmbIndActivo.Text == "Inactivo") { bandera = false; } List <cMaestrosDetalleDesktop> result = new List <cMaestrosDetalleDesktop>(); var lista = svc.ConsultarMaestroDetalle(-1, id, txtBuscarDescripcion.Text, bandera, desde, hasta); foreach (MasterOfMasterModels.cMaestrosDetalle MD in lista) { cMaestrosDetalleDesktop datos = new cMaestrosDetalleDesktop(); datos.idMaestroDetalle = MD.idMaestroDetalle; datos.descripcion = MD.descripcion; datos.idMaestroCabecera = MD.idMaestroCabecera; datos.idUsuarioActualiza = MD.idUsuarioActualiza; datos.idUsuarioCreador = MD.idUsuarioCreador; datos.indActivo = MD.indActivo; datos.fechaCreacion = MD.fechaCreacion.ToShortDateString(); datos.fechaOcurrencia = MD.fechaOcurrencia.ToShortDateString(); result.Add(datos); } if (!(result.Count > 0)) { MessageBox.Show("No se encontraron resultados", "Información "); } listaMaestrosDetalle.ItemsSource = result; } } } catch (Exception Ex) { Console.WriteLine(Ex.Message); Log.Error(Ex.Message); } }