private void buttonAdd_Click(object sender, EventArgs e) { if (!CheckData()) { return; } if (tabData != null) { DataRow[] matchs = tabData.Select("Level='" + level + "'"); if (matchs.Length > 0) { MessageBox.Show("效益层级已经存在", "信息提示", MessageBoxButtons.OK); return; } } BenefitBean b = new BenefitBean(); b.Level = level; b.BaseSalary = salary; BenefitDAO d = new BenefitDAO(); if (ReturnStatus.OK == d.AddBenefit(b)) { MessageBox.Show("添加成功", "信息提示", MessageBoxButtons.OK); } LoadData(); }
public void AddBenefit_Test() { BenefitBean b = new BenefitBean(); b.Level = "Cc"; b.BaseSalary = 200; Assert.IsTrue(dao.AddBenefit(b) == ReturnStatus.OK); DataSet set = dao.GetAllBenefit(); Assert.IsTrue(set.Tables.Count > 0); DataRow[] matches = set.Tables[0].Select(""); Assert.IsTrue(matches.Length == 1); }