本文整理汇总了C#中DataProvider.GetEmployeeFilter方法的典型用法代码示例。如果您正苦于以下问题:C# DataProvider.GetEmployeeFilter方法的具体用法?C# DataProvider.GetEmployeeFilter怎么用?C# DataProvider.GetEmployeeFilter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataProvider
的用法示例。
在下文中一共展示了DataProvider.GetEmployeeFilter方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateDataSet
protected override DataSet CreateDataSet(DataProvider dataProvider)
{
var filter = GetFilter<WorkingTimeReportFilter>();
var employeeFilter = dataProvider.GetEmployeeFilter(filter);
var employees = dataProvider.GetEmployees(employeeFilter, filter.IsDefault);
if (filter.IsSearch)
{
employeeFilter.FirstName = filter.FirstName;
employeeFilter.SecondName = filter.SecondName;
employeeFilter.LastName = filter.LastName;
}
var timeTrackResult = dataProvider.DbService.TimeTrackTranslator.GetTimeTracks(employeeFilter, filter.DateTimeFrom, filter.DateTimeTo);
var dataSet = new WorkingTimeDataSet();
foreach (var employee in employees)
{
var dataRow = dataSet.Data.NewDataRow();
dataRow.Employee = employee.Name;
dataRow.Organisation = employee.Organisation;
dataRow.Department = employee.Department;
dataRow.Position = employee.Position;
var timeTrackEmployeeResult = timeTrackResult.Result.TimeTrackEmployeeResults.FirstOrDefault(x => x.ShortEmployee.UID == employee.UID);
if (timeTrackEmployeeResult != null)
{
var totalSchedule = new TimeSpan();
var totalScheduleNight = new TimeSpan();
var totalPresence = new TimeSpan();
var totalOvertime = new TimeSpan();
var totalNight = new TimeSpan();
var totalDocumentOvertime = new TimeSpan();
var totalDocumentAbsence = new TimeSpan();
var totalBalance = new TimeSpan();
foreach (var dayTimeTrack in timeTrackEmployeeResult.DayTimeTracks)
{
dayTimeTrack.Calculate();
var nightSettings = dayTimeTrack.NightSettings;
var plannedTimeTrackParts = dayTimeTrack.PlannedTimeTrackParts;
if (nightSettings != null && nightSettings.NightEndTime != nightSettings.NightStartTime)
{
if (nightSettings.NightEndTime > nightSettings.NightStartTime)
{
totalScheduleNight += CalculateEveningTime(nightSettings.NightStartTime, nightSettings.NightEndTime, plannedTimeTrackParts);
}
else
{
totalScheduleNight += CalculateEveningTime(nightSettings.NightStartTime, new TimeSpan(23, 59, 59), plannedTimeTrackParts) + CalculateEveningTime(new TimeSpan(0, 0, 0), nightSettings.NightEndTime, plannedTimeTrackParts);
}
}
plannedTimeTrackParts.ForEach(x => totalSchedule += x.Delta);
var presence = dayTimeTrack.Totals.FirstOrDefault(x => x.TimeTrackType == TimeTrackType.Presence);
if (presence != null)
{
totalPresence += presence.TimeSpan;
}
var overtime = dayTimeTrack.Totals.FirstOrDefault(x => x.TimeTrackType == TimeTrackType.Overtime);
if (overtime != null)
{
totalOvertime += overtime.TimeSpan;
}
var night = dayTimeTrack.Totals.FirstOrDefault(x => x.TimeTrackType == TimeTrackType.Night);
if (night != null)
{
totalNight += night.TimeSpan;
}
var documentOvertime = dayTimeTrack.Totals.FirstOrDefault(x => x.TimeTrackType == TimeTrackType.DocumentOvertime);
if (documentOvertime != null)
{
totalDocumentOvertime += documentOvertime.TimeSpan;
}
var documentAbsence = dayTimeTrack.Totals.FirstOrDefault(x => x.TimeTrackType == TimeTrackType.DocumentAbsence);
if (documentAbsence != null)
{
totalDocumentAbsence += documentAbsence.TimeSpan;
}
var balance = dayTimeTrack.Totals.FirstOrDefault(x => x.TimeTrackType == TimeTrackType.Balance);
if (balance != null)
{
totalBalance += balance.TimeSpan;
}
}
dataRow.ScheduleDay = (totalSchedule-totalScheduleNight).TotalHours;
dataRow.ScheduleNight = totalScheduleNight.TotalHours;
dataRow.Presence = totalPresence.TotalHours;
dataRow.Overtime = totalOvertime.TotalHours;
dataRow.Night = totalNight.TotalHours;
dataRow.TotalPresence = totalPresence.TotalHours + totalNight.TotalHours;
dataRow.DocumentOvertime = totalDocumentOvertime.TotalHours;
dataRow.DocumentAbsence = totalDocumentAbsence.TotalHours;
dataRow.Balance = totalBalance.TotalHours - dataRow.DocumentOvertime + dataRow.DocumentAbsence;
dataRow.TotalBalance = totalBalance.TotalHours;
}
//.........这里部分代码省略.........
示例2: CreateDataSet
protected override DataSet CreateDataSet(DataProvider dataProvider)
{
var filter = GetFilter<DisciplineReportFilter>();
var employeeFilter = dataProvider.GetEmployeeFilter(filter);
var employees = dataProvider.GetEmployees(employeeFilter, filter.IsDefault);
var timeTrackResult = dataProvider.DbService.TimeTrackTranslator.GetTimeTracks(employeeFilter, filter.DateTimeFrom, filter.DateTimeTo);
var dataSet = new DisciplineDataSet();
foreach (var employee in employees)
{
if (filter.ScheduleSchemas != null && filter.ScheduleSchemas.Count > 0)
{
if (employee.Item.ScheduleUID == Guid.Empty || !filter.ScheduleSchemas.Contains(employee.Item.ScheduleUID))
continue;
}
var timeTrackEmployeeResult = timeTrackResult.Result.TimeTrackEmployeeResults.FirstOrDefault(x => x.ShortEmployee.UID == employee.UID);
if (timeTrackEmployeeResult != null)
{
foreach (var dayTimeTrack in timeTrackEmployeeResult.DayTimeTracks)
{
dayTimeTrack.Calculate();
bool hasEarlyLive;
bool hasLate;
if (filter.ShowWithoutTolerance)
{
hasEarlyLive = dayTimeTrack.Totals.FirstOrDefault(x => x.TimeTrackType == TimeTrackType.EarlyLeave).TimeSpan > TimeSpan.Zero;
hasLate = dayTimeTrack.Totals.FirstOrDefault(x => x.TimeTrackType == TimeTrackType.Late).TimeSpan > TimeSpan.Zero;
}
else
{
hasEarlyLive = dayTimeTrack.Totals.FirstOrDefault(x => x.TimeTrackType == TimeTrackType.EarlyLeave).TimeSpan > dayTimeTrack.AllowedEarlyLeave;
hasLate = dayTimeTrack.Totals.FirstOrDefault(x => x.TimeTrackType == TimeTrackType.Late).TimeSpan > dayTimeTrack.AllowedLate;
}
var hasAbcence = dayTimeTrack.Totals.FirstOrDefault(x => x.TimeTrackType == TimeTrackType.Absence).TimeSpan > TimeSpan.Zero;
var hasOvertime = dayTimeTrack.Totals.FirstOrDefault(x => x.TimeTrackType == TimeTrackType.Overtime).TimeSpan > TimeSpan.Zero;
var hasDocument = dayTimeTrack.Totals.Where(x => x.TimeTrackType == TimeTrackType.DocumentPresence ||
x.TimeTrackType == TimeTrackType.DocumentOvertime ||
x.TimeTrackType == TimeTrackType.DocumentAbsence).Any(x=>x.TimeSpan > TimeSpan.Zero);
var isShow = filter.ShowEarlуRetirement && hasEarlyLive ||
filter.ShowDelay && hasLate ||
filter.ShowAbsence && hasAbcence ||
filter.ShowOvertime && hasOvertime ||
filter.ShowConfirmed && hasDocument;
if (isShow)
{
var dataRow = dataSet.Data.NewDataRow();
dataRow.Employee = employee.Name;
dataRow.Organisation = employee.Organisation;
dataRow.Department = employee.Department;
dataRow.Date = dayTimeTrack.Date;
if (dayTimeTrack.RealTimeTrackParts.Count > 0)
{
dataRow.FirstEnter = dayTimeTrack.RealTimeTrackParts.Min(x => x.StartTime);
dataRow.LastExit = dayTimeTrack.RealTimeTrackParts.Max(x => x.EndTime);
}
var absence = dayTimeTrack.Totals.FirstOrDefault(x => x.TimeTrackType == TimeTrackType.Absence);
if (absence != null)
{
dataRow.Absence = absence.TimeSpan;
}
var late = dayTimeTrack.Totals.FirstOrDefault(x => x.TimeTrackType == TimeTrackType.Late);
if (late != null)
{
dataRow.Late = late.TimeSpan;
}
var earlyLeave = dayTimeTrack.Totals.FirstOrDefault(x => x.TimeTrackType == TimeTrackType.EarlyLeave);
if (earlyLeave != null)
{
dataRow.EarlyLeave = earlyLeave.TimeSpan;
}
var overtime = dayTimeTrack.Totals.FirstOrDefault(x => x.TimeTrackType == TimeTrackType.Overtime);
if (overtime != null)
{
dataRow.Overtime = overtime.TimeSpan;
}
var isHoliday = dayTimeTrack.IsHoliday;
var document = timeTrackEmployeeResult.Documents.FirstOrDefault(x => (dayTimeTrack.Date >= x.StartDateTime.Date && dayTimeTrack.Date <= x.EndDateTime.Date) && x.TimeTrackDocumentType.ShortName == dayTimeTrack.LetterCode);
if (document != null)
{
dataRow.DocumentDate = document.DocumentDateTime;
dataRow.DocumentName = document.TimeTrackDocumentType.Name;
dataRow.DocumentNo = document.DocumentNumber.ToString();
}
if (absence.TimeSpan.TotalSeconds > 0 || late.TimeSpan.TotalSeconds > 0 || earlyLeave.TimeSpan.TotalSeconds > 0 || overtime.TimeSpan.TotalSeconds > 0 || document != null)
{
dataSet.Data.Rows.Add(dataRow);
}
}
}
}
}
//.........这里部分代码省略.........