using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Shapes; using XGL.Data.DBService; using XGL.Models.Model.FoamingMac; namespace XGLFinishPro.Views { /// /// ShouPeiWin.xaml 的交互逻辑 /// public partial class ShouPeiWin : Window { FormingMachineService formingMachineService = new FormingMachineService(); FoamingMacModel _foamingMacModel; public ShouPeiWin() { InitializeComponent(); } public ShouPeiWin(FoamingMacModel foamingMac) { InitializeComponent(); _foamingMacModel = foamingMac; } private void btnOK_Click(object sender, RoutedEventArgs e) { this.lbMsg.Content = ""; if (string.IsNullOrEmpty(this.txtBarcode.Text)) { this.lbMsg.Content = "条码号不能为空!"; return; } else if (formingMachineService.InsertData(_foamingMacModel)) { //this.Close(); } else { this.lbMsg.Content = "完成失败!"; } } private void btnCancel_Click(object sender, RoutedEventArgs e) { this.Close(); } private void txtBarcode_TextChanged(object sender, TextChangedEventArgs e) { this.lbMsg.Content = ""; } private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if (this.DialogResult == false) { e.Cancel = true; } } } }