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(); }
private void buttonUpdate_Click(object sender, EventArgs e) { if (!CheckData()) { return; } if (id == -1) { MessageBox.Show("未选择", "信息提示", MessageBoxButtons.OK); return; } if (tabData != null) { DataRow[] matchs = tabData.Select("Id<>" + id + " AND Level='" + level + "'"); if (matchs.Length > 0) { MessageBox.Show("效益层级已经存在", "信息提示", MessageBoxButtons.OK); return; } } BenefitBean b = new BenefitBean(); b.Id = id; b.Level = level; b.BaseSalary = salary; BenefitDAO d = new BenefitDAO(); d.UpdateBenefit(b); LoadData(); }
private void LoadData() { BenefitDAO d = new BenefitDAO(); DataSet set = d.GetAllBenefit(); tabData = set.Tables[0]; gridCtrl.DataSource = tabData; }
private void buttonDelete_Click(object sender, EventArgs e) { if (id == -1) { return; } BenefitBean b = new BenefitBean(); b.Id = id; BenefitDAO d = new BenefitDAO(); d.DeleteBenefit(b); LoadData(); }
private void LoadBaseInfo() { PostDAO d = new PostDAO(); DataSet set = d.GetAllPost(); tabPost = set.Tables[0]; PerformanceDAO ado = new PerformanceDAO(); set = ado.GetAllPerformance(); tabPerformance = set.Tables[0]; BenefitDAO bd = new BenefitDAO(); set = bd.GetAllBenefit(); tabBenefit = set.Tables[0]; }
private void LoadBaseInfo() { PostDAO d = new PostDAO(); DataSet set = d.GetAllPost(); tabPost = set.Tables[0]; repositoryItemLookUpEditPost.DataSource = tabPost; PerformanceDAO ado = new PerformanceDAO(); set = ado.GetAllPerformance(); tabPerformance = set.Tables[0]; repositoryItemLookUpEditPerformance.DataSource = tabPerformance; BenefitDAO bd = new BenefitDAO(); set = bd.GetAllBenefit(); tabBenefit = set.Tables[0]; repositoryItemLookUpEditBenefit.DataSource = tabBenefit; //repositoryItemComboBoxPost.Items.Clear(); //PostDAO d = new PostDAO(); //DataSet set = d.GetAllPost(); //tabPost = set.Tables[0]; //foreach (DataRow r in tabPost.Rows) //{ // repositoryItemComboBoxPost.Items.Add(r["Level"].ToString()); //} //repositoryItemComboBoxPerformance.Items.Clear(); //PerformanceDAO ado = new PerformanceDAO(); //set = ado.GetAllPerformance(); //tabPerformance = set.Tables[0]; //foreach (DataRow r in tabPerformance.Rows) //{ // repositoryItemComboBoxPerformance.Items.Add(r["Level"].ToString()); //} //repositoryItemComboBoxBenefit.Items.Clear(); //BenefitDAO bd = new BenefitDAO(); //set = bd.GetAllBenefit(); //tabBenefit = set.Tables[0]; //foreach (DataRow r in tabBenefit.Rows) //{ // repositoryItemComboBoxBenefit.Items.Add(r["Level"].ToString()); //} }