//编辑 private void button4_Click(object sender, EventArgs e) { if (getTre( ) == false) { return; } isOk = _bll.EditS(_war); if (isOk == true) { MessageBox.Show("编辑成功"); setTre( ); } else { MessageBox.Show("编辑失败"); } }
//确定 private void button2_Click(object sender, System.EventArgs e) { if (string.IsNullOrEmpty(comboBox1.Text)) { MessageBox.Show("物料类别不可为空"); return; } if (string.IsNullOrEmpty(comboBox2.Text)) { MessageBox.Show("物料名称不可为空"); return; } if (string.IsNullOrEmpty(lookUpEdit12.Text)) { MessageBox.Show("申购人不可为空"); return; } if (string.IsNullOrEmpty(textBox1.Text)) { MessageBox.Show("入库数量不可为空"); return; } _war = new MulaolaoLibrary.WarehouseReceiptWAREntity( ); _war.WAR001 = comboBox1.Text; _war.WAR004 = comboBox2.Text; _war.WAR002 = dateTimePicker1.Value; _war.WAR005 = comboBox3.Text; _war.WAR003 = lookUpEdit12.Text; _war.WAR006 = string.IsNullOrEmpty(textBox1.Text) == true ? 0 : Convert.ToInt32(textBox1.Text); _war.WAR007 = comboBox4.Text; _war.WAR010 = comboBox5.Text; _war.WAR008 = string.IsNullOrEmpty(textBox2.Text) == true ? 0 : Convert.ToDecimal(textBox2.Text); _war.WAR009 = string.IsNullOrEmpty(textBox3.Text) == true ? 0 : Convert.ToDecimal(textBox3.Text); _war.WAR011 = lookUpEdit2.Text; _war.WAR012 = richTextBox1.Text; if (this.Text.Equals("新增")) { result = _bll.AddS(_war); if (result == true) { MessageBox.Show("新增成功"); this.DialogResult = DialogResult.OK; } else { MessageBox.Show("新增失败"); } } else { _war.idx = Convert.ToInt32(comboBox1.Tag); result = _bll.EditS(_war); if (result == true) { MessageBox.Show("编辑成功"); this.DialogResult = DialogResult.OK; } else { MessageBox.Show("编辑失败"); } } }