示例#1
0
        public List <DateTime> GetDaysBetweenStartAndEndDate(int OverTimeID, int OverTimeDetailID)
        {
            List <DateTime>     VacationDates  = new List <DateTime>();
            OverTimesBLL        Overtime       = new OverTimesBLL().GetByOverTimeID(OverTimeID);
            OverTimesDetailsBLL OvertimeDetail = new OverTimesDetailsBLL().GetOverTimeDetailsByID(OverTimeDetailID);

            BaseVacationsBLL        Vacation;
            List <BaseVacationsBLL> vacations = new BaseVacationsBLL().GetByEmployeeCodeID(OvertimeDetail.EmployeeCareerHistory.EmployeeCode.EmployeeCodeID);

            foreach (OverTimesDaysBLL OTDay in Overtime.OverTimesDays)
            {
                Vacation = vacations.FirstOrDefault(e => OTDay.OverTimeDay >= e.VacationStartDate && OTDay.OverTimeDay <= e.VacationEndDate);
                if (Vacation != null && Vacation.VacationID > 0)
                {
                    VacationDates.Add(OTDay.OverTimeDay);
                }
            }

            return(VacationDates);
        }
示例#2
0
        public Result Add(OverTimesDetailsBLL OverTimeDetailBLL)
        {
            Result result = new Result();

            OverTimesDetails OverTimeDetail = new OverTimesDetails()
            {
                OverTimeID = OverTimeDetailBLL.OverTime.OverTimeID,
                EmployeeCareerHistoryID = OverTimeDetailBLL.EmployeeCareerHistory.EmployeeCareerHistoryID,
                CreateDate = DateTime.Now,
                CreatedBy  = OverTimeDetailBLL.LoginIdentity.EmployeeCodeID
            };

            this.OverTimeDetailID = new OverTimesDetailsDAL().Insert(OverTimeDetail);
            if (this.OverTimeDetailID != 0)
            {
                result.Entity     = null;
                result.EnumType   = typeof(OverTimeValidationEnum);
                result.EnumMember = OverTimeValidationEnum.Done.ToString();
            }
            return(result);
        }
示例#3
0
 internal OverTimesDetailsBLL MapOverTimeDetail(OverTimesDetails OverTimeDetail)
 {
     try
     {
         OverTimesDetailsBLL OverTimeDetailBLL = null;
         if (OverTimeDetail != null)
         {
             OverTimeDetailBLL = new OverTimesDetailsBLL()
             {
                 OverTimeDetailID      = OverTimeDetail.OverTimeDetailID,
                 OverTime              = new OverTimesBLL().MapOverTime(OverTimeDetail.OverTimes),
                 EmployeeCareerHistory = new EmployeesCareersHistoryBLL().MapEmployeeCareerHistory(OverTimeDetail.EmployeesCareersHistory)
             };
         }
         return(OverTimeDetailBLL);
     }
     catch
     {
         throw;
     }
 }
示例#4
0
        public Result Update()
        {
            Result result = null;
            List <OverTimesDetailsBLL> OverTimeDetailBLLList = new OverTimesDetailsBLL().GetOverTimeDetailsByOverTimeID(this.OverTimeID);

            // validate employees
            if (OverTimeDetailBLLList == null || OverTimeDetailBLLList.Count <= 0)
            {
                result            = new Result();
                result.Entity     = null;
                result.EnumType   = typeof(OverTimeValidationEnum);
                result.EnumMember = OverTimeValidationEnum.RejectedBecauseEmployeeRequired.ToString();

                return(result);
            }
            else
            {
                OverTimes overTime = new OverTimes()
                {
                    OverTimeID       = this.OverTimeID,
                    Tasks            = this.Tasks,
                    WeekWorkHoursAvg = this.WeekWorkHoursAvg,
                    FridayHoursAvg   = this.FridayHoursAvg,
                    SaturdayHoursAvg = this.SaturdayHoursAvg,
                    Requester        = this.Requester,
                    LastUpdatedDate  = DateTime.Now,
                    LastUpdatedBy    = this.LoginIdentity.EmployeeCodeID
                };
                new OverTimesDAL().Update(overTime);
                result = new Result()
                {
                    Entity     = this,
                    EnumType   = typeof(OverTimeValidationEnum),
                    EnumMember = OverTimeValidationEnum.Done.ToString()
                };
            }

            return(result);
        }