private void btn_save_Click(object sender, EventArgs e) { mm = new Entity.MoneyModel(); if (this.txt_allDay.Text == "" || this.txt_allMoney.Text == "" || this.txt_day.Text == "" || this.txt_hAdd.Text == "" || this.txt_hDel.Text == "") { Msg.Box.Show("请填入完整信息!"); return; } isSave = true; try { mm.shouldDay = int.Parse(this.txt_allDay.Text); mm.allAdd = double.Parse(this.txt_allMoney.Text); mm.goDay = int.Parse(this.txt_day.Text); mm.houeAdd = double.Parse(this.txt_hAdd.Text); mm.hourDel = double.Parse(this.txt_hDel.Text); } catch (Exception ex) { Msg.Box.Show(ex.Message); return; } BLL.SalaryBLL.SaveSet(mm); Msg.Box.Show("恭喜您,保存成功!"); this.txt_allDay.ReadOnly = true; this.txt_allMoney.ReadOnly = true; this.txt_day.ReadOnly = true; this.txt_hAdd.ReadOnly = true; this.txt_hDel.ReadOnly = true; }
private void btn_yes_Click(object sender, EventArgs e) { if (this.dataGridView1.Rows.Count == 0) { return; } if (isClick == false) { Msg.Box.Show("请先选择需要操作人员!"); return; } le.lBoss = users.uName; le.lWhy = "待销假"; le.pID = int.Parse(this.dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[1].Value.ToString()); Entity.MoneyModel mm = BLL.SalaryBLL.OpenSet(); DateTime stop = DateTime.Parse(this.dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells["Column5"].Value.ToString()); DateTime start = DateTime.Parse(this.dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells["Column4"].Value.ToString()); TimeSpan ts = stop.Subtract(start); p.payDel = (BLL.SalaryBLL.PBase(le.pID) / mm.shouldDay) * ts.Days; if (BLL.LeaveBLL.UpLeave(le) == true) { BLL.LeaveBLL.UpState(p); Msg.Box.Show("恭喜您,操作成功!"); dataGridView1.DataSource = BLL.LeaveBLL.LeaveYN(); } else { Msg.Box.Show("抱歉,操作失败!"); } }
/// <summary> /// 保存工资设定 /// </summary> /// <returns></returns> public static void SaveSet(Entity.MoneyModel mm) { FileStream fs = new FileStream(Directory.GetCurrentDirectory() + @"\Config\Model.XML", FileMode.OpenOrCreate, FileAccess.Write); BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(fs, mm); fs.Close(); }
private void MoneyModel_Load(object sender, EventArgs e) { mm = BLL.SalaryBLL.OpenSet(); this.txt_allDay.Text = mm.shouldDay.ToString(); this.txt_allMoney.Text = mm.allAdd.ToString(); this.txt_day.Text = mm.goDay.ToString(); this.txt_hAdd.Text = mm.houeAdd.ToString(); this.txt_hDel.Text = mm.hourDel.ToString(); }
/// <summary> /// 读取工资设定 /// </summary> /// <param name="name"></param> /// <returns></returns> public static Entity.MoneyModel OpenSet() { FileStream fs = new FileStream(Directory.GetCurrentDirectory() + @"\Config\Model.XML", FileMode.OpenOrCreate, FileAccess.Read); BinaryFormatter bf = new BinaryFormatter(); Entity.MoneyModel mm = (Entity.MoneyModel)bf.Deserialize(fs); fs.Close(); return(mm); }
////按月份执行 /// <summary> /// 按月份部门查询 利用pID传递部门编号 /// </summary> /// <param name=""></param> /// <returns></returns> public static DataTable FindByMDep(Entity.Pay p) { Entity.MoneyModel mm = OpenSet(); allDayAdd = mm.allAdd; goDay = mm.goDay; DataTable dt = DAL.SalaryDAL.FindByMDep(p); SalaryBLL.CountMoney(dt); return(dt); }
/// <summary> /// 所有工资记录 /// </summary> /// <returns></returns> public static DataTable AllPay() { Entity.MoneyModel mm = OpenSet(); allDayAdd = mm.allAdd; goDay = mm.goDay; DataTable dt = DAL.SalaryDAL.AllSalary(); SalaryBLL.CountMoney(dt); return(dt); }
/// <summary> /// 建模 /// </summary> /// <returns></returns> public static void MakeMode() { Entity.MoneyModel mm = OpenSet(); int day = mm.shouldDay; goDay = mm.goDay; string time = System.DateTime.Now.Year + "-" + (System.DateTime.Now.Month + 1) + "-" + mm.goDay; int pid; double b; DataTable dt = DAL.SalaryDAL.SearchPID(); for (int i = 0; i < dt.Rows.Count; i++) { pid = int.Parse(dt.Rows[i][0].ToString()); b = DAL.SalaryDAL.SearchBase(pid); DAL.SalaryDAL.NewSalary(b, pid, day, time); } }
private void MoneyInfo_Load(object sender, EventArgs e) { Entity.MoneyModel mm = BLL.SalaryBLL.OpenSet(); goDay = mm.goDay; allDayAdd = mm.allAdd; }