本文整理汇总了C#中DataProvider.GetEmployees方法的典型用法代码示例。如果您正苦于以下问题:C# DataProvider.GetEmployees方法的具体用法?C# DataProvider.GetEmployees怎么用?C# DataProvider.GetEmployees使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataProvider
的用法示例。
在下文中一共展示了DataProvider.GetEmployees方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateDataSet
protected override DataSet CreateDataSet(DataProvider dataProvider)
{
var filter = GetFilter<DepartmentsReportFilter>();
var databaseService = new RubezhDAL.DataClasses.DbService();
dataProvider.LoadCache();
var departments = GetDepartments(dataProvider, filter);
var uids = departments.Select(item => item.UID).ToList();
var employees = dataProvider.GetEmployees(departments.Where(item => item.Item.ChiefUID != Guid.Empty).Select(item => item.Item.ChiefUID));
var ds = new DepartmentsDataSet();
departments.ForEach(department =>
{
var row = ds.Data.NewDataRow();
row.Organisation = department.Organisation;
row.Department = department.Name;
row.Phone = department.Item.Phone;
row.Chief = employees.Where(item => item.UID == department.Item.ChiefUID).Select(item => item.Name).FirstOrDefault();
row.ParentDepartment = dataProvider.Departments.ContainsKey(department.Item.ParentDepartmentUID) ?
dataProvider.Departments[department.Item.ParentDepartmentUID].Name : string.Empty;
row.Description = department.Item.Description;
row.IsArchive = department.IsDeleted;
var parents = GetParents(dataProvider, department);
row.Level = parents.Count;
row.Tag = string.Join("/", parents.Select(item => item.UID));
ds.Data.AddDataRow(row);
});
return ds;
}
示例2: CreateDataSet
protected override DataSet CreateDataSet(DataProvider dataProvider)
{
var filter = GetFilter<CardsReportFilter>();
var cardFilter = new CardFilter();
cardFilter.EmployeeFilter = dataProvider.GetCardEmployeeFilter(filter);
if ((filter.PassCardActive && filter.PassCardInactive) || (!filter.PassCardActive && !filter.PassCardInactive))
cardFilter.DeactivationType = LogicalDeletationType.All;
if (filter.PassCardActive && !filter.PassCardInactive)
cardFilter.DeactivationType = LogicalDeletationType.Active;
if (!filter.PassCardActive && filter.PassCardInactive)
cardFilter.DeactivationType = LogicalDeletationType.Deleted;
cardFilter.IsWithEndDate = filter.UseExpirationDate;
if (filter.UseExpirationDate)
switch (filter.ExpirationType)
{
case EndDateType.Day:
cardFilter.EndDate = DateTime.Today.AddDays(1);
break;
case EndDateType.Week:
cardFilter.EndDate = DateTime.Today.AddDays(7);
break;
case EndDateType.Month:
cardFilter.EndDate = DateTime.Today.AddDays(31);
break;
case EndDateType.Arbitrary:
cardFilter.EndDate = filter.ExpirationDate;
break;
}
var cardsResult = dataProvider.DbService.CardTranslator.Get(cardFilter);
var dataSet = new CardsDataSet();
if (!cardsResult.HasError)
{
dataProvider.GetEmployees(cardsResult.Result.Select(item => item.EmployeeUID.GetValueOrDefault()));
foreach (var card in cardsResult.Result)
{
var dataRow = dataSet.Data.NewDataRow();
dataRow.Type = card.IsInStopList ? "Деактивированный" : card.GKCardType.ToDescription();
dataRow.Number = card.Number.ToString();
var employee = dataProvider.GetEmployee(card.EmployeeUID.GetValueOrDefault());
if (employee != null)
{
dataRow.Employee = employee.Name;
dataRow.Organisation = employee.Organisation;
dataRow.Department = employee.Department;
dataRow.Position = employee.Position;
}
if (!card.IsInStopList)
dataRow.Period = card.EndDate;
dataSet.Data.Rows.Add(dataRow);
}
}
return dataSet;
}
示例3: CreateDataSet
protected override DataSet CreateDataSet(DataProvider dataProvider)
{
var filter = GetFilter<SchedulesReportFilter>();
var dataSet = new SchedulesDataSet();
var employees = dataProvider.GetEmployees(filter);
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 dataRow = dataSet.Data.NewDataRow();
dataRow.Employee = employee.Name;
dataRow.Organisation = employee.Organisation;
dataRow.Department = employee.Department;
dataRow.Position = employee.Position;
if (employee.Item.ScheduleUID != Guid.Empty)
{
dataRow.Schedule = employee.Item.ScheduleName;
var scheduleResult = dataProvider.DbService.ScheduleTranslator.GetSingle(employee.Item.ScheduleUID);
if (scheduleResult.Result != null)
{
dataRow.UseHoliday = !scheduleResult.Result.IsIgnoreHoliday;
dataRow.FirstEnterLastExit = scheduleResult.Result.IsOnlyFirstEnter;
dataRow.Delay = scheduleResult.Result.AllowedLate;
dataRow.LeaveBefore = scheduleResult.Result.AllowedLate;
var scheduleSchemeResult = dataProvider.DbService.ScheduleSchemeTranslator.GetSingle(scheduleResult.Result.ScheduleSchemeUID);
if (scheduleSchemeResult.Result != null)
{
dataRow.BaseSchedule = scheduleSchemeResult.Result.Name;
dataRow.ScheduleType = scheduleSchemeResult.Result.Type.ToDescription();
}
}
}
dataSet.Data.Rows.Add(dataRow);
}
return dataSet;
}
示例4: CreateDataSet
protected override DataSet CreateDataSet(DataProvider dataProvider)
{
var filter = GetFilter<DocumentsReportFilter>();
var employees = dataProvider.GetEmployees(filter);
var ds = new DataSetDocuments();
foreach (var employee in employees)
{
var documentsResult = dataProvider.DbService.TimeTrackDocumentTranslator.Get(employee.UID, filter.DateTimeFrom, filter.DateTimeTo);
if (documentsResult.Result != null)
{
foreach (var document in documentsResult.Result)
{
var documentTypesResult = dataProvider.DbService.TimeTrackDocumentTypeTranslator.Get(employee.OrganisationUID);
if (documentTypesResult.Result != null)
{
var documentType = documentTypesResult.Result.FirstOrDefault(x => x.Code == document.DocumentCode);
if (documentType == null)
documentType = TimeTrackDocumentTypesCollection.TimeTrackDocumentTypes.FirstOrDefault(x => x.Code == document.DocumentCode);
if (documentType != null)
{
if (filter.Abcense && documentType.DocumentType == DocumentType.Absence ||
filter.Presence && documentType.DocumentType == DocumentType.Presence ||
filter.Overtime && documentType.DocumentType == DocumentType.Overtime)
{
var row = ds.Data.NewDataRow();
row.Organisation = employee.Organisation;
row.Employee = employee.Name;
row.Department = employee.Department;
row.StartDateTime = document.StartDateTime;
row.EndDateTime = document.EndDateTime;
row.DocumentCode = documentType.Code;
row.DocumentName = documentType.Name;
row.DocumentShortName = documentType.ShortName;
row.DocumentType = documentType.DocumentType.ToDescription();
ds.Data.AddDataRow(row);
}
}
}
}
}
}
return ds;
}
示例5: CreateDataSet
protected override DataSet CreateDataSet(DataProvider dataProvider)
{
var filter = GetFilter<EmployeeZonesReportFilter>();
if (filter.UseCurrentDate)
filter.ReportDateTime = DateTime.Now;
var dataSet = new EmployeeZonesDataSet();
if (dataProvider.DbService.PassJournalTranslator != null)
{
var employees = dataProvider.GetEmployees(filter);
var zoneMap = new Dictionary<Guid, string>();
foreach (var zone in GKManager.SKDZones)
{
zoneMap.Add(zone.UID, zone.PresentationName);
}
var enterJournal = dataProvider.DbService.PassJournalTranslator.GetEmployeesLastEnterPassJournal(
employees.Select(item => item.UID), filter.Zones, filter.ReportDateTime);
foreach (var record in enterJournal)
AddRecord(dataProvider, dataSet, record, filter, true, zoneMap);
}
return dataSet;
}
示例6: CreateDataSet
protected override DataSet CreateDataSet(DataProvider dataProvider)
{
var filter = GetFilter<EmployeeReportFilter>();
dataProvider.LoadCache();
var employees = dataProvider.GetEmployees(filter);
var cards = dataProvider.GetCards(new CardFilter { EmployeeFilter = new EmployeeFilter { UIDs = employees.Select(x => x.UID).ToList() } });
var dataSet = new EmployeeDataSet();
foreach (var employee in employees)
{
var dataRow = dataSet.Data.NewDataRow();
dataRow.IsEmployee = filter.IsEmployee;
dataRow.BirthDay = employee.Item.BirthDate;
dataRow.BirthPlace = employee.Item.BirthPlace;
dataRow.Department = employee.Department;
dataRow.Document = employee.Item.DocumentType.ToDescription();
dataRow.DocumentIssuer = employee.Item.DocumentGivenBy;
dataRow.DocumentNumber = employee.Item.DocumentNumber;
dataRow.DocumentValidFrom = employee.Item.DocumentGivenDate;
dataRow.DocumentValidTo = employee.Item.DocumentValidTo;
dataRow.FirstName = employee.Item.FirstName;
dataRow.LastName = employee.Item.LastName;
dataRow.Nationality = employee.Item.Citizenship;
int number = -1;
int.TryParse(employee.Item.TabelNo, out number);
dataRow.Number = number;
dataRow.Organisation = employee.Organisation;
dataRow.Phone = employee.Item.Phone;
if (employee.Item.Photo != null)
dataRow.Photo = employee.Item.Photo.Data;
if (employee.Item.Type == PersonType.Guest)
{
dataRow.Type = "Сопровождающий";
dataRow.PositionOrEscort = employee.Item.EscortName;
}
if (employee.Item.Type == PersonType.Employee)
{
dataRow.Type = "Должность";
dataRow.PositionOrEscort = employee.Position;
dataRow.Schedule = employee.Item.ScheduleName;
}
dataRow.SecondName = employee.Item.SecondName;
dataRow.Sex = employee.Item.Gender.ToDescription();
dataRow.UID = employee.UID;
dataSet.Data.Rows.Add(dataRow);
var employeeCards = cards.Where(x => x.EmployeeUID == employee.UID);
foreach (var card in employeeCards)
{
var cardRow = dataSet.PassCards.NewPassCardsRow();
cardRow.DataRow = dataRow;
cardRow.Number = (int)card.Number;
dataSet.PassCards.AddPassCardsRow(cardRow);
}
foreach (var column in employee.Item.AdditionalColumns)
{
if (column.DataType == AdditionalColumnDataType.Text)
{
var columnRow = dataSet.AdditionalColumns.NewAdditionalColumnsRow();
columnRow.DataRow = dataRow;
columnRow.Value = column.TextData;
columnRow.Name = column.ColumnName;
dataSet.AdditionalColumns.AddAdditionalColumnsRow(columnRow);
}
}
}
return dataSet;
}
示例7: CreateDataSet
protected override DataSet CreateDataSet(DataProvider dataProvider)
{
var filter = GetFilter<EmployeeAccessReportFilter>();
if (!filter.PassCardActive && !filter.PassCardForcing && !filter.PassCardLocked && !filter.PassCardOnceOnly && !filter.PassCardPermanent && !filter.PassCardTemprorary)
{
filter.PassCardActive = true;
filter.PassCardForcing = true;
filter.PassCardLocked = true;
filter.PassCardOnceOnly = true;
filter.PassCardPermanent = true;
filter.PassCardTemprorary = true;
}
var cardFilter = new CardFilter();
cardFilter.EmployeeFilter = dataProvider.GetCardEmployeeFilter(filter);
cardFilter.DeactivationType = LogicalDeletationType.Active;
cardFilter.LogicalDeletationType = LogicalDeletationType.Active;
var cardsResult = dataProvider.DbService.CardTranslator.Get(cardFilter);
var dataSet = new EmployeeAccessDataSet();
if (!cardsResult.HasError)
{
dataProvider.GetEmployees(cardsResult.Result.Select(item => item.EmployeeUID.GetValueOrDefault()));
var accessTemplateFilter = new AccessTemplateFilter()
{
UIDs = cardsResult.Result.Where(item => item.AccessTemplateUID.HasValue && item.AccessTemplateUID != Guid.Empty).Select(item => item.AccessTemplateUID.Value).ToList()
};
var accessTemplates = dataProvider.DbService.AccessTemplateTranslator.Get(accessTemplateFilter);
var zoneMap = new Dictionary<Guid, Tuple<Tuple<GKSKDZone, string>, Tuple<GKSKDZone, string>>>();
GKManager.Doors.ForEach(door =>
{
if (door != null && !zoneMap.ContainsKey(door.UID))
{
GKSKDZone enterZone = null;
if (filter.Zones.IsEmpty() || filter.Zones.Contains(door.EnterZoneUID))
{
enterZone = GKManager.SKDZones.FirstOrDefault(x => x.UID == door.EnterZoneUID);
}
GKSKDZone exitZone = null;
if (filter.Zones.IsEmpty() || filter.Zones.Contains(door.ExitZoneUID))
{
exitZone = GKManager.SKDZones.FirstOrDefault(x => x.UID == door.ExitZoneUID);
}
Tuple<GKSKDZone, string> enterZoneTuple = null;
if (enterZone != null)
{
enterZoneTuple = new Tuple<GKSKDZone, string>(enterZone, enterZone.PresentationName);
}
Tuple<GKSKDZone, string> exitZoneTuple = null;
if (exitZone != null)
{
exitZoneTuple = new Tuple<GKSKDZone, string>(exitZone, exitZone.PresentationName);
}
var value = new Tuple<Tuple<GKSKDZone, string>, Tuple<GKSKDZone, string>>(enterZoneTuple, exitZoneTuple);
zoneMap.Add(door.UID, value);
}
});
foreach (var card in cardsResult.Result)
{
var employee = dataProvider.GetEmployee(card.EmployeeUID.GetValueOrDefault());
var addedZones = new List<Guid>();
foreach (var door in card.CardDoors)
AddRow(dataSet, employee, card, door, null, zoneMap, addedZones);
if (!accessTemplates.HasError && card.AccessTemplateUID.HasValue)
{
var cardDoorUIDs = card.CardDoors.Select(item => item.DoorUID);
var accessTemplate = accessTemplates.Result.FirstOrDefault(item => item.UID == card.AccessTemplateUID.Value);
if (accessTemplates != null)
foreach (var door in accessTemplate.CardDoors.Where(item => !cardDoorUIDs.Contains(item.DoorUID)))
AddRow(dataSet, employee, card, door, accessTemplate, zoneMap, addedZones);
}
}
}
return dataSet;
}
示例8: CreateDataSet
protected override DataSet CreateDataSet(DataProvider dataProvider)
{
var filter = GetFilter<EmployeeDoorsReportFilter>();
if (!filter.PassCardActive && !filter.PassCardForcing && !filter.PassCardLocked && !filter.PassCardOnceOnly && !filter.PassCardPermanent && !filter.PassCardTemprorary)
{
filter.PassCardActive = true;
filter.PassCardForcing = true;
filter.PassCardLocked = true;
filter.PassCardOnceOnly = true;
filter.PassCardPermanent = true;
filter.PassCardTemprorary = true;
}
if (!filter.ZoneIn && !filter.ZoneOut)
{
filter.ZoneIn = true;
filter.ZoneOut = true;
}
if (!filter.ScheduleEnter && !filter.ScheduleExit)
{
filter.ScheduleEnter = true;
filter.ScheduleExit = true;
}
var cardFilter = new CardFilter();
cardFilter.EmployeeFilter = dataProvider.GetCardEmployeeFilter(filter);
cardFilter.DeactivationType = LogicalDeletationType.Active;
cardFilter.LogicalDeletationType = LogicalDeletationType.Active;
var cardsResult = dataProvider.DbService.CardTranslator.Get(cardFilter);
var dataSet = new EmployeeDoorsDataSet();
if (!cardsResult.HasError)
{
dataProvider.GetEmployees(cardsResult.Result.Select(item => item.EmployeeUID.GetValueOrDefault()));
var accessTemplateFilter = new AccessTemplateFilter()
{
UIDs = cardsResult.Result.Where(item => item.AccessTemplateUID.HasValue && item.AccessTemplateUID != Guid.Empty).Select(item => item.AccessTemplateUID.Value).ToList()
};
var accessTemplates = dataProvider.DbService.AccessTemplateTranslator.Get(accessTemplateFilter);
var doorMap = new Dictionary<Guid, CommonDoor>();
foreach (var door in GKManager.Doors)
{
var commonDoor = new CommonDoor(door);
if (!filter.Zones.IsEmpty())
{
if ((filter.ZoneIn && filter.Zones.Contains(door.EnterZoneUID)) || (filter.ZoneOut && filter.Zones.Contains(door.ExitZoneUID)))
doorMap.Add(door.UID, commonDoor);
}
else
{
doorMap.Add(door.UID, commonDoor);
}
}
Dictionary<int, string> intervalMap = new Dictionary<int, string>();
var schedulesResult = dataProvider.DbService.GKScheduleTranslator.Get();
if (!schedulesResult.HasError)
{
foreach (var interval in schedulesResult.Result)
{
intervalMap.Add(interval.No, interval.Name);
}
}
foreach (var card in cardsResult.Result)
{
IEnumerable<CardDoor> cardDoors = card.CardDoors;
if (!accessTemplates.HasError && card.AccessTemplateUID.HasValue && card.AccessTemplateUID.Value != Guid.Empty)
{
var accessTemplate = accessTemplates.Result.FirstOrDefault(item => item.UID == card.AccessTemplateUID.Value);
var cardDoorUIDs = card.CardDoors.Select(item => item.DoorUID);
if (accessTemplate != null)
cardDoors = cardDoors.Union(accessTemplate.CardDoors.Where(item => !cardDoorUIDs.Contains(item.DoorUID)));
}
var employee = dataProvider.GetEmployee(card.EmployeeUID.GetValueOrDefault());
if (!filter.Schedules.IsEmpty())
cardDoors = cardDoors.Where(item =>
(filter.ScheduleEnter && filter.Schedules.Contains(item.EnterScheduleNo)) ||
(filter.ScheduleExit && filter.Schedules.Contains(item.ExitScheduleNo)));
foreach (var cardDoor in cardDoors)
if (doorMap.ContainsKey(cardDoor.DoorUID))
{
var door = doorMap[cardDoor.DoorUID];
var dataRow = dataSet.Data.NewDataRow();
dataRow.Type = card.GKCardType.ToDescription();
dataRow.Number = card.Number.ToString();
if (employee != null)
{
dataRow.Employee = employee.Name;
dataRow.Organisation = employee.Organisation;
dataRow.Department = employee.Department;
dataRow.Position = employee.Position;
}
dataRow.ZoneIn = door.EnterZoneName;
dataRow.ZoneOut = door.ExitZoneName;
dataRow.NoEnterZone = door.NoEnterZone;
dataRow.NoExitZone = door.NoExitZone;
//.........这里部分代码省略.........
示例9: CreateDataSet
protected override DataSet CreateDataSet(DataProvider dataProvider)
{
var filter = GetFilter<EmployeeRootReportFilter>();
var ds = new EmployeeRootDataSet();
var employees = dataProvider.GetEmployees(filter);
var passJournal = dataProvider.DbService.PassJournalTranslator != null ?
dataProvider.DbService.PassJournalTranslator.GetEmployeesRoot(employees.Select(item => item.UID), filter.Zones, filter.DateTimeFrom, filter.DateTimeTo) : null;
var zoneMap = new Dictionary<Guid, string>();
if (passJournal != null)
{
foreach (var zone in GKManager.SKDZones)
{
zoneMap.Add(zone.UID, zone.PresentationName);
}
}
foreach (var employee in employees)
{
var employeeRow = ds.Employee.NewEmployeeRow();
employeeRow.UID = employee.UID;
employeeRow.Name = employee.Name;
employeeRow.Department = employee.Department;
employeeRow.Position = employee.Position;
employeeRow.Organisation = employee.Organisation;
if (!filter.IsEmployee)
{
var escortUID = employee.Item.EscortUID;
var escort = escortUID.HasValue ? dataProvider.GetEmployee(escortUID.Value) : null;
if (escort != null)
{
employeeRow.Escort = escort.Name;
}
employeeRow.Description = employee.Item.Description;
}
ds.Employee.AddEmployeeRow(employeeRow);
if (passJournal != null)
{
var dayPassJournals = passJournal.Where(item => item.EmployeeUID == employee.UID).GroupBy(x => x.EnterTime.Date);
var timeTrackParts = new List<RubezhDAL.DataClasses.PassJournal>();
foreach (var dayPassJournal in dayPassJournals)
{
var timeTrackDayParts = NormalizePassJournals(dayPassJournal);
timeTrackParts.AddRange(timeTrackDayParts);
}
foreach (var pass in timeTrackParts)
{
var row = ds.Data.NewDataRow();
row.EmployeeRow = employeeRow;
if (zoneMap.ContainsKey(pass.ZoneUID))
row.Zone = zoneMap[pass.ZoneUID];
if (filter.DateTimeFrom.Ticks <= pass.EnterTime.Ticks && (!pass.ExitTime.HasValue || pass.ExitTime.Value.Ticks <= filter.DateTimeTo.Ticks))
{
row.DateTime = new DateTime(pass.EnterTime.Ticks);
ds.Data.AddDataRow(row);
}
}
}
}
return ds;
}
示例10: 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;
}
//.........这里部分代码省略.........
示例11: 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);
}
}
}
}
}
//.........这里部分代码省略.........