private void RecorrerGridObtenerMenorValor() { decimal inSaldoMin = 10000000000; int inCount = 0; if (listView.Items.Count == 0) { lblSaldo.Content = "0"; return; } foreach (var item in listView.Items) { //DataGridRow row = (DataGridRow)dataGridCert.ItemContainerGenerator.ContainerFromItem(item); //inSaldoMinNuevo = Convert.ToInt32(((TextBox)dataGridCert.Columns[7].GetCellContent(row)).Text); inCount++; if (inCount > 9) { continue; } usp_LisSaldoCertificado_Result oC = new usp_LisSaldoCertificado_Result(); oC = (usp_LisSaldoCertificado_Result)item; decimal inSaldoMinNuevo = 0; inSaldoMinNuevo = Convert.ToDecimal(oC.SALDO_CALCULADO); inSaldoMin = inSaldoMinNuevo < inSaldoMin ? inSaldoMinNuevo : inSaldoMin; } lblSaldo.Content = inSaldoMin; _regGi.lblSaldoCerGI.Content = inSaldoMin == 10000000000 ? 0 : inSaldoMin; }
} // FIN usp_InsGuiaIngresoCabecera private void RecorrerGridObtenerMenorValor(string IdCliente, string cosecha) { decimal inSaldoMin = 10000000000; var lst = _CertificadoVSPClient.usp_LisSaldoCertificado(Convert.ToInt32(IdCliente), cosecha).ToList(); ListView listView = new ListView(); listView.ItemsSource = lst; int inCount = 0; //foreach (var item in dataGridCert.Items) if (listView.Items.Count == 0) { lblSaldoCerGI.Content = "0"; return; } foreach (var item in listView.Items) { //DataGridRow row = (DataGridRow)dataGridCert.ItemContainerGenerator.ContainerFromItem(item); //inSaldoMinNuevo = Convert.ToInt32(((TextBox)dataGridCert.Columns[7].GetCellContent(row)).Text); inCount++; if (inCount > 8) { continue; } usp_LisSaldoCertificado_Result oC = new usp_LisSaldoCertificado_Result(); oC = (usp_LisSaldoCertificado_Result)item; decimal inSaldoMinNuevo = 0; inSaldoMinNuevo = Convert.ToDecimal(oC.SALDO_CALCULADO); inSaldoMin = inSaldoMinNuevo < inSaldoMin ? inSaldoMinNuevo : inSaldoMin; } lblSaldoCerGI.Content = inSaldoMin; }
private void listView_SelectionChanged(object sender, SelectionChangedEventArgs e) { /*Objetivo: Concatenar los id y descrip de los certificados seleccionados*/ var selected = listView.SelectedItems; usp_LisSaldoCertificado_Result oC = new usp_LisSaldoCertificado_Result(); if (selected == null) { return; } _regGi.lblHiddenDescCert.Content = ""; _regGi.lblHiddenIdCert.Content = ""; for (int i = 0; i < selected.Count; i++) { oC = new usp_LisSaldoCertificado_Result(); oC = (usp_LisSaldoCertificado_Result)selected[i]; _regGi.lblHiddenDescCert.Content += oC.DESCRIPCION.ToString() + "|"; _regGi.lblHiddenIdCert.Content += oC.IDCERTIFICADOVSP.ToString() + "|"; } var Oselected = selected; }