예제 #1
0
        private void OkClick(object sender, RoutedEventArgs e)
        {
            string          sia   = (string)xNation.SelectedItem;
            string          namea = sia.Substring(0, sia.IndexOf("..") - 1);
            StatNationPopup fa    = A.Find(l => l.NameNation == namea);

            if (fa != null)
            {
                fa.Qty += 1;
                RepositoryStatNationPopup.Update(fa);
            }

            string          sib   = (string)xPlaceArround.SelectedItem;
            string          nameb = sib.Substring(0, sib.IndexOf("..") - 1);
            StatPlaceArrond fb    = B.Find(l => l.NamePlaceArrond == nameb);

            if (fb != null)
            {
                fb.Qty += 1;
                RepositoryStatPlaceArrond.Update(fb);
            }

            StatNation sn = new StatNation(Guid.NewGuid(),
                                           DateTime.Now,
                                           Global.Config.CustomerId,
                                           fa != null ? fa.CustomerId : Guid.Empty,
                                           fb != null ? fb.CustomerId : Guid.Empty);

            RepositoryStatNation.Add(sn);
            Close();
        }
예제 #2
0
        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 ");
                    }
                }
            }
        }