private void btnSendBack_Click(object sender, RoutedEventArgs e) { RadButton btn = (RadButton)sender; BillGoodReturnForSearch entity = (BillGoodReturnForSearch)btn.DataContext; var result = BillStoringReturnGoodVM.SendBack(entity); MessageBox.Show(result.Message); if (result.IsSucceed) { var data = RadGridView1.ItemsSource as ObservableCollection <BillGoodReturnForSearch>; data.Remove(entity); } }
private void btnSave_Click(object sender, RoutedEventArgs e) { var btn = sender as RadButton; btn.IsEnabled = false; var grid = btn.GetVisualParent <Grid>(); BillStoringReturnGoodVM context = grid.DataContext as BillStoringReturnGoodVM; var opresult = context.CheckWhenSave(); if (!opresult.IsSucceed) { MessageBox.Show(opresult.Message); btn.IsEnabled = true; return; } //SetGoodReturnMoneyWin win = new SetGoodReturnMoneyWin(); //win.Owner = View.Extension.UIHelper.GetAncestor<Window>(this); //win.ReturnMoneySettedEvent += money => //{ // _billVM.ReturnMoney = money; BillStoring bill = new BillStoring(); bill.OrganizationID = VMGlobal.CurrentUser.OrganizationID; bill.StorageID = context.StorageID; bill.RefrenceBillCode = ((BillGoodReturnForSearch)grid.Tag).Code; bill.BillType = (int)BillTypeEnum.BillGoodReturn; bill.Remark = "退货入库"; bill.BrandID = ((BillGoodReturnForSearch)grid.Tag).BrandID; context.Master = bill; opresult = context.Save(); if (opresult.IsSucceed) { MessageBox.Show("保存成功"); } else { btn.IsEnabled = true; MessageBox.Show("保存失败\n失败原因:" + opresult.Message); } //}; //var flag = win.ShowDialog(); //if (flag == null || !flag.Value) // btn.IsEnabled = true; }
public StoringReturnGood() { InitializeComponent(); RadGridView1.ItemsSource = BillStoringReturnGoodVM.SearchBillSubordinateGoodReturnForStoring(); }