protected override void ApplyDynamicValues(BzEmployeeHoliday entity, DataRow row) { for (int i = 1; i <= Wrapper.CountOfWeek; i++) { row[PC.DynName(i)] = InfoToString(entity.GetWeek(i)); } }
protected override void ApplyDynamicValues(BzEmployeeHoliday entity, DataRow row) { int i = 1; foreach (string month in PC.Months) { row[month] = InfoToString(entity.GetMonth(i++)); } }
protected virtual void ApplySums(BzEmployeeHoliday holiday) { m_Sums[PC.AvailableHolidays] += holiday.AvailableHolidays; m_Sums[PC.NewHoliday] += holiday.NewHolidays; m_Sums[PC.OldHoliday] += holiday.OldHolidays; m_Sums[PC.SpareExc] += holiday.SpareHolidaysExc; m_Sums[PC.SpareInc] += holiday.SpareHolidaysInc; m_Sums[PC.UsedHolidays] += holiday.UsedHolidays; }
protected virtual void ApplyStaticEmployeeValues(BzEmployeeHoliday entity, DataRow row) { row[PC.EmployeeName] = entity.EmployeeName; row[PC.OldHoliday] = entity.OldHolidays; row[PC.NewHoliday] = entity.NewHolidays; row[PC.AvailableHolidays] = entity.AvailableHolidays; row[PC.SpareExc] = entity.SpareHolidaysExc; row[PC.SpareInc] = entity.SpareHolidaysInc; row[PC.UsedHolidays] = entity.UsedHolidays; row[PC.World] = entity.WorldName; }
protected override void ApplyDynamicValues(BzEmployeeHoliday entity, DataRow spanRow) { DateTime start, end; Wrapper.GetWeekDateRange(m_Week, out start, out end); for (int i = 1; i <= 7; i++, start = start.AddDays(1d)) { DataRow row = m_Table.NewRow(); List<AbsenceTimeRange> absences = entity.Absences != null ? entity.Absences[start] : null; if (absences != null && absences.Count > 0) row[PC.DynName(i)] = absences[0].Days; m_Table.Rows.Add(row); } }
protected override void ApplyDynamicValues(BzEmployeeHoliday entity, DataRow spanRow) { DateTime start, end; Wrapper.GetWeekDateRange(m_Week, out start, out end); for (int i = 1; i <= 7; i++, start = start.AddDays(1d)) { DataRow row = m_Table.NewRow(); List <AbsenceTimeRange> absences = entity.Absences != null ? entity.Absences[start] : null; if (absences != null && absences.Count > 0) { row[PC.DynName(i)] = absences[0].Days; } m_Table.Rows.Add(row); } }
protected override void ApplyDynamicValues(BzEmployeeHoliday entity, DataRow row) { for (int i = 1; i <= Wrapper.CountOfWeek; i++) row[PC.DynName(i)] = InfoToString(entity.GetWeek(i)); }
public AbsencePlanningQuery GetAllAbsencePlanning(long storeID, long countryID, int year, DateTime today) { int TodayYear = DateTimeHelper.GetYearByDate(DateTime.Today); bool isAustria = countryID == _countryService.AustriaCountryID; DateTime begin, end; begin = DateTimeHelper.GetBeginYearDate(year); end = DateTimeHelper.GetEndYearDate(year); DateTime dateToday = DateTime.Today; AbsencePlanningQuery result = new AbsencePlanningQuery(); List <long> employee_ids = new List <long>(); result.Year = year; result.StoreID = storeID; // need remove - once per country need load result.Absences = _absenceService.GetCountryAbsences(countryID); result.AvgDaysPerWeek = _countryService.AvgWorkingDaysInWeekService .GetAvgWorkingDaysInWeek(countryID, year); result.StoreDays = _storeService.GetStoreDays(storeID, begin, end); result.LongabsencesEntities = _employeeService.LongTimeAbsenceService.FindAllByCountry(countryID); EmployeeService service = _employeeService as EmployeeService; List <Employee> employees = service.EmployeeDao.GetStoreEmployeesHaveContracts(storeID, begin, end); long[] ids_employee = null; if (employees != null && employees.Count > 0) { foreach (Employee empl in employees) { employee_ids.Add(empl.ID); } ids_employee = employee_ids.ToArray(); EmployeeContractService contract_service = ServerEnvironment.EmployeeContractService as EmployeeContractService; result.Contracts = contract_service.GetEmployeeContractsByStore(storeID, begin, end); EmployeeRelationService relation_service = _employeeService.EmployeeRelationService as EmployeeRelationService; result.Relations = relation_service.GetEmployeeRelationByMainStore(storeID, begin, end); result.Longabsences = _employeeLongTimeAbsenceService.GetEmployeesHasLongTimeAbsence(storeID, begin, end); //Debug.Assert(result.Contracts != null && result.Contracts.Count >= employees.Count); //Debug.Assert(result.Relations != null && result.Relations.Count >= employees.Count); if (dateToday < begin) { result.Plannings = _absenceTimePlanningService .GetAbsenceTimePlanningsByEmployeeIds(ids_employee, begin, end); } else if (dateToday > end) { result.Recordings = _absenceTimeRecordingService .GetAbsenceTimeRecordingsByEmployeeIds(ids_employee, begin, end); } else { result.Plannings = _absenceTimePlanningService .GetAbsenceTimePlanningsByEmployeeIds(ids_employee, dateToday, end); result.Recordings = _absenceTimeRecordingService .GetAbsenceTimeRecordingsByEmployeeIds(ids_employee, begin, dateToday.AddDays(-1)); } List <EmployeeHolidaysInfo> holidays = ExEmployeeHolidays.GetAllByStore(storeID, year); Dictionary <long, EmployeeHolidaysInfo> hash = new Dictionary <long, EmployeeHolidaysInfo>(); hash = EmployeeHolidaysInfo.BuildDiction(holidays); BzEmployeeHoliday bz_entity = null; EmployeeHolidaysInfo entity = null; foreach (Employee empl in employees) { if (result._holidays == null) { result._holidays = new List <BzEmployeeHoliday>(); } if (!hash.TryGetValue(empl.ID, out entity)) { entity = new EmployeeHolidaysInfo((short)year, 0, 0, 0, empl.ID); } bz_entity = new BzEmployeeHoliday(entity, empl.FullName, empl.MainStoreID, empl.OrderHwgrID); bz_entity.IsAustria = isAustria; if (isAustria && year == TodayYear) { bz_entity.AvailableHolidays = Convert.ToDouble(empl.AvailableHolidays); } result._holidays.Add(bz_entity); } } return(result); }
public AbsencePlanningQuery GetAllAbsencePlanning(long storeID, long countryID, int year, DateTime today) { int TodayYear = DateTimeHelper.GetYearByDate(DateTime.Today); bool isAustria = countryID == _countryService.AustriaCountryID; DateTime begin, end; begin = DateTimeHelper.GetBeginYearDate(year); end = DateTimeHelper.GetEndYearDate(year); DateTime dateToday = DateTime.Today; AbsencePlanningQuery result = new AbsencePlanningQuery(); List<long> employee_ids = new List<long>(); result.Year = year; result.StoreID = storeID; // need remove - once per country need load result.Absences = _absenceService.GetCountryAbsences(countryID); result.AvgDaysPerWeek = _countryService.AvgWorkingDaysInWeekService .GetAvgWorkingDaysInWeek(countryID, year); result.StoreDays = _storeService.GetStoreDays(storeID, begin, end); result.LongabsencesEntities = _employeeService.LongTimeAbsenceService.FindAllByCountry(countryID); EmployeeService service = _employeeService as EmployeeService; List<Employee> employees = service.EmployeeDao.GetStoreEmployeesHaveContracts(storeID, begin, end); long[] ids_employee = null; if (employees != null && employees.Count > 0) { foreach (Employee empl in employees) employee_ids.Add(empl.ID); ids_employee = employee_ids.ToArray(); EmployeeContractService contract_service = ServerEnvironment.EmployeeContractService as EmployeeContractService; result.Contracts = contract_service.GetEmployeeContractsByStore(storeID, begin, end); EmployeeRelationService relation_service = _employeeService.EmployeeRelationService as EmployeeRelationService; result.Relations = relation_service.GetEmployeeRelationByMainStore(storeID, begin, end); result.Longabsences = _employeeLongTimeAbsenceService.GetEmployeesHasLongTimeAbsence(storeID, begin, end); //Debug.Assert(result.Contracts != null && result.Contracts.Count >= employees.Count); //Debug.Assert(result.Relations != null && result.Relations.Count >= employees.Count); if (dateToday < begin) { result.Plannings = _absenceTimePlanningService .GetAbsenceTimePlanningsByEmployeeIds(ids_employee, begin, end); } else if (dateToday > end) { result.Recordings = _absenceTimeRecordingService .GetAbsenceTimeRecordingsByEmployeeIds(ids_employee, begin, end); } else { result.Plannings = _absenceTimePlanningService .GetAbsenceTimePlanningsByEmployeeIds(ids_employee, dateToday, end); result.Recordings = _absenceTimeRecordingService .GetAbsenceTimeRecordingsByEmployeeIds(ids_employee, begin, dateToday.AddDays(-1)); } List<EmployeeHolidaysInfo> holidays = ExEmployeeHolidays.GetAllByStore(storeID, year); Dictionary<long, EmployeeHolidaysInfo> hash = new Dictionary<long, EmployeeHolidaysInfo>(); hash = EmployeeHolidaysInfo.BuildDiction(holidays); BzEmployeeHoliday bz_entity = null; EmployeeHolidaysInfo entity = null; foreach (Employee empl in employees) { if (result._holidays == null) result._holidays = new List<BzEmployeeHoliday>(); if (!hash.TryGetValue(empl.ID, out entity)) { entity = new EmployeeHolidaysInfo((short)year, 0, 0, 0, empl.ID); } bz_entity = new BzEmployeeHoliday(entity, empl.FullName, empl.MainStoreID, empl.OrderHwgrID); bz_entity.IsAustria = isAustria; if (isAustria && year == TodayYear) bz_entity.AvailableHolidays = Convert.ToDouble(empl.AvailableHolidays); result._holidays.Add(bz_entity); } } return result; }
protected abstract void ApplyDynamicValues(BzEmployeeHoliday entity, DataRow row);
protected override void ApplyDynamicValues(BzEmployeeHoliday entity, DataRow row) { int i = 1; foreach (string month in PC.Months) row[month] = InfoToString(entity.GetMonth(i++)); }