Ejemplo n.º 1
0
 private void Validate(Model.OverTime overtime)
 {
     if (string.IsNullOrEmpty(overtime.EmployeeId))
     {
         throw new Helper.RequireValueException(Model.OverTime.PROPERTY_EMPLOYEEID);
     }
 }
Ejemplo n.º 2
0
 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)));
     }
 }
Ejemplo n.º 3
0
 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;
 }
Ejemplo n.º 4
0
 public void Update(Model.OverTime overTime)
 {
     //
     // todo: add other logic here.
     //
     Validate(overTime);
     overTime.UpdateTime = DateTime.Now;
     accessor.Update(overTime);
 }
Ejemplo n.º 5
0
        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)));
                }
            }
        }
Ejemplo n.º 6
0
        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;
        }
Ejemplo n.º 7
0
 public void Update(Model.OverTime e)
 {
     this.Update <Model.OverTime>(e);
 }
Ejemplo n.º 8
0
        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);
            }
        }
Ejemplo n.º 9
0
 public Model.OverTime GetPrev(Model.OverTime e)
 {
     return(accessor.GetPrev(e));
 }
Ejemplo n.º 10
0
 public bool HasRowsAfter(Model.OverTime e)
 {
     return(accessor.HasRowsAfter(e));
 }
Ejemplo n.º 11
0
 public bool HasRowsBefore(Model.OverTime e)
 {
     return(accessor.HasRowsBefore(e));
 }
Ejemplo n.º 12
0
 public Model.OverTime GetPrev(Model.OverTime e)
 {
     return(sqlmapper.QueryForObject <Model.OverTime>("OverTime.get_prev", e));
 }
Ejemplo n.º 13
0
 public Model.OverTime GetNext(Model.OverTime e)
 {
     return(sqlmapper.QueryForObject <Model.OverTime>("OverTime.get_next", e));
 }
Ejemplo n.º 14
0
 public bool HasRowsAfter(Model.OverTime e)
 {
     return(sqlmapper.QueryForObject <bool>("OverTime.has_rows_after", e));
 }
Ejemplo n.º 15
0
 public bool HasRowsBefore(Model.OverTime e)
 {
     return(sqlmapper.QueryForObject <bool>("OverTime.has_rows_before", e));
 }
Ejemplo n.º 16
0
 public void Delete(Model.OverTime overtime)
 {
     accessor.Delete(overtime.OverTimeId);
 }
Ejemplo n.º 17
0
 public void Insert(Model.OverTime overTime)
 {
     Validate(overTime);
     overTime.InsertTime = DateTime.Now;
     accessor.Insert(overTime);
 }
Ejemplo n.º 18
0
 public Model.OverTime GetNext(Model.OverTime e)
 {
     return(accessor.GetNext(e));
 }
Ejemplo n.º 19
0
        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;
        }
Ejemplo n.º 20
0
 public void Insert(Model.OverTime e)
 {
     this.Insert <Model.OverTime>(e);
 }