combobox
This commit is contained in:
63
BlazorFluentUI/Services/EmployeeService.cs
Normal file
63
BlazorFluentUI/Services/EmployeeService.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using BlazorFluentUI.Models;
|
||||
|
||||
namespace BlazorFluentUI.Services
|
||||
{
|
||||
public class EmployeeService
|
||||
{
|
||||
private List<Employee> _fixedSample;
|
||||
|
||||
Random _random = new Random();
|
||||
string[] _firstNames = new[] { "John", "Jane", "Michael", "Emily", "Robert", "Linda", "William", "Jessica", "David", "Sarah" };
|
||||
string[] _lastNames = new[] { "Smith", "Johnson", "Brown", "Williams", "Jones", "Garcia", "Miller", "Davis", "Martinez", "Hernandez" };
|
||||
string[] _jobs = new[] { "Developer", "Designer", "Manager", "Analyst", "Consultant", "Administrator", "Engineer", "Specialist", "Technician", "Coordinator" };
|
||||
string[] _titles = new[] { "Junior", "Mid", "Senior", "Lead", "Chief" };
|
||||
string[] _cities = new[] { "New York", "Los Angeles", "Chicago", "Houston", "Phoenix", "Philadelphia", "San Antonio", "San Diego", "Dallas", "San Jose" };
|
||||
string[] _regions = new[] { "NY", "CA", "IL", "TX", "AZ", "PA", "TX", "CA", "TX", "CA" };
|
||||
string[] _counties = new[] { "USA", "USA", "USA", "USA", "USA", "USA", "USA", "USA", "USA", "USA" };
|
||||
|
||||
public EmployeeService()
|
||||
{
|
||||
_fixedSample = GenerateEmployData(100);
|
||||
}
|
||||
|
||||
public List<Employee> GetEmployeeData(int count)
|
||||
{
|
||||
return GenerateEmployData(count).ToList();
|
||||
}
|
||||
|
||||
public List<Employee> GetFixedEmployeeData()
|
||||
{
|
||||
return _fixedSample;
|
||||
}
|
||||
|
||||
private List<Employee> GenerateEmployData(int count)
|
||||
{
|
||||
var employees = new List<Employee>();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
var employee = new Employee
|
||||
{
|
||||
ID = i + 1,
|
||||
Photo = $"https://randomuser.me/api/portraits/med/{(i % 2 == 0 ? "men" : "women")}/{i}.jpg",
|
||||
FirstName = _firstNames[_random.Next(_firstNames.Length)],
|
||||
LastName = _lastNames[_random.Next(_lastNames.Length)],
|
||||
Job = _jobs[_random.Next(_jobs.Length)],
|
||||
Title = _titles[_random.Next(_titles.Length)],
|
||||
BirthDate = new DateTime(_random.Next(1950, 2000), _random.Next(1, 13), _random.Next(1, 29)),
|
||||
HireDate = DateTime.Today.AddDays(-_random.Next(1, 3650)),
|
||||
Address = $"{_random.Next(1, 9999)} Main St",
|
||||
City = _cities[_random.Next(_cities.Length)],
|
||||
Region = _regions[_random.Next(_regions.Length)],
|
||||
PostalCode = $"{_random.Next(10000, 99999)}",
|
||||
Country = _counties[_random.Next(_counties.Length)],
|
||||
Phone = $"{_random.Next(100, 999)}-555-{_random.Next(1000, 9999)}",
|
||||
Extension = $"{_random.Next(100, 9999)}",
|
||||
Notes = "Generated demo data"
|
||||
};
|
||||
employees.Add(employee);
|
||||
}
|
||||
|
||||
return employees;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user