private void BtnAgregar_Click(object sender, RoutedEventArgs e) { try { var arete = new RecibirProductoAlmacenReplicaAretesInfo() { NumeroAreteSukarne = txtArete.Text.Trim(), ConsecutivoId = consecutivo, OrganizacionId = organizacionIdActual, UsuarioCreacionId = 1 }; if (ValidaEstructuraArete(arete.NumeroAreteSukarne.Trim())) { AgregarArete(arete); } else { SkMessageBox.Show(System.Windows.Application.Current.Windows[ConstantesVista.WindowPrincipal], Properties.Resources.RecibirProductoAlmacenReplicaAretes_ValEstructArete, MessageBoxButton.OK, MessageImage.Warning); } } catch (Exception) { throw; } }
private void AgregarArete(RecibirProductoAlmacenReplicaAretesInfo areteInfo) { try { if (areteInfo.NumeroAreteSukarne != string.Empty) { var existeArete = ListAretes.Where(a => a.NumeroAreteSukarne.Equals(areteInfo.NumeroAreteSukarne) && a.OrganizacionId == areteInfo.OrganizacionId); if (existeArete.Any()) { SkMessageBox.Show(System.Windows.Application.Current.Windows[ConstantesVista.WindowPrincipal], string.Format( Properties.Resources.RecibirProductoAlmacenReplicaAretes_AreteDuplicado, areteInfo.NumeroAreteSukarne), MessageBoxButton.OK, MessageImage.Warning); } else { ListAretes.Add(areteInfo); gridDatos.Items.Add(areteInfo); consecutivo++; } } else { SkMessageBox.Show(System.Windows.Application.Current.Windows[ConstantesVista.WindowPrincipal], Properties.Resources.RecibirProductoAlmacenReplicaAretes_CapturarArete, MessageBoxButton.OK, MessageImage.Warning); } txtArete.Text = string.Empty; txtArete.Focus(); } catch (Exception) { throw; } }
private void AgregarAreteMasivo(IEnumerable <string> listArete) { try { foreach (var cadena in listArete) { if (!ListAretes.Where(la => la.NumeroAreteSukarne.Equals(cadena)).ToList().Any()) { var arete = new RecibirProductoAlmacenReplicaAretesInfo() { NumeroAreteSukarne = cadena, ConsecutivoId = consecutivo, OrganizacionId = organizacionIdActual, UsuarioCreacionId = 1 }; ListAretes.Add(arete); gridDatos.Items.Add(arete); consecutivo++; } } lblMensaje.Visibility = Visibility.Hidden; } catch (Exception) { lblMensaje.Visibility = Visibility.Hidden; throw; } }