Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void SeedTickets()
- {
- try
- {
- List<Projection> listProjection = Projection.All();
- List<User> listUsers = User.All();
- List<Ticket> list = new List<Ticket> ( )
- {
- // new Ticket(listProjection[Methods.GetRandomInt(0,listProjection.Count-1)].ProjectionId, listUsers[Methods.GetRandomInt(0,listUsers.Count-1)].UserId, Methods.GetRandomInt(300,700), Methods.GetRandomInt(0,5), Methods.GetRandomInt(0,10)),
- // new Ticket(listProjection[Methods.GetRandomInt(0,listProjection.Count-1)].ProjectionId, listUsers[Methods.GetRandomInt(0,listUsers.Count-1)].UserId, Methods.GetRandomInt(300,700), Methods.GetRandomInt(0,5), Methods.GetRandomInt(0,10)),
- // new Ticket(listProjection[Methods.GetRandomInt(0,listProjection.Count-1)].ProjectionId, listUsers[Methods.GetRandomInt(0,listUsers.Count-1)].UserId, Methods.GetRandomInt(300,700), Methods.GetRandomInt(0,5), Methods.GetRandomInt(0,10)),
- // new Ticket(listProjection[Methods.GetRandomInt(0,listProjection.Count-1)].ProjectionId, listUsers[Methods.GetRandomInt(0,listUsers.Count-1)].UserId, Methods.GetRandomInt(300,700), Methods.GetRandomInt(0,5), Methods.GetRandomInt(0,10)),
- // new Ticket(listProjection[Methods.GetRandomInt(0,listProjection.Count-1)].ProjectionId, listUsers[Methods.GetRandomInt(0,listUsers.Count-1)].UserId, Methods.GetRandomInt(300,700), Methods.GetRandomInt(0,5), Methods.GetRandomInt(0,10))
- //
- //
- new Ticket(listProjection[Methods.GetRandomInt(0,listProjection.Count-1)].ProjectionId, listUsers[0].UserId, Methods.GetRandomInt(300,700), Methods.GetRandomInt(0,5), Methods.GetRandomInt(0,10)),
- new Ticket(listProjection[Methods.GetRandomInt(0,listProjection.Count-1)].ProjectionId, listUsers[0].UserId, Methods.GetRandomInt(300,700), Methods.GetRandomInt(0,5), Methods.GetRandomInt(0,10)),
- new Ticket(listProjection[Methods.GetRandomInt(0,listProjection.Count-1)].ProjectionId, listUsers[0].UserId, Methods.GetRandomInt(300,700), Methods.GetRandomInt(0,5), Methods.GetRandomInt(0,10)),
- new Ticket(listProjection[Methods.GetRandomInt(0,listProjection.Count-1)].ProjectionId, listUsers[0].UserId, Methods.GetRandomInt(300,700), Methods.GetRandomInt(0,5), Methods.GetRandomInt(0,10)),
- new Ticket(listProjection[Methods.GetRandomInt(0,listProjection.Count-1)].ProjectionId, listUsers[0].UserId, Methods.GetRandomInt(300,700), Methods.GetRandomInt(0,5), Methods.GetRandomInt(0,10))
- };
- if ( Serialization.isEmpty( Serialization.TiFile ) ){
- Console.WriteLine( "File is not exist. It will be created!" );
- }
- else{
- Console.WriteLine("File is exist! It will be recreated!");
- }
- Console.WriteLine( "Writing... \n" );
- Serialization.WriteListToBinaryFile<Ticket>( Serialization.TiFile , list , false );
- }
- catch ( Exception ex ){
- Console.WriteLine(ex.ToString());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement