以下是引用片段:
其关键代码实现如下: private void BtnAdd_Click(object sender, EventArgs e) { //根据不同的标志 添加或修改 员工工资信息 if (m流水号 == "") { //添加新员工 if (db.Get("select * from 员工工资 where 员工号='" + comboBox2.SelectedValue + "' and 发放月份='" + comboBox1.Text + "'").Rows.Count > 0) { MessageBox.Show("此员工的工资已经存在"); return; } db.Exec("insert into 员工工资(发放时间,员工号,发放月份,岗位工资,绩效工资,奖金,保险扣除,税收扣除,罚金,最终金额) values('" + DateTime.Now.ToShortDateString() + "', " + " '" + comboBox2.SelectedValue + "','" + comboBox1.Text + "'," + textBox3.Text + "," + textBox4.Text + "," + textBox2.Text + ", " + " " + textBox7.Text + "," + textBox6.Text + "," + textBox9.Text + ","+ textBox8.Text +")"); } else { //修改员工信息 db.Exec("update 员工工资 set 岗位工资=" + textBox3.Text + ",绩效工资=" + textBox4.Text + ",奖金='" + textBox2.Text + "'," + " 保险扣除='" + textBox7.Text + "',税收扣除='" + textBox6.Text + "',罚金='" + textBox9.Text + "',最终金额=" + textBox8.Text + " where 流水号=" + 流水号 + " ");
} this.Close(); }
private void btnDel_Click(object sender, EventArgs e) { //删除当前的员工工资信息 db.Exec("delete 员工工资 where m流水号=" + 流水号 + " "); this.Close(); } private void textBox3_TextChanged(object sender, EventArgs e) { //计算员工的工资信息 try { textBox8.Text = Convert.ToString(Convert.ToDecimal(textBox3.Text) + Convert.ToDecimal(textBox4.Text) + Convert.ToDecimal(textBox2.Text) - Convert.ToDecimal(textBox7.Text) - Convert.ToDecimal(textBox6.Text) - Convert.ToDecimal(textBox9.Text)); } catch {
} }
|