本文整理汇总了C#中DataProvider.GetEmployee方法的典型用法代码示例。如果您正苦于以下问题:C# DataProvider.GetEmployee方法的具体用法?C# DataProvider.GetEmployee怎么用?C# DataProvider.GetEmployee使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataProvider
的用法示例。
在下文中一共展示了DataProvider.GetEmployee方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddRecord
private void AddRecord(DataProvider dataProvider, EmployeeZonesDataSet ds, RubezhDAL.DataClasses.PassJournal record, EmployeeZonesReportFilter filter, bool isEnter, Dictionary<Guid, string> zoneMap)
{
if (record.EmployeeUID == null)
return;
var dataRow = ds.Data.NewDataRow();
var employee = dataProvider.GetEmployee(record.EmployeeUID.Value);
dataRow.Employee = employee.Name;
dataRow.Orgnisation = employee.Organisation;
dataRow.Department = employee.Department;
dataRow.Position = employee.Position;
dataRow.Zone = zoneMap.ContainsKey(record.ZoneUID) ? zoneMap[record.ZoneUID] : null;
dataRow.EnterDateTime = record.EnterTime;
if (record.ExitTime.HasValue)
{
dataRow.ExitDateTime = record.ExitTime.Value;
dataRow.Period = dataRow.ExitDateTime - dataRow.EnterDateTime;
}
else
{
dataRow.ExitDateTime = filter.ReportDateTime;
dataRow.Period = filter.ReportDateTime - dataRow.EnterDateTime;
}
if (!filter.IsEmployee)
{
var escortUID = employee.Item.EscortUID;
if (escortUID.HasValue)
{
var escort = dataProvider.GetEmployee(escortUID.Value);
dataRow.Escort = escort.Name;
}
}
ds.Data.Rows.Add(dataRow);
}
示例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<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;
}
示例4: 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;
//.........这里部分代码省略.........
示例5: 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;
}