/// <summary> /// 添加明细表信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAdd_Click(object sender, RoutedEventArgs e) { Button btn = sender as Button; FixtureFurnaceMainEntity main = (FixtureFurnaceMainEntity)btn.Tag;// as FixtureFurnaceMain; FixtureFurnaceDetaiViewModel vmModel = new FixtureFurnaceDetaiViewModel(); ObjectReflection.AutoMapping(main, vmModel); bool?nullable = new ChuckingDetailDialog(vmModel, 1).ShowDialog(); bool flag = true; if ((nullable.GetValueOrDefault() == flag ? (nullable.HasValue ? 1 : 0) : 0) == 0) { return; } this.RefreshData(); }
private void btnOK_Click(object sender, RoutedEventArgs e) { try { DetailModel = new FixtureFurnaceDetailEntity(); ObjectReflection.AutoMapping(Model, DetailModel); //明细表 DetailModel.FFDState = (int)Enum.Parse(typeof(FFDState), cmbFFDState.SelectedValue.ToString()); DetailModel.FFDIsAccomplish = (int)Enum.Parse(typeof(YesOrNoType), Accomplish.SelectedValue.ToString()); DetailModel.CAId = cmbCAI.SelectedValue == null ? 0 : (int)cmbCAI.SelectedValue; if (operateType == 1) { if ((new FixtureFurnaceDetailDB().Insert(DetailModel) < 1)) { CustomMessageBox.Show("添加数据过程出现错误!", CustomMessageBoxButton.OKCancel, CustomMessageBoxIcon.Question); return; } } else { if (!(new FixtureFurnaceDetailDB()).Update(DetailModel)) { CustomMessageBox.Show("修改数据过程出现错误!", CustomMessageBoxButton.OKCancel, CustomMessageBoxIcon.Question); return; } } this.DialogResult = new bool?(true); this.Close(); } catch (Exception ex) { MessageBoxX.Error(ex.Message); } }