public TroupeInfoForm(Troupe troupe) { InitializeComponent(); this.troupe = troupe; nameTextBox.Text = troupe.Name; actorsAmountTextBox.Text = troupe.ActorsAmount.ToString(); actorsSalaryTextBox.Text = troupe.ActorsSalary.ToString(); }
private void SetTroupeSpecializationAccess(Troupe troupe) { troupe.SpecializationAccess = new List <string>(); foreach (var actorId in troupe.ActorIds) { var actor = this.Actors.FirstOrDefault(a => a.Id == actorId); if (actor.HasAmbush || actor.InfusedWithAmbush) { troupe.SpecializationAccess.Add(Asset.Specialziations.Ambush.ToString()); } if (actor.HasDisguise || actor.InfusedWithDisguise) { troupe.SpecializationAccess.Add(Asset.Specialziations.Disguise.ToString()); } if (actor.HasInfuse || actor.InfusedWithInfuse) { troupe.SpecializationAccess.Add(Asset.Specialziations.Infuse.ToString()); } if (actor.HasInvestigate || actor.InfusedWithInvestigate) { troupe.SpecializationAccess.Add(Asset.Specialziations.Investigate.ToString()); } if (actor.HasManeuver || actor.InfusedWithManeuver) { troupe.SpecializationAccess.Add(Asset.Specialziations.Maneuver.ToString()); } if (actor.HasPropagate || actor.InfusedWithPropagate) { troupe.SpecializationAccess.Add(Asset.Specialziations.Propagate.ToString()); } if (actor.HasSalvage || actor.InfusedWithSalvage) { troupe.SpecializationAccess.Add(Asset.Specialziations.Salvage.ToString()); } if (actor.HasVanish || actor.InfusedWithVanish) { troupe.SpecializationAccess.Add(Asset.Specialziations.Vanish.ToString()); } } }
private void SetTroupeStrength(long userFactionId, Troupe troupe) { troupe.Strength = 0; foreach (var actorId in troupe.ActorIds) { var actor = this.Actors.FirstOrDefault(a => a.Id == actorId); var order = Service.GetOrderOfAssetFromPerspective(userFactionId, actorId); // covert 0-value assets contribute a minimum strength of 0 if (actor.Value == 0 || !actor.Covert || order.GoingPublic || troupe.SpecializationAccess.Contains(Asset.Specialziations.Disguise.ToString()) ) { troupe.Strength += actor.Value; } else { troupe.Strength += actor.Value - 1; } } }
private void AddActorToTroupe(long userFactionId, Actor actor, Order order) { Troupe troupe = null; var scene = this.Scenes.FirstOrDefault(s => s.TargetId == order.TargetId); if (scene == null) { scene = new Scene(); scene.Load(order.TargetId); troupe = new Troupe(); troupe.Load(order.Action); troupe.ActorIds.Add(actor.Id); scene.Troupes.Add(troupe); this.Scenes.Add(scene); } else { troupe = scene.Troupes.FirstOrDefault(t => t.Action.Equals(order.Action)); if (troupe == null) { troupe = new Troupe(); troupe.Load(order.Action); troupe.ActorIds.Add(actor.Id); scene.Troupes.Add(troupe); } else { troupe.ActorIds.Add(actor.Id); } } SetTroupeSpecializationAccess(troupe); SetTroupeStrength(userFactionId, troupe); }
public TroupeInfoForm() { InitializeComponent(); troupe = new Troupe(); }
static void Main(string[] args) { using (var context = new CircusDataContext()) { context.Database.EnsureDeleted(); context.Database.EnsureCreated(); var troupe1 = new Troupe("The Flying Monkeys"); var artist1 = new Artist("Tommy BRAVE", 29, "Animal Tamer", troupe1); var artist2 = new Artist("Myriam BOLD", 27, "Animal Tamer", troupe1); var artist3 = new Artist("Luna ARMSTRONG", 24, "Trapezist", troupe1); var artist4 = new Artist("John FLEX", 24, "Acrobat", troupe1); List <Artist> artistsTroupe1 = new List <Artist>(); artistsTroupe1.Add(artist1); artistsTroupe1.Add(artist2); artistsTroupe1.Add(artist3); artistsTroupe1.Add(artist4); troupe1.Artists = artistsTroupe1; context.Add(troupe1); var troupe2 = new Troupe("The Indestructibles"); var artist5 = new Artist("Rodolph LUCK", 38, "Clown", troupe2); var artist6 = new Artist("Lionel LOSE", 21, "Clown", troupe2); var artist7 = new Artist("Larry QUICK", 27, "Magician", troupe2); var artist8 = new Artist("Arthur CLUMSY", 31, "Juggler", troupe2); List <Artist> artistsTroupe2 = new List <Artist>(); artistsTroupe2.Add(artist5); artistsTroupe2.Add(artist6); artistsTroupe2.Add(artist7); artistsTroupe2.Add(artist8); troupe2.Artists = artistsTroupe2; context.Add(troupe2); var troupe3 = new Troupe("The Dancing Moons"); var artist9 = new Artist("Lara BLIND", 23, "Tightrope Walker", troupe3); var artist10 = new Artist("Stefan SALTO", 28, "Acrobat", troupe3); var artist11 = new Artist("Georges BALLS", 25, "Juggler", troupe3); var artist12 = new Artist("Alexa FLY", 26, "Aerial Silk Acrobat", troupe3); List <Artist> artistsTroupe3 = new List <Artist>(); artistsTroupe3.Add(artist9); artistsTroupe3.Add(artist10); artistsTroupe3.Add(artist11); artistsTroupe3.Add(artist12); troupe3.Artists = artistsTroupe3; context.Add(troupe3); Event event1show1 = new Event(); event1show1.StartTime = DateTime.Now.AddDays(25).AddHours(4); event1show1.EndTime = DateTime.Now.AddDays(25).AddHours(6); Event event2show1 = new Event(); event2show1.StartTime = DateTime.Now.AddDays(30).AddHours(4); event2show1.EndTime = DateTime.Now.AddDays(30).AddHours(6); Event event3show1 = new Event(); event3show1.StartTime = DateTime.Now.AddDays(35).AddHours(4); event3show1.EndTime = DateTime.Now.AddDays(35).AddHours(6); List <Event> eventsShow1 = new List <Event>(); eventsShow1.Add(event1show1); eventsShow1.Add(event2show1); eventsShow1.Add(event3show1); Event event1show2 = new Event(); event1show2.StartTime = DateTime.Now.AddDays(20).AddHours(4); event1show2.EndTime = DateTime.Now.AddDays(20).AddHours(6); Event event2show2 = new Event(); event2show2.StartTime = DateTime.Now.AddDays(22).AddHours(4); event2show2.EndTime = DateTime.Now.AddDays(22).AddHours(6); Event event3show2 = new Event(); event3show2.StartTime = DateTime.Now.AddDays(24).AddHours(4); event3show2.EndTime = DateTime.Now.AddDays(24).AddHours(6); List <Event> eventsShow2 = new List <Event>(); eventsShow2.Add(event1show2); eventsShow2.Add(event2show2); eventsShow2.Add(event3show2); Event event1show3 = new Event(); event1show3.StartTime = DateTime.Now.AddDays(40).AddHours(4); event1show3.EndTime = DateTime.Now.AddDays(40).AddHours(6); Event event2show3 = new Event(); event2show3.StartTime = DateTime.Now.AddDays(43).AddHours(4); event2show3.EndTime = DateTime.Now.AddDays(43).AddHours(6); Event event3show3 = new Event(); event3show3.StartTime = DateTime.Now.AddDays(46).AddHours(4); event3show3.EndTime = DateTime.Now.AddDays(46).AddHours(6); List <Event> eventsShow3 = new List <Event>(); eventsShow3.Add(event1show3); eventsShow3.Add(event2show3); eventsShow3.Add(event3show3); Show show1 = new Show("Magic in the air", troupe1, "Come and see this amazing show, the most spectacular of all time, performed by talented artists.", eventsShow1, 15.90); Show show2 = new Show("In the Heart of a Sad Clown", troupe2, "Come and see this amazing show, the most spectacular of all time, performed by talented artists.", eventsShow2, 17.50); Show show3 = new Show("Over the Rainbow", troupe3, "Come and see this amazing show, the most spectacular of all time, performed by talented artists.", eventsShow3, 21.90); context.Add(show1); context.Add(show2); context.Add(show3); List <Show> manyShows1 = new List <Show>() { show1 }; List <Show> manyShows2 = new List <Show>() { show2 }; List <Show> manyShows3 = new List <Show>() { show3 }; List <ShowEvent> showEventsList1 = AssociationEventWithShow(manyShows1, eventsShow1); List <ShowEvent> showEventsList2 = AssociationEventWithShow(manyShows2, eventsShow2); List <ShowEvent> showEventsList3 = AssociationEventWithShow(manyShows3, eventsShow3); context.AddRange(showEventsList1); context.AddRange(showEventsList2); context.AddRange(showEventsList3); Ticket ticket1 = new Ticket(show1.Name, DateTime.Now.AddDays(3), DateTime.Now.AddDays(3).AddHours(2), 15.90); Ticket ticket2 = new Ticket(show2.Name, DateTime.Now.AddDays(8), DateTime.Now.AddDays(8).AddHours(2), 17.50); Ticket ticket3 = new Ticket(show3.Name, DateTime.Now.AddDays(14), DateTime.Now.AddDays(14).AddHours(2), 21.90); context.Add(ticket1); context.Add(ticket2); context.Add(ticket3); Order order1 = new Order(ticket1, 4, 63.6, DateTime.Now); Order order2 = new Order(ticket2, 2, 35, DateTime.Now); Order order3 = new Order(ticket3, 8, 175.20, DateTime.Now); context.Add(order1); context.Add(order2); context.Add(order3); context.SaveChanges();
private void RemoveActorFromTroupe(long userFactionId, Troupe troupe, long actorId) { troupe.ActorIds.Remove(actorId); SetTroupeSpecializationAccess(troupe); SetTroupeStrength(userFactionId, troupe); }
static void Main(string[] args) { Console.WriteLine("Start creation of the database"); using (var context = new CircusContext()) { context.Database.EnsureDeleted(); context.Database.EnsureCreated(); var troupe1 = new Troupe() { NameTroupe = "The Croustillants", MembersName = new List <MemberTroupe>() { new MemberTroupe { Name = "Pablo", Age = 28, Job = "Acrobate" }, new MemberTroupe { Name = "Ortencia", Age = 62, Job = "Acrobate" }, new MemberTroupe { Name = "Picasso", Age = 58, Job = "Acrobate" }, new MemberTroupe { Name = "Lolita", Age = 24, Job = "Acrobate" }, }, }; var troupe2 = new Troupe() { NameTroupe = "The Clowns", MembersName = new List <MemberTroupe>() { new MemberTroupe { Name = "Albert", Age = 28, Job = "Clown" }, new MemberTroupe { Name = "Filibert", Age = 62, Job = "Clown" }, new MemberTroupe { Name = "Gertrude", Age = 58, Job = "Clown" }, new MemberTroupe { Name = "Gaston", Age = 24, Job = "Clown" }, }, }; var show1 = new Show() { ShowName = "Vol-au-Vent", MemberTroupes = troupe1.MembersName, TroupeName = troupe1.NameTroupe, ShowType = "Acrobatics", Description = "Personnes qui volent" }; List <Show> show1List = new List <Show>(); show1List.Add(show1); troupe1.ShowsList = show1List; troupe1.ShowType = show1.ShowType; var show2 = new Show() { ShowName = "Qu'est-ce-qu'on se marre", MemberTroupes = troupe2.MembersName, TroupeName = troupe2.NameTroupe, ShowType = "Clown show", Description = "Clowns qui font rire" }; List <Show> show2List = new List <Show>(); show2List.Add(show2); troupe2.ShowsList = show2List; troupe2.ShowType = show2.ShowType; var calendar1 = new Calendar() { ShowDay = "Lundi, Jeudi, Samedi", Name = troupe1.NameTroupe, Hour = "14H-15h30" }; var calendar2 = new Calendar() { ShowDay = "Lundi, Jeudi, Samedi", Name = troupe2.NameTroupe, Hour = "16H-18h" }; troupe1.CalendarShow = calendar1; troupe2.CalendarShow = calendar2; var user1 = new User() { Name = "Gruss", Password = "******", StaffMember = false }; var user2 = new User() { Name = "Arlette", Password = "******", StaffMember = false }; var staffUser = new User() { Name = "Staff", Password = "******", StaffMember = true }; var tickets1 = new TicketOffice() { NameTroupe = troupe1.NameTroupe, ShowName = show1.ShowName, AvailableTickets = 200, SoldTickets = 10 }; var tickets2 = new TicketOffice() { NameTroupe = troupe2.NameTroupe, ShowName = show2.ShowName, AvailableTickets = 150, SoldTickets = 20 }; context.Add(troupe1); context.Add(troupe2); context.Add(calendar1); context.Add(calendar2); context.Add(show1); context.Add(show2); context.Add(user1); context.Add(user2); context.Add(staffUser); context.Add(tickets1); context.Add(tickets2); context.SaveChanges(); Console.WriteLine("End of the database creation"); GetHost(); } }