本文整理汇总了C#中MyShuttleContext类的典型用法代码示例。如果您正苦于以下问题:C# MyShuttleContext类的具体用法?C# MyShuttleContext怎么用?C# MyShuttleContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MyShuttleContext类属于命名空间,在下文中一共展示了MyShuttleContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CreateSampleData
static async Task CreateSampleData(IServiceProvider serviceProvider, MyShuttleContext context)
{
_serviceProvider = serviceProvider;
int carrierId = CreateCarrier_01(context);
await CreateDefaultUser(serviceProvider);
CreateCarriers(context);
}
开发者ID:bbs14438,项目名称:MyShuttle.biz,代码行数:7,代码来源:MyShuttleDataInitializer.cs
示例2: CreateCarriers
private static void CreateCarriers(MyShuttleContext context)
{
CreateCustomer_01(context);
CreateVehicleAndDriver_01(_DefaultCarrierId, context);
CreateVehicleAndDriver_02(_DefaultCarrierId, context);
CreateVehicleAndDriver_03(_DefaultCarrierId, context);
CreateVehicleAndDriver_04(_DefaultCarrierId, context);
CreateVehicleAndDriver_05(_DefaultCarrierId, context);
CreateVehicleAndDriver_06(_DefaultCarrierId, context);
CreateVehicleAndDriver_07(_DefaultCarrierId, context);
CreateVehicleAndDriver_08(_DefaultCarrierId, context);
CreateVehicleAndDriver_09(_DefaultCarrierId, context);
CreateVehicleAndDriver_10(_DefaultCarrierId, context);
CreateVehicleAndDriver_11(_DefaultCarrierId, context);
CreateVehicleAndDriver_12(_DefaultCarrierId, context);
CreateVehicleAndDriver_13(_DefaultCarrierId, context);
CreateVehicleAndDriver_14(_DefaultCarrierId, context);
CreateVehicleAndDriver_15(_DefaultCarrierId, context);
CreateVehicleAndDriver_16(_DefaultCarrierId, context);
CreateVehicleAndDriver_17(_DefaultCarrierId, context);
CreateVehicleAndDriver_18(_DefaultCarrierId, context);
CreateVehicleAndDriver_19(_DefaultCarrierId, context);
var carrierId_02 = CreateCarrier_02(context);
CreateVehicleAndDriver_20(carrierId_02, context);
CreateVehicleAndDriver_21(carrierId_02, context);
CreateCarrier_03(context);
CreateCarrier_04(context);
CreateCarrier_05(context);
CreateCarrier_06(context);
CreateCarrier_07(context);
CreateCarrier_08(context);
CreateDrivers(_DefaultCarrierId, context);
CreateRides(_DefaultCarrierId, context);
}
开发者ID:bbs14438,项目名称:MyShuttle.biz,代码行数:39,代码来源:MyShuttleDataInitializer.cs
示例3: CreateVehicleAndDriver_18
private static void CreateVehicleAndDriver_18(int carrierId, MyShuttleContext context)
{
var driver = new Driver
{
Name = "Ibon Campa",
Phone = "555-48970",
Picture = GetNoMsDriver(10),
CarrierId = carrierId,
RatingAvg = 2,
TotalRides = Randomize.Next(50, 100),
};
context.Drivers.Add(driver);
context.SaveChanges();
var vehicle = new Vehicle
{
LicensePlate = "RTY-2345",
Model = "Riviera",
Make = "Buick",
Type = VehicleType.Luxury,
Seats = 7,
VehicleStatus = VehicleStatus.Occupied,
DriverId = driver.DriverId,
Picture = GetVehicle(18),
Latitude = 47.641944,
Longitude = -122.187212,
CarrierId = carrierId,
Rate = Randomize.Next(1, 5),
RatingAvg = Randomize.Next(0, 5),
TotalRides = Randomize.Next(50, 100),
DeviceId = "deviceVehicleLED"
};
context.Vehicles.Add(vehicle);
context.SaveChanges();
}
开发者ID:bbs14438,项目名称:MyShuttle.biz,代码行数:36,代码来源:MyShuttleDataInitializer.cs
示例4: DriverRepository
public DriverRepository(MyShuttleContext dbcontext)
{
_context = dbcontext;
}
开发者ID:bbs14438,项目名称:MyShuttle.biz,代码行数:4,代码来源:DriverRepository.cs
示例5: RidesRepository
public RidesRepository(MyShuttleContext dbcontext)
{
_context = dbcontext;
}
开发者ID:bbs14438,项目名称:MyShuttle.biz,代码行数:4,代码来源:RidesRepository.cs
示例6: CreateVehicleAndDriver_15
private static void CreateVehicleAndDriver_15(int carrierId, MyShuttleContext context)
{
var driver = new Driver
{
Name = "Austin Lumbert",
Phone = "555-48970",
Picture = GetNoMsDriver(5),
CarrierId = carrierId,
RatingAvg = 2,
TotalRides = Randomize.Next(50, 100),
};
context.Drivers.Add(driver);
context.SaveChanges();
var vehicle = new Vehicle
{
LicensePlate = "OUJ-6182",
Model = "G5",
Make = "Pontiac",
Type = VehicleType.Luxury,
Seats = 7,
VehicleStatus = VehicleStatus.Occupied,
DriverId = driver.DriverId,
Picture = GetVehicle(15),
Latitude = 47.641950,
Longitude = -122.167222,
CarrierId = carrierId,
Rate = Randomize.Next(1, 5),
RatingAvg = Randomize.Next(0, 5),
TotalRides = Randomize.Next(50, 100),
DeviceId = string.Empty
};
context.Vehicles.Add(vehicle);
context.SaveChanges();
}
开发者ID:bbs14438,项目名称:MyShuttle.biz,代码行数:36,代码来源:MyShuttleDataInitializer.cs
示例7: CreateVehicleAndDriver_11
private static void CreateVehicleAndDriver_11(int carrierId, MyShuttleContext context)
{
var driver = new Driver
{
Name = "James Rodriguez",
Phone = "555-48970",
Picture = GetNoMsDriver(1),
CarrierId = carrierId,
RatingAvg = 2,
TotalRides = Randomize.Next(50, 100),
};
context.Drivers.Add(driver);
context.SaveChanges();
var vehicle = new Vehicle
{
LicensePlate = "WWW-1256",
Model = "Dart",
Make = "Dodge",
Type = VehicleType.Luxury,
Seats = 7,
VehicleStatus = VehicleStatus.Occupied,
DriverId = driver.DriverId,
Picture = GetVehicle(11),
Latitude = 47.642944,
Longitude = -122.128222,
CarrierId = carrierId,
Rate = Randomize.Next(1, 5),
RatingAvg = Randomize.Next(0, 5),
TotalRides = Randomize.Next(50, 100),
DeviceId = "deviceVehicleSIM"
};
context.Vehicles.Add(vehicle);
context.SaveChanges();
}
开发者ID:bbs14438,项目名称:MyShuttle.biz,代码行数:36,代码来源:MyShuttleDataInitializer.cs
示例8: CreateVehicleAndDriver_08
private static void CreateVehicleAndDriver_08(int carrierId, MyShuttleContext context)
{
var driver = new Driver
{
Name = "Rob Caron",
Phone = "555-48970",
Picture = GetDriver(8),
CarrierId = carrierId,
RatingAvg = Randomize.Next(0, 3),
TotalRides = Randomize.Next(50, 100),
};
context.Drivers.Add(driver);
context.SaveChanges();
var vehicle = new Vehicle
{
LicensePlate = "HTY-1243",
Model = "ELR",
Make = "Cadilac",
Type = VehicleType.Van,
Seats = 7,
VehicleStatus = VehicleStatus.Occupied,
DriverId = driver.DriverId,
Picture = GetVehicle(8),
Latitude = 47.621954,
Longitude = -122.127212,
CarrierId = carrierId,
Rate = Randomize.Next(1, 5),
RatingAvg = Randomize.Next(0, 5),
TotalRides = Randomize.Next(50, 100),
DeviceId = "HTY-1243",
};
context.Vehicles.Add(vehicle);
context.SaveChanges();
}
开发者ID:bbs14438,项目名称:MyShuttle.biz,代码行数:36,代码来源:MyShuttleDataInitializer.cs
示例9: CreateCarrier_08
static int CreateCarrier_08(MyShuttleContext context)
{
var carrier = new Carrier
{
Name = "Threeangle",
Description = "Threeangle is your best option of available carriers-.",
CompanyID = "03-00-00427-CV",
Address = "3956 Broadway, New York, NY 10032 (212)",
ZipCode = "568-3700",
City = "New York City",
State = "New York",
Country = "USA",
Phone = "555-FAST&CALM",
Email = "[email protected]",
Picture = GetCarrier(8),
RatingAvg = Randomize.Next(0, 5),
};
context.Carriers.Add(carrier);
context.SaveChanges();
return carrier.CarrierId;
}
开发者ID:bbs14438,项目名称:MyShuttle.biz,代码行数:24,代码来源:MyShuttleDataInitializer.cs
示例10: CreateCarrier_01
static int CreateCarrier_01(MyShuttleContext context)
{
var carrier = new Carrier
{
Name = "James&McCarthy",
Description = "James&McCarthy is your best option of available carriers, and you know it!",
CompanyID = "03-00-00427-CV",
Address = "3956 Broadway, New York, NY 10032 (212)",
ZipCode = "568-3700",
City = "New York City",
State = "New York",
Country = "USA",
Phone = "555-567",
Email = "[email protected]",
Picture = GetCarrier(3),
RatingAvg = Randomize.Next(0, 5),
};
context.Carriers.Add(carrier);
context.SaveChanges();
return carrier.CarrierId;
}
开发者ID:bbs14438,项目名称:MyShuttle.biz,代码行数:23,代码来源:MyShuttleDataInitializer.cs
示例11: CreateEmployees
static void CreateEmployees(int customerId, MyShuttleContext context)
{
int employeeId = 0;
if (context.Employees.Any())
employeeId = context.Employees.Max(e => e.EmployeeId);
var employees = new List<Employee>()
{
new Employee
{
Id = "90a0d28b-4342-40d5-92b6-af2d0ea7630b",
CustomerId = customerId,
Email = "[email protected]",
Name = "Scott Hanselman",
Picture = GetEmplyoyee(1),
},
new Employee
{
Id = "bbe41151-abfa-42da-80c1-91a56cad538f",
CustomerId = customerId,
Email = "[email protected]",
Name = "Mitra Azizirad",
Picture = GetEmplyoyee(2),
},
new Employee
{
Id = "c7a9c8a2-a5e3-48d4-99e4-4117599af048",
CustomerId = customerId,
Email = "[email protected]",
Name = "Amanda Silver",
Picture = GetEmplyoyee(3),
},
new Employee
{
Id = "4e6767fb-a723-4ce0-9547-f0d349658f9d",
CustomerId = customerId,
Email = "[email protected]",
Name = "Nicole Herskowitz",
Picture = GetEmplyoyee(4),
},
new Employee
{
Id = "b9b62397-7c1b-4fb8-898f-a9bbc0234fdf",
CustomerId = customerId,
Email = "[email protected]",
Name = "Scott Guthrie",
Picture = GetDriver(10),
}
};
context.Employees.AddRange(employees.ToArray<Employee>());
context.SaveChanges();
}
开发者ID:bbs14438,项目名称:MyShuttle.biz,代码行数:53,代码来源:MyShuttleDataInitializer.cs
示例12: CreateRides
private static void CreateRides(int carrierId, MyShuttleContext context)
{
var employeeList = context.Employees.Select(e => e.EmployeeId).ToList();
var rides = new List<Ride>();
int rideId = 0;
if (context.Rides.Any())
rideId = context.Rides.Max(e => e.RideId);
foreach (Vehicle vehicle in context.Vehicles)
{
var startDateTime01 = DateTime.UtcNow.AddDays(-Randomize.Next(15, 30));
var startDateTime02 = DateTime.UtcNow.AddDays(-Randomize.Next(15, 30));
var startDateTime03 = DateTime.UtcNow.AddDays(-Randomize.Next(0, 15));
var startDateTime04 = DateTime.UtcNow.AddDays(-Randomize.Next(0, 15));
var startDateTime05 = DateTime.UtcNow.AddDays(-Randomize.Next(10, 20));
var startDateTime06 = DateTime.UtcNow.AddDays(-Randomize.Next(0, 10));
var distance = Randomize.Next(20, 40);
var endTime = startDateTime01.AddMinutes(3 * distance);
var duration = distance * 3;
var cost = distance * vehicle.Rate;
var ride = new Ride
{
Id = Guid.NewGuid().ToString(),
StartDateTime = startDateTime01,
EndDateTime = endTime,
VehicleId = vehicle.VehicleId,
DriverId = vehicle.DriverId,
Cost = cost,
EmployeeId = employeeList[Randomize.Next(0, employeeList.Count() - 1)],
Comments = string.Empty,
CarrierId = carrierId,
Distance = distance,
Duration = duration,
Rating = Randomize.Next(3, 5),
Signature = null,
StartAddress = "Madison Ave 10037",
EndAddress = "217 Broadway",
StartLatitude = 40.721847,
StartLongitude = -74.007326,
EndLatitude = 40.721847,
EndLongitude = -74.007326,
};
rides.Add(ride);
distance = Randomize.Next(20, 40);
endTime = startDateTime02.AddMinutes(3 * distance);
duration = distance * 3;
cost = distance * vehicle.Rate;
ride = new Ride
{
Id = Guid.NewGuid().ToString(),
StartDateTime = startDateTime02,
EndDateTime = endTime,
VehicleId = vehicle.VehicleId,
DriverId = vehicle.DriverId,
Cost = cost,
EmployeeId = employeeList[Randomize.Next(0, employeeList.Count() - 1)],
Comments = string.Empty,
CarrierId = carrierId,
Distance = distance,
Duration = 20,
Rating = Randomize.Next(3, 5),
Signature = null,
StartAddress = "217 Broadway",
EndAddress = "E 156th St, Bronx",
StartLatitude = 40.721847,
StartLongitude = -74.007326,
EndLatitude = 40.721847,
EndLongitude = -74.007326,
};
rides.Add(ride);
distance = Randomize.Next(20, 40);
endTime = startDateTime03.AddMinutes(3 * distance);
duration = distance * 3;
cost = distance * vehicle.Rate;
ride = new Ride
{
Id = Guid.NewGuid().ToString(),
StartDateTime = startDateTime03,
EndDateTime = endTime,
VehicleId = vehicle.VehicleId,
DriverId = vehicle.DriverId,
Cost = cost,
EmployeeId = employeeList[Randomize.Next(0, employeeList.Count() - 1)],
Comments = string.Empty,
CarrierId = carrierId,
Distance = distance,
Duration = duration,
Rating = Randomize.Next(2, 5),
Signature = null,
StartAddress = "54 Fulton St",
EndAddress = "E 156th St, Bronx",
//.........这里部分代码省略.........
开发者ID:bbs14438,项目名称:MyShuttle.biz,代码行数:101,代码来源:MyShuttleDataInitializer.cs
示例13: CreateVehicleAndDriver_21
private static void CreateVehicleAndDriver_21(int carrierId, MyShuttleContext context)
{
var driver = new Driver
{
Name = "Andry Jackson",
Phone = "555-48970",
Picture = GetNoMsDriver(11),
CarrierId = carrierId,
RatingAvg = 2,
TotalRides = Randomize.Next(50, 100),
};
context.Drivers.Add(driver);
context.SaveChanges();
var vehicle = new Vehicle
{
LicensePlate = "WIE-4545",
Model = "Grand Prix",
Make = "Pontiac",
Type = VehicleType.Luxury,
Seats = 7,
VehicleStatus = VehicleStatus.Occupied,
DriverId = driver.DriverId,
Picture = GetVehicle(21),
Latitude = 47.641944,
Longitude = -122.327252,
CarrierId = carrierId,
Rate = Randomize.Next(1, 5),
RatingAvg = Randomize.Next(0, 5),
TotalRides = Randomize.Next(50, 100),
DeviceId = string.Empty
};
context.Vehicles.Add(vehicle);
context.SaveChanges();
}
开发者ID:bbs14438,项目名称:MyShuttle.biz,代码行数:36,代码来源:MyShuttleDataInitializer.cs
示例14: CreateCustomer_01
static void CreateCustomer_01(MyShuttleContext context)
{
var customer = new Customer
{
Address = "15010 NE 36th Street",
City = "Redmond",
Country = "United States",
CompanyID = "1234-344",
Email = "[email protected]",
Name = "Microsoft",
Phone = "555-555-555",
State = "Washington",
ZipCode = "98052"
};
context.Customers.Add(customer);
context.SaveChanges();
CreateEmployees(customer.CustomerId, context);
}
开发者ID:bbs14438,项目名称:MyShuttle.biz,代码行数:20,代码来源:MyShuttleDataInitializer.cs
示例15: CreateVehicleAndDriver_19
private static void CreateVehicleAndDriver_19(int carrierId, MyShuttleContext context)
{
var driver = new Driver
{
Name = "Carlos Rodriguez",
Phone = "555-48970",
Picture = GetNoMsDriver(9),
CarrierId = carrierId,
RatingAvg = 2,
TotalRides = Randomize.Next(50, 100),
};
context.Drivers.Add(driver);
context.SaveChanges();
var vehicle = new Vehicle
{
LicensePlate = "ERT-2345",
Model = "Impala LTZ",
Make = "Chevrolet",
Type = VehicleType.Luxury,
Seats = 7,
VehicleStatus = VehicleStatus.Occupied,
DriverId = driver.DriverId,
Picture = GetVehicle(19),
Latitude = 47.641944,
Longitude = -122.197232,
CarrierId = carrierId,
Rate = Randomize.Next(1, 5),
RatingAvg = Randomize.Next(0, 5),
TotalRides = Randomize.Next(50, 100),
DeviceId = string.Empty
};
context.Vehicles.Add(vehicle);
context.SaveChanges();
}
开发者ID:bbs14438,项目名称:MyShuttle.biz,代码行数:36,代码来源:MyShuttleDataInitializer.cs
示例16: CreateVehicleAndDriver_06
private static void CreateVehicleAndDriver_06(int carrierId, MyShuttleContext context)
{
var driver = new Driver
{
Name = "Erich Gamma",
Phone = "555-48970",
Picture = GetDriver(6),
CarrierId = carrierId,
RatingAvg = Randomize.Next(0, 3),
TotalRides = Randomize.Next(50, 100),
};
context.Drivers.Add(driver);
context.SaveChanges();
var vehicle = new Vehicle
{
LicensePlate = "ZUA-1456",
Model = "Caprice PPV",
Make = "Chevrolet",
Type = VehicleType.Van,
Seats = 7,
VehicleStatus = VehicleStatus.Free,
DriverId = driver.DriverId,
Picture = GetVehicle(6),
Latitude = 47.631935,
Longitude = -122.127222,
CarrierId = carrierId,
Rate = Randomize.Next(1, 5),
RatingAvg = Randomize.Next(0, 5),
TotalRides = Randomize.Next(50, 100),
DeviceId = "CUA-1456",
};
context.Vehicles.Add(vehicle);
context.SaveChanges();
}
开发者ID:bbs14438,项目名称:MyShuttle.biz,代码行数:36,代码来源:MyShuttleDataInitializer.cs
示例17: CreateVehicleAndDriver_07
private static void CreateVehicleAndDriver_07(int carrierId, MyShuttleContext context)
{
var driver = new Driver
{
Name = "Mitra Azizirad",
Phone = "555-48970",
Picture = GetDriver(7),
CarrierId = carrierId,
RatingAvg = 4.6,
TotalRides = Randomize.Next(50, 100),
};
context.Drivers.Add(driver);
context.SaveChanges();
var vehicle = new Vehicle
{
LicensePlate = "JOP-9876",
Model = "BLS",
Make = "Cadillac",
Type = VehicleType.Van,
Seats = 7,
VehicleStatus = VehicleStatus.Occupied,
DriverId = driver.DriverId,
Picture = GetVehicle(7),
Latitude = 47.631915,
Longitude = -122.127221,
CarrierId = carrierId,
Rate = Randomize.Next(1, 5),
RatingAvg = Randomize.Next(0, 5),
TotalRides = Randomize.Next(50, 100),
DeviceId = "JOP-9876",
};
context.Vehicles.Add(vehicle);
context.SaveChanges();
}
开发者ID:bbs14438,项目名称:MyShuttle.biz,代码行数:36,代码来源:MyShuttleDataInitializer.cs
示例18: CreateDrivers
private static void CreateDrivers(int carrierId, MyShuttleContext context)
{
var drivers = new List<Driver>()
{
new Driver
{
Name = "Carlos Zimmermann",
Phone = "555-178895",
Picture = GetDriver(11),
CarrierId = carrierId,
RatingAvg = Randomize.Next(0, 5),
TotalRides = Randomize.Next(50, 100),
},
new Driver
{
Name = "Andrew Davis",
Phone = "555-178895",
Picture = GetDriver(12),
CarrierId = carrierId,
RatingAvg = Randomize.Next(0, 5),
TotalRides = Randomize.Next(50, 100),
},
new Driver
{
Name = "Carolina Anderson",
Phone = "555-178895",
Picture = GetDriver(13),
CarrierId = carrierId,
RatingAvg = Randomize.Next(0, 5),
TotalRides = Randomize.Next(50, 100),
},
new Driver
{
Name = "Julian Thomas",
Phone = "555-178895",
Picture = GetDriver(14),
CarrierId = carrierId,
RatingAvg = Randomize.Next(0, 5),
TotalRides = Randomize.Next(50, 100),
}
};
context.Drivers.AddRange(drivers.ToArray<Driver>());
context.SaveChanges();
}
开发者ID:bbs14438,项目名称:MyShuttle.biz,代码行数:46,代码来源:MyShuttleDataInitializer.cs
示例19: CreateVehicleAndDriver_09
private static void CreateVehicleAndDriver_09(int carrierId, MyShuttleContext context)
{
var driver = new Driver
{
Name = "S. Somasegar",
Phone = "555-48970",
Picture = GetDriver(9),
CarrierId = carrierId,
RatingAvg = Randomize.Next(0, 3),
TotalRides = Randomize.Next(50, 100),
};
context.Drivers.Add(driver);
context.SaveChanges();
var vehicle = new Vehicle
{
LicensePlate = "VVV-4444",
Model = "AveoLT",
Make = "Chevrolet",
Type = VehicleType.Van,
Seats = 7,
VehicleStatus = VehicleStatus.Free,
DriverId = driver.DriverId,
Picture = GetVehicle(9),
Latitude = 47.641964,
Longitude = -122.127212,
CarrierId = carrierId,
Rate = Randomize.Next(1, 5),
RatingAvg = Randomize.Next(0, 5),
TotalRides = Randomize.Next(50, 100),
DeviceId = "VVV-4444",
};
context.Vehicles.Add(vehicle);
context.SaveChanges();
}
开发者ID:bbs14438,项目名称:MyShuttle.biz,代码行数:36,代码来源:MyShuttleDataInitializer.cs
示例20: CreateVehicleAndDriver_01
private static void CreateVehicleAndDriver_01(int carrierId, MyShuttleContext context)
{
var driver = new Driver
{
Name = "Cesar de la Torre",
Phone = "555-178895",
Picture = GetDriver(1),
CarrierId = carrierId,
RatingAvg = 4.5,
TotalRides = Randomize.Next(50, 100),
};
context.Drivers.Add(driver);
context.SaveChanges();
var vehicle = new Vehicle
{
LicensePlate = "SLV-4335",
Model = "Pacifica",
Make = "Chrysler",
Type = VehicleType.Compact,
Seats = 4,
VehicleStatus = VehicleStatus.Occupied,
DriverId = driver.DriverId,
CarrierId = carrierId,
Picture = GetVehicle(1),
Latitude = 47.621931,
Longitude = -122.127232,
Rate = Randomize.Next(1, 5),
RatingAvg = Randomize.Next(0, 5),
TotalRides = Randomize.Next(50, 100),
DeviceId = "SLV-4335",
};
context.Vehicles.Add(vehicle);
context.SaveChanges();
}
开发者ID:bbs14438,项目名称:MyShuttle.biz,代码行数:36,代码来源:MyShuttleDataInitializer.cs
注:本文中的MyShuttleContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论