Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        public List <DayAttendance> GetAllCalendarByEmployee(int AccountID, DateTime fromDate, DateTime toDate)
        {
            List <DayAttendance>      dayAttendance             = new List <DayAttendance>();
            List <OutApplicationItem> outApplicationItemList    = new List <OutApplicationItem>();
            List <OutApplicationItem> outApplicationItemFromDal =
                _OutApplicationDal.GetAllOutApplicationForCalendar(AccountID, fromDate, toDate);

            foreach (OutApplicationItem item in outApplicationItemFromDal)
            {
                OutApplicationItem outApplicationItem =
                    _OutApplicationDal.GetOutApplicationItemByItemID(item.ItemID);
                item.OutApplicationID = outApplicationItem.OutApplicationID;
                outApplicationItemList.Add(item);

                //if (item.Status == RequestStatus.Cancelled || item.Status == RequestStatus.CancelApproving)
                //{
                //    OutApplicationItem outApplicationItem =
                //        _OutApplicationDal.GetOutApplicationItemByItemID(item.ItemID);
                //    if (OutApplicationUtility.IsAgreed(outApplicationItem))
                //    {
                //        outApplicationItemList.Add(item);
                //    }
                //}
                //else
                //{
                //    outApplicationItemList.Add(item);
                //}
            }
            foreach (OutApplicationItem item in outApplicationItemList)
            {
                OutType outType = _OutApplicationDal.GetOutApplicationByOutApplicationID(item.OutApplicationID).OutType;
                if (outType.ID == OutType.InCity.ID)
                {
                    string typeName = "外出";
                    typeName = GetTypeName(item, typeName);
                    CalculateOutHour cal = new CalculateOutHour(item.FromDate, item.ToDate, AccountID, typeName);
                    cal.Excute();
                    dayAttendance.AddRange(cal.DayAttendanceList);
                }
                else if (outType.ID == OutType.OutCity.ID)
                {
                    string typeName = OutType.OutCity.Name;
                    typeName = GetTypeName(item, typeName);
                    CalculateOutCityHour cal = new CalculateOutCityHour(item.FromDate, item.ToDate, typeName, AccountID);
                    cal.Excute();
                    dayAttendance.AddRange(cal.DayAttendanceList);
                }
                else if (outType.ID == OutType.Train.ID)
                {
                    string typeName = OutType.Train.Name;
                    typeName = GetTypeName(item, typeName);
                    CalculateOutHour cal = new CalculateOutHour(item.FromDate, item.ToDate, AccountID, typeName);
                    cal.Excute();
                    dayAttendance.AddRange(cal.DayAttendanceList);
                }
            }
            return(dayAttendance);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        public List <DayAttendance> GetCalendarByEmployee(int AccountID, DateTime fromDate, DateTime toDate)
        {
            List <DayAttendance>      dayAttendance             = new List <DayAttendance>();
            List <OutApplicationItem> outApplicationItemList    = new List <OutApplicationItem>();
            List <OutApplicationItem> outApplicationItemFromDal =
                _OutApplicationDal.GetOutApplicationForCalendar(AccountID, fromDate, toDate);

            foreach (OutApplicationItem item in outApplicationItemFromDal)
            {
                OutApplicationItem outApplicationItem =
                    _OutApplicationDal.GetOutApplicationItemByItemID(item.ItemID);
                item.OutApplicationID = outApplicationItem.OutApplicationID;
                if (item.Status == RequestStatus.Cancelled || item.Status == RequestStatus.CancelApproving)
                {
                    if (OutApplicationUtility.IsAgreed(outApplicationItem))
                    {
                        outApplicationItemList.Add(item);
                    }
                }
                else
                {
                    outApplicationItemList.Add(item);
                }
            }
            foreach (OutApplicationItem item in outApplicationItemList)
            {
                OutType outType = _OutApplicationDal.GetOutApplicationByOutApplicationID(item.OutApplicationID).OutType;
                if (outType.ID == OutType.InCity.ID || outType.ID == OutType.OutCity.ID)
                {
                    CalculateOutHour cal = new CalculateOutHour(item.FromDate, item.ToDate, AccountID);
                    cal.Excute();
                    dayAttendance.AddRange(cal.DayAttendanceList);
                }
                else if (outType.ID == OutType.OutCity.ID)
                {
                    CalculateOutCityHour cal = new CalculateOutCityHour(item.FromDate, item.ToDate, AccountID);
                    cal.Excute();
                    dayAttendance.AddRange(cal.DayAttendanceList);
                }
            }
            return(dayAttendance);
        }