本文整理汇总了C#中DataProvider.LoadCache方法的典型用法代码示例。如果您正苦于以下问题:C# DataProvider.LoadCache方法的具体用法?C# DataProvider.LoadCache怎么用?C# DataProvider.LoadCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataProvider
的用法示例。
在下文中一共展示了DataProvider.LoadCache方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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<PositionsReportFilter>();
var databaseService = new RubezhDAL.DataClasses.DbService();
dataProvider.LoadCache();
Guid organisationUID = Guid.Empty;
var organisations = dataProvider.Organisations.Where(org => filter.User == null || filter.User.IsAdm || org.Value.Item.UserUIDs.Any(y => y == filter.User.UID));
if (!filter.UseArchive)
organisations = organisations.Where(org => !org.Value.IsDeleted);
if (filter.Organisations.IsEmpty())
{
if (filter.IsDefault)
organisationUID = organisations.FirstOrDefault().Key;
}
else
{
organisationUID = organisations.FirstOrDefault(org => org.Key == filter.Organisations.FirstOrDefault()).Key;
}
filter.Organisations = new List<Guid>() { organisationUID };
var positionFilter = new PositionFilter()
{
OrganisationUIDs = filter.Organisations ?? new List<Guid>(),
UIDs = filter.Positions ?? new List<Guid>(),
LogicalDeletationType = filter.UseArchive ? LogicalDeletationType.All : LogicalDeletationType.Active,
};
var positions = GetPosition(dataProvider, filter);
var ds = new PositionsDataSet();
if (positions != null)
positions.ForEach(position =>
{
var row = ds.Data.NewDataRow();
row.Organisation = position.Organisation;
row.Position = position.Item.Name;
row.Description = position.Item.Description;
ds.Data.AddDataRow(row);
});
return ds;
}
示例3: 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;
}