private void Validate(Model.OverTime overtime) { if (string.IsNullOrEmpty(overtime.EmployeeId)) { throw new Helper.RequireValueException(Model.OverTime.PROPERTY_EMPLOYEEID); } }
protected override void MoveLast() { if (this.action == "insert") { this._overtime = this._overTimeManager.GetLastForEmployeeYearMonth(_employee.EmployeeId, int.Parse(this.cmb_data_Edit.Text.Substring(0, 4)), int.Parse(this.cmb_data_Edit.Text.Substring(5, 2))); } }
protected override void AddNew() { this._overtime = new Book.Model.OverTime(); this._overtime.OverTimeId = Guid.NewGuid().ToString(); this._overtime.DueDate = DateTime.Now; this._overtime.EoverTime = 0; this._overtime.OverTimeBonus = 0; }
public void Update(Model.OverTime overTime) { // // todo: add other logic here. // Validate(overTime); overTime.UpdateTime = DateTime.Now; accessor.Update(overTime); }
protected override void Delete() { this._overtime = this.OvertimeSource2.Current as Model.OverTime; if (this._overtime != null) { if (MessageBox.Show(Properties.Resources.ConfirmToDelete, this.Text, MessageBoxButtons.OKCancel) == DialogResult.OK) { this._overTimeManager.Delete(this._overtime); this._overtime = this._overTimeManager.GetPrevForEmployeeYearMonth(_employee.EmployeeId, this._overtime.InsertTime.Value, int.Parse(this.cmb_data_Edit.Text.Substring(0, 4)), int.Parse(this.cmb_data_Edit.Text.Substring(5, 2))); } } }
private void band2() { _overtime = this.OvertimeSource2.Current as Model.OverTime; if (this._overtime == null) { this.Refresh(); } else { this.action = "view"; this.newChooseContorl1.EditValue = this._overtime.Employee; this.dateEditOverTime.DateTime = this._overtime.DueDate; this.TextEditEoverTime.EditValue = this._overtime.EoverTime; this.calcEditBonus.EditValue = this._overtime.OverTimeBonus; this.chkIsHolidayDate.Checked = this._overtime.IsHoliday; this.menoDescription.EditValue = this._overtime.Note; this.OvertimeSource2.DataSource = _detailList; base.Refresh(); } this.cmb_data_Edit.Properties.ReadOnly = false; this.chkEditSelectAllEmp.Properties.ReadOnly = false; }
public void Update(Model.OverTime e) { this.Update <Model.OverTime>(e); }
public void InsertList(Model.OverTime overTime, IList <Model.Employee> emps) { for (int i = 0; i < emps.Count; i++) { Model.OverTime ot = new Model.OverTime(); if (i == 0) { ot.OverTimeId = overTime.OverTimeId; } else { ot.OverTimeId = Guid.NewGuid().ToString(); } ot.DueDate = overTime.DueDate; ot.EoverTime = overTime.EoverTime; ot.IsHoliday = overTime.IsHoliday; ot.EmployeeId = emps[i].EmployeeId; if (!ot.IsHoliday)//平日加班 { if (emps[i].DailyPay > 0) { ot.OverTimeFee = emps[i].DailyPay.Value / 6 * decimal.Parse(ot.EoverTime.ToString()); } if (emps[i].DailyPay == 0 && emps[i].MonthlyPay > 0) { ot.OverTimeFee = emps[i].MonthlyPay.Value / DateTime.DaysInMonth(ot.DueDate.Year, ot.DueDate.Month) / 6 * decimal.Parse(ot.EoverTime.ToString()); } } else //假日加班 { if (emps[i].DailyPay > 0) { ot.OverTimeFee = emps[i].DailyPay.Value / 2 * 3 / 8 * decimal.Parse(ot.EoverTime.ToString()); } if (emps[i].DailyPay == 0 && emps[i].MonthlyPay > 0) { ot.OverTimeFee = emps[i].MonthlyPay.Value / DateTime.DaysInMonth(ot.DueDate.Year, ot.DueDate.Month) / 2 * 3 / 8 * decimal.Parse(ot.EoverTime.ToString()); } } //if (emps[i].IsCadre.HasValue && emps[i].IsCadre.Value) //{ // if (overTime.EoverTime >= 2) // ot.OverTimeBonus = 40; // else // ot.OverTimeBonus = 0; //} //else //{ // if (overTime.EoverTime >= 3) // ot.OverTimeBonus = 40; // else // ot.OverTimeBonus = 0; //} ot.OverTimeBonus = overTime.OverTimeBonus; ot.Note = overTime.Note; this.Insert(ot); } }
public Model.OverTime GetPrev(Model.OverTime e) { return(accessor.GetPrev(e)); }
public bool HasRowsAfter(Model.OverTime e) { return(accessor.HasRowsAfter(e)); }
public bool HasRowsBefore(Model.OverTime e) { return(accessor.HasRowsBefore(e)); }
public Model.OverTime GetPrev(Model.OverTime e) { return(sqlmapper.QueryForObject <Model.OverTime>("OverTime.get_prev", e)); }
public Model.OverTime GetNext(Model.OverTime e) { return(sqlmapper.QueryForObject <Model.OverTime>("OverTime.get_next", e)); }
public bool HasRowsAfter(Model.OverTime e) { return(sqlmapper.QueryForObject <bool>("OverTime.has_rows_after", e)); }
public bool HasRowsBefore(Model.OverTime e) { return(sqlmapper.QueryForObject <bool>("OverTime.has_rows_before", e)); }
public void Delete(Model.OverTime overtime) { accessor.Delete(overtime.OverTimeId); }
public void Insert(Model.OverTime overTime) { Validate(overTime); overTime.InsertTime = DateTime.Now; accessor.Insert(overTime); }
public Model.OverTime GetNext(Model.OverTime e) { return(accessor.GetNext(e)); }
public override void Refresh() { if (this._overtime == null) { this.AddNew(); this.action = "insert"; } else { if (this.action == "view") { this._overtime = this._overTimeManager.Get(this._overtime.OverTimeId); } } //if (this._overtime.Employee != null) this.newChooseContorl1.EditValue = _employee; this.TextEditEoverTime.Text = this._overtime.EoverTime.ToString(); this.dateEditOverTime.DateTime = this._overtime.DueDate; this.calcEditBonus.EditValue = this._overtime.OverTimeBonus; this.chkIsHolidayDate.Checked = this._overtime.IsHoliday; this.menoDescription.EditValue = this._overtime.Note; if (this.action != "update" && _employee != null) { _detailList = this._overTimeManager.SelectByEmployeeAndMonth(_employee, int.Parse(this.cmb_data_Edit.Text.Substring(0, 4)), int.Parse(this.cmb_data_Edit.Text.Substring(5, 2))); this.OvertimeSource2.DataSource = _detailList; int a = 0; for (a = 0; a < _detailList.Count; a++) { if (this._overtime.OverTimeId == _detailList[a].OverTimeId) { break; } } this.OvertimeSource2.Position = a; } switch (this.action) { case "insert": this.newChooseContorl1.Enabled = false; this.dateEditOverTime.Properties.ReadOnly = false; this.TextEditEoverTime.Properties.ReadOnly = false; this.calcEditBonus.Properties.ReadOnly = false; this.chkIsHolidayDate.Properties.ReadOnly = false; this.menoDescription.Properties.ReadOnly = false; break; case "update": this.newChooseContorl1.Enabled = false; this.dateEditOverTime.Properties.ReadOnly = false; this.TextEditEoverTime.Properties.ReadOnly = false; this.calcEditBonus.Properties.ReadOnly = false; this.chkIsHolidayDate.Properties.ReadOnly = false; this.menoDescription.Properties.ReadOnly = false; break; case "view": this.newChooseContorl1.Enabled = false; this.dateEditOverTime.Properties.ReadOnly = true; this.TextEditEoverTime.Properties.ReadOnly = true; this.calcEditBonus.Properties.ReadOnly = true; this.chkIsHolidayDate.Properties.ReadOnly = true; this.menoDescription.Properties.ReadOnly = true; break; } base.Refresh(); this.newChooseContorl1.ShowButton = true; this.newChooseContorl1.Enabled = false; this.cmb_data_Edit.Properties.ReadOnly = false; this.chkEditSelectAllEmp.Properties.ReadOnly = false; //this.cmb_data_Edit.Enabled = true; //this.chkEditSelectAllEmp.Enabled = true; }
public void Insert(Model.OverTime e) { this.Insert <Model.OverTime>(e); }