public override int Modify() { if (check() == false) { return(0); } if (getValue( ) == false) { return(0); } int id = _bll.Edit(_model); if (id > 0) { MessageBox.Show("保存成功"); } else { MessageBox.Show("保存失败"); } return(base.Modify()); }
public override void Save( ) { errorProvider1.Clear( ); if (string.IsNullOrEmpty(txtCodeNum.Text)) { errorProvider1.SetError(txtCodeNum, "不可为空"); return; } if (string.IsNullOrEmpty(txtfishId.Text)) { errorProvider1.SetError(txtfishId, "不可为空"); return; } outResult = 0M; if (!string.IsNullOrEmpty(txtbondPro.Text) && decimal.TryParse(txtbondPro.Text, out outResult) == false) { errorProvider1.SetError(txtbondPro, "请重新填写"); return; } outResult = 0M; if (!string.IsNullOrEmpty(txtheight.Text) && decimal.TryParse(txtheight.Text, out outResult) == false) { errorProvider1.SetError(txtheight, "请重新填写"); return; } outResult = 0M; if (!string.IsNullOrEmpty(txtprice.Text) && decimal.TryParse(txtprice.Text, out outResult) == false) { errorProvider1.SetError(txtprice, "请重新填写"); return; } outResult = 0M; if (!string.IsNullOrEmpty(txtrebate.Text) && decimal.TryParse(txtrebate.Text, out outResult) == false) { errorProvider1.SetError(txtrebate, "请重新填写"); return; } outResult = 0M; if (!string.IsNullOrEmpty(txtpriceMY.Text) && decimal.TryParse(txtpriceMY.Text, out outResult) == false) { errorProvider1.SetError(txtpriceMY, "请重新填写"); return; } getValue( ); if (state.Equals("add")) { _model.id = _bll.Add(_model); } else { _model.id = _bll.Edit(_model); } if (_model.id > 0) { MessageBox.Show("保存成功"); if (state.Equals("add")) { txtCodeNum.Tag = _model.id; } } else { MessageBox.Show("保存失败"); } base.Save( ); }