private void btn_ok_Click(object sender, EventArgs e) { Entity.Express a = new Entity.Express(); try { a.pID = int.Parse(this.textBox1.Text); a.eType = "奖励"; a.eMoney = double.Parse(this.textBox2.Text); a.eWhy = this.textBox3.Text; a.eTime = this.dateTimePicker1.Value; a.eBoss = this.textBox4.Text; } catch { Msg.Box.Show("请填写正确的信息!"); return; } if (BLL.MoneyBLL.FindP(a) == false) { Msg.Box.Show("抱歉,该人员编号不存在!"); return; } if (BLL.MoneyBLL.ADd(a) == true) { //更新本月工资 BLL.MoneyBLL.MoneyAdd(a); Msg.Box.Show("恭喜您,操作成功"); clear(); } }
/// <summary> /// 工资奖励操作 /// </summary> /// <returns></returns> public static bool MoneyAdd(Entity.Express e) { if (DAL.MoneyDAL.MoneyAdd(e) > 0) { return(true); } else { return(false); } }
/// <summary> /// 奖惩操作 /// </summary> /// <param name="a"></param> /// <returns></returns> public static bool ADd(Entity.Express a) { if (DAL.MoneyDAL.Penlt(a) > 0) { return(true); } else { return(false); } }
///------------------------------------------ /// <summary> /// 查找是否存在 /// </summary> /// <returns></returns> public static bool FindP(Entity.Express e) { if ((int)DAL.MoneyDAL.FindP(e) > 0) { return(true); } else { return(false); } }
private void btn_find_Click(object sender, EventArgs e) { Entity.Express ap = new Entity.Express(); // try //{ if (this.radioButton2.Checked) { ap.pID = int.Parse(this.textBox2.Text); dataGridView1.DataSource = BLL.MoneyBLL.unio(ap); NoFind(); } else if (this.radioButton4.Checked) { ap.eType = this.comboBox1.Text; dataGridView1.DataSource = BLL.MoneyBLL.pin(ap); NoFind(); } else if (this.radioButton3.Checked) { ap.eTime = this.dateTimePicker1.Value; dataGridView1.DataSource = BLL.MoneyBLL.depa(ap); NoFind(); } else if (this.radioButton1.Checked) { ap.eID = int.Parse(this.comboBox2.SelectedValue.ToString()); dataGridView1.DataSource = BLL.MoneyBLL.FindByDep(ap); NoFind(); } else { Msg.Box.Show("您还未勾选查询方式"); return; } }
/// <summary> /// 工资奖励操作 /// </summary> /// <returns></returns> public static int MoneyAdd(Entity.Express e) { string sql = "update Pay set PayAdd=PayAdd+" + e.eMoney + " where PID=" + e.pID + ""; return(DBHelper.GetLine(sql)); }
/// <summary> /// 奖惩记录操作 /// </summary> /// <param name="a"></param> /// <returns></returns> public static int Penlt(Entity.Express a) { string s = "insert into express values('" + a.pID + "','" + a.eType + "','" + a.eMoney + "','" + a.eWhy + "','" + a.eTime + "','" + a.eBoss + "')"; return(DBHelper.GetLine(s)); }
//------------------------------------------- /// <summary> /// 查找是否存在 /// </summary> /// <returns></returns> public static object FindP(Entity.Express e) { string sql = "select count(*) from Person where PID=" + e.pID + ""; return(DBHelper.GetScalar(sql)); }
//按部门查询 public static DataTable FindByDep(Entity.Express a) { string s = "select person.pid 人员工号,pname 人员姓名,etype 奖惩类型,emoney 发生金额,ewhy 处理原因,etime 处理时间,EBoss 处理人员 from person,express,Job where person.PID=express.PID and Person.JID=Job.JID and Job.DepID=" + a.eID + ""; return(DBHelper.GetDT(s)); }
//按处理时间查询 public static DataTable depa(Entity.Express a) { string s = "select person.pid 人员工号,pname 人员姓名,etype 奖惩类型,emoney 发生金额,ewhy 处理原因,etime 处理时间,EBoss 处理人员 from person inner join express on person.PID=express.PID where year(ETime)=" + a.eTime.Year + " and month(ETime)=" + a.eTime.Month + " and day(ETime)=" + a.eTime.Day + ""; return(DBHelper.GetDT(s)); }
//按奖惩类型查询 public static DataTable pin(Entity.Express a) { string s = "select a.pid 人员工号,pname 人员姓名,etype 奖惩类型,emoney 发生金额,ewhy 处理原因,etime 处理时间,EBoss 处理人员 from person a inner join express p on p.pid=a.pid where p.etype='" + a.eType + "'"; return(DBHelper.GetDT(s)); }
//按编号查询 public static DataTable unio(Entity.Express a) { string s = "select person.pid 人员工号,pname 人员姓名,etype 奖惩类型,emoney 发生金额,ewhy 处理原因,etime 处理时间,EBoss 处理人员 from person inner join express on person.PID=express.PID where person.PID like '%" + a.pID + "%'"; return(DBHelper.GetDT(s)); }
//按惩罚时间查询 public static DataTable depa(Entity.Express a) { return(EDAL.MoneyDAL.depa(a)); }
//按奖惩类型查询 public static DataTable pin(Entity.Express a) { return(EDAL.MoneyDAL.pin(a)); }
//按工号查询 public static DataTable unio(Entity.Express a) { return(EDAL.MoneyDAL.unio(a)); }
//按部门查询 public static DataTable FindByDep(Entity.Express a) { return(DAL.MoneyDAL.FindByDep(a)); }