using BBWY.Client.Models; using BBWY.Controls; using System.Collections.Generic; using System.Linq; using System.Windows; namespace BBWY.Client.Views.BatchPurchase { /// /// PackSkuSplitCountAndStoreWindow.xaml 的交互逻辑 /// public partial class PackSkuSplitCountAndStoreWindow : BWindow { public int Quantity { get; set; } public StoreResponse Store { get; set; } private IList storeList; public PackSkuSplitCountAndStoreWindow(int quantity, StoreResponse store, IList storeList) { InitializeComponent(); this.Quantity = quantity; this.Store = store; this.storeList = storeList; this.Loaded += PackSkuSplitCountAndStoreWindow_Loaded; } private void PackSkuSplitCountAndStoreWindow_Loaded(object sender, System.Windows.RoutedEventArgs e) { this.txtQuantity.Text = Quantity.ToString(); this.cbx_stroeList.ItemsSource = storeList; if (Store != null) this.cbx_stroeList.SelectedItem = storeList.FirstOrDefault(s => s.Id == Store.Id); else this.cbx_stroeList.SelectedItem = storeList.FirstOrDefault(); } private void btn_save_Click(object sender, System.Windows.RoutedEventArgs e) { if (!int.TryParse(txtQuantity.Text, out int q)) { MessageBox.Show("件数不正确", "提示"); return; } if (q <= 0) { MessageBox.Show("件数不正确", "提示"); return; } if (cbx_stroeList.SelectedItem == null) { MessageBox.Show("请选择一个仓库", "提示"); return; } this.Quantity = q; this.Store = cbx_stroeList.SelectedItem as StoreResponse; this.DialogResult = true; this.Close(); } } }