private void button1_Click(object sender, EventArgs e) { int x = 0; if (!string.IsNullOrEmpty(textBox5.Text) && int.TryParse(textBox5.Text, out x) == false) { errorProvider1.SetError(textBox5, "数量必须是整数"); return; } x = 0; if (!string.IsNullOrEmpty(textBox4.Text) && int.TryParse(textBox4.Text, out x) == false) { errorProvider1.SetError(textBox4, "数量必须是整数"); return; } barCodeDao.Bll.barCodeReportBll _bll = new barCodeDao.Bll.barCodeReportBll( ); bool result = _bll.Edit(id, richTextBox1.Text, textBox1.Text, cmbSao.Text, textBox4.Text, textBox5.Text, dtTime.Text, richBatch.Text); if (result == true) { MessageBox.Show("编辑成功"); this.DialogResult = System.Windows.Forms.DialogResult.OK; } else { MessageBox.Show("编辑失败,请重试"); } }
private void button1_Click(object sender, EventArgs e) { int x = 0; if (!string.IsNullOrEmpty(textBox5.Text) && int.TryParse(textBox5.Text, out x) == false) { errorProvider1.SetError(textBox5, "数量必须是整数"); return; } _model.BAR020 = x; x = 0; if (!string.IsNullOrEmpty(textBox4.Text) && int.TryParse(textBox4.Text, out x) == false) { errorProvider1.SetError(textBox4, "数量必须是整数"); return; } _model.BAR019 = x; barCodeDao.Bll.barCodeReportBll _bll = new barCodeDao.Bll.barCodeReportBll( ); _model.idx = id; _model.BAR017 = richTextBox1.Text; _model.BAR009 = textBox1.Text; _model.BAR016 = cmbSao.Text; if (string.IsNullOrEmpty(dtTime.Text)) { _model.BAR024 = null; } else { _model.BAR024 = Convert.ToDateTime(dtTime.Text); } _model.BAR025 = richBatch.Text; bool result = _bll.Edit(_model); if (result == true) { MessageBox.Show("编辑成功"); this.DialogResult = System.Windows.Forms.DialogResult.OK; } else { MessageBox.Show("编辑失败,请重试"); } }