示例#1
0
        private void BtnSelectPlaque_Click(object sender, RoutedEventArgs e)
        {
            var winPlaqueSearch = new WinPlaqueSearch();

            winPlaqueSearch.ShowDialog();
            if (winPlaqueSearch.PlaqueId == 0)
            {
                return;
            }

            if (PlaqueId.Contains(winPlaqueSearch.PlaqueId))
            {
                Utility.Message("خطا", "این پلاک یک‌بار انتخاب شده است", "Stop.png");
                return;
            }
            PlaqueId.Add(winPlaqueSearch.PlaqueId);
            PlaqueMain.Add(winPlaqueSearch.PlaqueMain);
            PlaqueSecondary.Add(winPlaqueSearch.PlaqueSecondary);
            PlaquePart.Add(winPlaqueSearch.PlaquePart);
            PlaqueDescription.Add(winPlaqueSearch.PlaqueDescription);

            _createPlaque = new List <CreatePlaque>();
            for (var i = 0; i < PlaqueId.Count; i++)
            {
                _createPlaque.Add(new CreatePlaque(PlaqueId[i], PlaqueMain[i], PlaqueSecondary[i], PlaquePart[i], PlaqueDescription[i]));
            }
            DgdPlaque.ItemsSource = _createPlaque;
        }
示例#2
0
        private void BtnDeletePlaque_Click(object sender, RoutedEventArgs e)
        {
            if (DgdPlaque.SelectedIndex == -1)
            {
                return;
            }
            _createPlaque.RemoveAt(DgdPlaque.SelectedIndex);
            PlaqueId.RemoveAt(DgdPlaque.SelectedIndex);
            PlaqueMain.RemoveAt(DgdPlaque.SelectedIndex);
            PlaqueSecondary.RemoveAt(DgdPlaque.SelectedIndex);
            PlaquePart.RemoveAt(DgdPlaque.SelectedIndex);
            PlaqueDescription.RemoveAt(DgdPlaque.SelectedIndex);

            _createPlaque = new List <CreatePlaque>();
            for (var i = 0; i < PlaqueId.Count; i++)
            {
                _createPlaque.Add(new CreatePlaque(PersonId[i], PlaqueMain[i], PlaqueSecondary[i], PlaquePart[i], PlaqueDescription[i]));
            }
            DgdPlaque.ItemsSource = _createPlaque;
        }