private void ResetFields_Click(object sender, RoutedEventArgs e) { GCCLNumber.Clear(); PartNumberTextField.Clear(); ManufacutrerTextField.Clear(); DesciptionTextFiled.Clear(); }
private void ApplyMessage_Click(object sender, RoutedEventArgs e) { if (GCCLNumber.Text.Length < 1) { MessageBox.Show("GCCL number missing"); } else { using (GCCL_Part_DatabaseEntities context = new GCCL_Part_DatabaseEntities()) { try { int GCCLPartNumber = Int32.Parse(GCCLNumber.Text); GCCL gccl = new GCCL { GCCL1 = GCCLPartNumber, Part_Number = PartNumberTextField.Text, Manufacturer = ManufacutrerTextField.Text, Description = DesciptionTextFiled.Text }; context.GCCLs.Add(gccl); context.SaveChanges(); //Messagebox has no overload that formats ouput string MessageBox.Show(String.Format("GCCL item {0} Added", GCCLPartNumber)); GCCLNumber.Clear(); PartNumberTextField.Clear(); ManufacutrerTextField.Clear(); DesciptionTextFiled.Clear(); } catch (FormatException) { MessageBox.Show("GCCL not a number"); GCCLNumber.Clear(); } } } }