Beispiel #1
0
        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();
        }
Beispiel #2
0
        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();
        }
Beispiel #3
0
 public StaffBean()
 {
     post        = new PostBean();
     performance = new PerformanceBean();
     benefit     = new BenefitBean();
     department  = new DepartmentBean();
 }
Beispiel #4
0
        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);
        }
Beispiel #5
0
        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();
        }
Beispiel #6
0
        public ReturnStatus DeleteBenefit(BenefitBean b)
        {
            int count = 0;

            try
            {
                SqlParameter[] sp =
                {
                    para = new SqlParameter("@Id", b.Id),
                };
                count = sh.RunSql("PR_Benefit_Delete", sp);
            }
            catch (Exception ex)
            {
                return(ReturnStatus.ERROR_DB_DELETE_FAIL);
            }

            return(ReturnStatus.OK);
        }
Beispiel #7
0
        private SqlParameter para; //参数

        public ReturnStatus AddBenefit(BenefitBean b)
        {
            int count = 0;

            try
            {
                SqlParameter[] sp =
                {
                    para = new SqlParameter("@Level",      b.Level),
                    para = new SqlParameter("@BaseSalary", b.BaseSalary),
                };
                count = sh.RunSql("PR_Benefit_Add", sp);
            }
            catch (Exception ex)
            {
                return(ReturnStatus.ERROR_DB_ADD_FAIL);
            }
            return(ReturnStatus.OK);
        }