/// <summary> /// 保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSave_Click(object sender, EventArgs e) { //验证单位名称 if (txtUnit.Text.Trim() == "") { MessageBoxEx.Show("请输入商品单位!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); txtUnit.Focus(); return; } Dong.BLL.Unit bUnit = new Dong.BLL.Unit(); Dong.Model.Unit model = new Dong.Model.Unit(); model.Name = txtUnit.Text; model.Id = int.Parse(this.Tag.ToString()); if (bUnit.Update(model)) { MessageBoxEx.Show("修改成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); frmUnit fvip = (frmUnit)this.Owner; fvip.refreshData(); this.Close(); } else { MessageBoxEx.Show("保存失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnUnit_Click(object sender, EventArgs e) { frmUnit frm = new frmUnit(); openWindow(frm, frm.Name); }