Ejemplo n.º 1
0
        private void AddCustomPartButton_Click(object sender, RoutedEventArgs e)
        {
            PartWindow win = new PartWindow("Add Custom Part", "New Part", true);
            win.Owner = this;
            if (win.ShowDialog() ?? false)
            {
                this._DB.Part.InsertOnSubmit(win.EditPart);
                this._DB.SubmitChanges();

                this.RefreshPartList();
            }
        }
Ejemplo n.º 2
0
        private void EditPart_Click(object sender, RoutedEventArgs e)
        {
            Part editPart = this.SelectedPart;
            if (editPart == null) { return; }

            Part originalPart = new Part()
            {
                Code = editPart.Code,
                Description = editPart.Description,
                IsCustom = editPart.IsCustom,
                PartKey = editPart.PartKey,
                Price = editPart.Price
            };

            PartWindow win = new PartWindow("Edit Part " + editPart.Code, "Edit Part", editPart);
            win.Owner = this;

            if (win.ShowDialog() ?? false)
            {
                this._DB.SubmitChanges();
            }
            else
            {
                this.Parts[this.Parts.IndexOf(this.SelectedPart)] = originalPart;
                this.SelectedPart = originalPart;

            }
        }