Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        public List <DayAttendance> GetCalendarByEmployee(int AccountID, DateTime fromDate, DateTime toDate)
        {
            List <DayAttendance> dayAttendanceList   = new List <DayAttendance>();
            List <OverWorkItem>  OverWorkItemList    = new List <OverWorkItem>();
            List <OverWorkItem>  OverWorkItemFromDal =
                _OverWorkDal.GetOverWorkForCalendar(AccountID, fromDate, toDate);

            foreach (OverWorkItem item in OverWorkItemFromDal)
            {
                if (item.Status == RequestStatus.Cancelled || item.Status == RequestStatus.CancelApproving)
                {
                    OverWorkItem OverWorkItem =
                        _OverWorkDal.GetOverWorkItemByItemID(item.ItemID);
                    if (OverWorkUtility.IsAgreed(OverWorkItem))
                    {
                        OverWorkItemList.Add(item);
                    }
                }
                else
                {
                    OverWorkItemList.Add(item);
                }
            }
            //由于加班的一项只能是一天,所以直接加就可以了
            foreach (OverWorkItem item in OverWorkItemList)
            {
                DayAttendance dayAttendance;
                if (!item.Adjust)
                {
                    dayAttendance =
                        new DayAttendance(-1, OverWorkUtility.GetOverWorkTypeNotAdjustName(item.OverWorkType),
                                          item.CostTime, 0, item.FromDate, "", CalendarType.OverTime);
                    dayAttendance.FromTime = fromDate;
                    dayAttendance.ToTime   = toDate;
                    dayAttendanceList.Add(dayAttendance);
                }
                dayAttendance =
                    new DayAttendance(-1, OverWorkUtility.GetOverWorkTypeName(item.OverWorkType), item.CostTime, 0,
                                      item.FromDate, "", CalendarType.OverTime);
                dayAttendance.FromTime = fromDate;
                dayAttendance.ToTime   = toDate;
                dayAttendanceList.Add(dayAttendance);
            }
            return(dayAttendanceList);
        }
Ejemplo n.º 2
0
 protected override void ExcuteSelf()
 {
     if (_OverWorkItem.Adjust)
     {
         if (_OverWorkItem.Status == RequestStatus.ApprovePass)
         {
             AddAdjustRestRemainedHours();
         }
         if (OverWorkUtility.IsAgreed(_OverWorkItem))
         {
             if (_OverWorkItem.Status == RequestStatus.ApproveCancelPass)
             {
                 DeleteAdjustRestRemainedHours();
             }
         }
         else
         {
             if (_OverWorkItem.Status == RequestStatus.ApproveCancelFail)
             {
                 AddAdjustRestRemainedHours();
             }
         }
     }
 }