private void Button_Click(object sender, RoutedEventArgs e) { int indx = SNP.FindIndex(l => l.IdCustomer == this.CustomerId); if (indx != -1) { Class.ClassSync.Stat.StatPlaceArrond.del(SNP[indx]); SNP.RemoveAt(indx); } else { new Class.ClassFunctuon().showMessageTime("Erroer "); } CollectionViewSource.GetDefaultView((this.Owner as W_Grid).dataGrid.ItemsSource).Refresh(); foreach (Window window in Application.Current.Windows) { if (window.GetType() == typeof(W_Stat)) { W_Stat w = (window as W_Stat); w.reload(); } } this.Close(); }
private void Button_Click(object sender, RoutedEventArgs e) { Class.ClassSync.Stat.StatPlaceArrond sn = new Class.ClassSync.Stat.StatPlaceArrond(); string Name = xNamePlaceArrond.Text; string QTY = xQTY.Text; if (Name.Length == 0) { new Class.ClassFunctuon().showMessageTime("Пустое знаение "); } else { if (SNP.Find(l => l.NamePlaceArrond == Name) != null) { new Class.ClassFunctuon().showMessageTime("Такое имя сущ-ет "); } else { int qty = 0; if (int.TryParse(QTY, out qty)) { sn.IdCustomer = Guid.NewGuid(); sn.NamePlaceArrond = Name; sn.QTY = qty; Class.ClassSync.Stat.StatPlaceArrond.ins(sn); SNP.Add(sn); CollectionViewSource.GetDefaultView((this.Owner as W_Grid).dataGrid.ItemsSource).Refresh(); foreach (Window window in Application.Current.Windows) { if (window.GetType() == typeof(W_Stat)) { W_Stat w = (window as W_Stat); w.reload(); } } this.Close(); } else { new Class.ClassFunctuon().showMessageTime("Неверое значние поля QTY "); } } } }
private void Button_Click(object sender, RoutedEventArgs e) { string Name = xNamePlaceArrond.Text; string QTY = xQTY.Text; if (Name.Length == 0) { new Class.ClassFunctuon().showMessageTime("Пустое знаение "); } else { if (SNP.FindAll(l => l.NamePlaceArrond == Name).Count > 0) { new Class.ClassFunctuon().showMessageTime("Такое имя сущ-ет "); } else { int qty = 0; if (int.TryParse(QTY, out qty)) { int indx = SNP.FindIndex(l => l.IdCustomer == this.CustomerId); if (indx != -1) { SNP[indx].NamePlaceArrond = Name; SNP[indx].QTY = qty; Class.ClassSync.Stat.StatPlaceArrond.mod(SNP[indx]); } else { new Class.ClassFunctuon().showMessageTime("Erroer "); } CollectionViewSource.GetDefaultView((this.Owner as W_Grid).dataGrid.ItemsSource).Refresh(); foreach (Window window in Application.Current.Windows) { if (window.GetType() == typeof(W_Stat)) { W_Stat w = (window as W_Stat); w.reload(); } } this.Close(); } else { new Class.ClassFunctuon().showMessageTime("Неверое значние поля QTY "); } } } }