private void ButtonClick(object sender, RoutedEventArgs e) { int indx = Snp.FindIndex(l => l.CustomerId == CustomerId); if (indx != -1) { RepositoryStatPlaceArrond.Delete(Snp[indx]); Snp.RemoveAt(indx); } else { FunctionsService.ShowMessageTime("Erroer "); } CollectionViewSource.GetDefaultView(((WGrid)Owner).dataGrid.ItemsSource).Refresh(); foreach (Window window in Application.Current.Windows) { if (window.GetType() == typeof(WStat)) { WStat w = (window as WStat); w.Reload(); } } Close(); }
private void ButtonClick(object sender, RoutedEventArgs e) { string name = xNamePlaceArrond.Text; string QTY = xQTY.Text; if (name.Length == 0) { FunctionsService.ShowMessageTime("Пустое знаение "); } else { if (Snp.FindAll(l => l.NamePlaceArrond == name).Count > 0) { FunctionsService.ShowMessageTime("Такое имя сущ-ет "); } else { int qty; if (int.TryParse(QTY, out qty)) { int indx = Snp.FindIndex(l => l.CustomerId == this.CustomerId); if (indx != -1) { Snp[indx].NamePlaceArrond = name; Snp[indx].Qty = qty; RepositoryStatPlaceArrond.Update(Snp[indx]); } else { FunctionsService.ShowMessageTime("Erroer "); } CollectionViewSource.GetDefaultView(((WGrid)Owner).dataGrid.ItemsSource).Refresh(); foreach (Window window in Application.Current.Windows) { if (window.GetType() == typeof(WStat)) { WStat w = (window as WStat); w.Reload(); } } Close(); } else { FunctionsService.ShowMessageTime("Неверое значние поля QTY "); } } } }
private void ButtonClick(object sender, RoutedEventArgs e) { var name = xNameNation.Text; var qtyText = xQTY.Text; if (name.Length == 0) { FunctionsService.ShowMessageTime("Пустое знаение "); } else { if (Snp.Find(l => l.NameNation == name) != null) { FunctionsService.ShowMessageTime("Такое имя сущ-ет "); } else { int qty = 0; if (int.TryParse(qtyText, out qty)) { var sn = new StatNationPopup(Guid.NewGuid(), name, qty); RepositoryStatNationPopup.Add(sn); Snp.Add(sn); CollectionViewSource.GetDefaultView((Owner as WGrid).dataGrid.ItemsSource).Refresh(); foreach (Window window in Application.Current.Windows) { if (window.GetType() == typeof(WStat)) { WStat w = (window as WStat); w.Reload(); } } Close(); } else { FunctionsService.ShowMessageTime("Неверое значние поля QTY "); } } } }