public Result Add(HolidaysAttendanceDetailsBLL HolidayAttendanceDetailBLL) { Result result = new Result(); HolidaysAttendanceDetails HolidayAttendanceDetail = new HolidaysAttendanceDetails() { HolidayAttendanceID = HolidayAttendanceDetailBLL.HolidaysAttendance.HolidayAttendanceID, EmployeeCareerHistoryID = HolidayAttendanceDetailBLL.EmployeeCareerHistory.EmployeeCareerHistoryID, CreateDate = DateTime.Now, CreatedBy = HolidayAttendanceDetailBLL.LoginIdentity.EmployeeCodeID }; HolidaysAttendanceBLL HolidaysAttendanceBLL = new HolidaysAttendanceBLL().GetByHolidayAttendanceID(HolidayAttendanceDetailBLL.HolidaysAttendance.HolidayAttendanceID); List <HolidaysAttendanceBLL> HolidaysAttendanceBLLList = new HolidaysAttendanceBLL().GetByHolidaySettingID(HolidaysAttendanceBLL.HolidaySetting.HolidaySettingID); List <HolidaysAttendanceDetailsBLL> HolidaysAttendanceDetailsExists = new List <HolidaysAttendanceDetailsBLL>(); HolidaysAttendanceBLLList.ForEach(c => HolidaysAttendanceDetailsExists.AddRange(c.HolidaysAttendanceDetails.Where(x => x.EmployeeCareerHistory.EmployeeCareerHistoryID == HolidayAttendanceDetailBLL.EmployeeCareerHistory.EmployeeCareerHistoryID).ToList())); if (HolidaysAttendanceDetailsExists.Count > 0) { result.EnumType = typeof(HolidayAttendanceValidationEnum); result.EnumMember = HolidayAttendanceValidationEnum.RejectedBecauseEmployeeAlreadyExistOnAnotherRecord.ToString(); return(result); } this.HolidayAttendanceDetailID = new HolidaysAttendanceDetailsDAL().Insert(HolidayAttendanceDetail); if (this.HolidayAttendanceDetailID != 0) { result.Entity = null; result.EnumType = typeof(HolidayAttendanceValidationEnum); result.EnumMember = HolidayAttendanceValidationEnum.Done.ToString(); } return(result); }
internal HolidaysAttendanceDetailsBLL MapHolidayAttendanceDetail(HolidaysAttendanceDetails HolidayAttendanceDetail) { try { HolidaysAttendanceDetailsBLL HolidayAttendanceDetailBLL = null; if (HolidayAttendanceDetail != null) { HolidayAttendanceDetailBLL = new HolidaysAttendanceDetailsBLL() { HolidayAttendanceDetailID = HolidayAttendanceDetail.HolidayAttendanceDetailID, HolidaysAttendance = new HolidaysAttendanceBLL().GetByHolidayAttendanceID(HolidayAttendanceDetail.HolidayAttendanceID), EmployeeCareerHistory = new EmployeesCareersHistoryBLL().MapEmployeeCareerHistory(HolidayAttendanceDetail.EmployeesCareersHistory) }; } return(HolidayAttendanceDetailBLL); } catch { throw; } }