public MyObjectBuilder_Faction GetObjectBuilder() { var builder = new MyObjectBuilder_Faction(); builder.FactionId = FactionId; builder.Tag = Tag; builder.Name = Name; builder.Description = Description; builder.PrivateInfo = PrivateInfo; builder.AutoAcceptMember = AutoAcceptMember; builder.AutoAcceptPeace = AutoAcceptPeace; builder.EnableFriendlyFire = EnableFriendlyFire; builder.Members = new List <MyObjectBuilder_FactionMember>(Members.Count()); foreach (var member in Members) { builder.Members.Add(member.Value); } builder.JoinRequests = new List <MyObjectBuilder_FactionMember>(JoinRequests.Count()); foreach (var request in JoinRequests) { builder.JoinRequests.Add(request.Value); } return(builder); }
public string GetHtml() { var baseDirectory = AppDomain.CurrentDomain.BaseDirectory; var path = Path.Combine(baseDirectory, "ReportTemplate.html"); var template = File.ReadAllText(path); var assemblyName = GetAssemblyNameAndVersion(AssemblyName); var documented = Members.Count(m => m.IsPublic && m.IsDocumented); var undocumented = Members.Where(m => m.IsPublic && !m.IsDocumented && m.Type != MemberTypes.Constructor).ToList(); undocumented.Sort(); var undocumentedCount = undocumented.Count; var coverage = (double)documented / (documented + undocumentedCount); var memberPath = Path.Combine(baseDirectory, "MemberTemplate.html"); var memberTemplate = File.ReadAllText(memberPath); var membersList = undocumented.Count > 0 ? undocumented.Select(m => string.Format(memberTemplate, m.Name)) : new List <string> { "N/A" }; var membersHtml = string.Join(string.Empty, membersList); var generatorAssemblyName = Assembly.GetExecutingAssembly().GetName(); var generator = GetAssemblyNameAndVersion(generatorAssemblyName); var html = string.Format(template, assemblyName, DateTime.Now, documented, undocumentedCount, coverage, membersHtml, generator); return(html); }
private double CountToStringEqualsHashCode() { return(Members.Count(m => m.Type.Equals(CaDETMemberType.Method) && ( m.Name.Contains("tostring", StringComparison.CurrentCultureIgnoreCase) || m.Name.Contains("equals", StringComparison.CurrentCultureIgnoreCase) || m.Name.Contains("hashcode", StringComparison.CurrentCultureIgnoreCase)))); }
public double GetCoverage() { var documented = Members.Count(m => m.IsPublic && m.Type != MemberTypes.Constructor && m.IsDocumented); var total = Members.Count(m => m.IsPublic && m.Type != MemberTypes.Constructor); return((double)documented / total); }
public bool IsDataClass() { double numOfAccessors = Members.Count(m => m.IsFieldDefiningAccessor()); double numOfConstructors = Members.Count(m => m.Type.Equals(CaDETMemberType.Constructor)); double numOfObjectOverrides = CountToStringEqualsHashCode(); //TODO: Create a more elegant solution for thresholds. double dataClassThreshold = 0.9; return((numOfAccessors + numOfConstructors + numOfObjectOverrides) / Members.Count > dataClassThreshold); }
public GroupVM(string key, List <UserVM> list) { this.GroupName = key; this.Members = list; if (Members.Count() != 0) { this.TotalPoints = (int)this.Members.Sum(m => m.Points); this.Points = this.TotalPoints / this.Members.Count(); } }
public ShaderType(StructParameter structParameter, ShaderGpuProgramType programType) { Members.AddRange(structParameter.VectorMembers.Select(p => new ShaderTypeMember(p, programType))); Members.AddRange(structParameter.MatrixMembers.Select(p => new ShaderTypeMember(p, programType))); Members = Members .OrderBy(v => v.Index) .ToList(); ShaderVariableClass = ShaderVariableClass.Struct; //TODO: matrix colums or rows? ShaderVariableType = ShaderVariableType.Void; Rows = 0; Columns = 0; ElementCount = 0; MemberCount = (ushort)Members.Count(); MemberOffset = 0; m_programType = programType; }
internal bool CanAdd() { var max = Master.Player.Character.Level / 10; if (Master.Player.Character.BaseClass == HeroClass.DarkLord) { max += Master.Player.Character.CommandTotal / 10; } if (max > 100) { max = 100; } return(max > Members.Count()); }
public override string ToString() { int active = Members.Count(e => e.Item1.Status == SiloStatus.Active); int dead = Members.Count(e => e.Item1.Status == SiloStatus.Dead); int created = Members.Count(e => e.Item1.Status == SiloStatus.Created); int joining = Members.Count(e => e.Item1.Status == SiloStatus.Joining); int shuttingDown = Members.Count(e => e.Item1.Status == SiloStatus.ShuttingDown); int stopping = Members.Count(e => e.Item1.Status == SiloStatus.Stopping); string otherCounts = String.Format("{0}{1}{2}{3}", created > 0 ? (", " + created + " are Created") : "", joining > 0 ? (", " + joining + " are Joining") : "", shuttingDown > 0 ? (", " + shuttingDown + " are ShuttingDown") : "", stopping > 0 ? (", " + stopping + " are Stopping") : ""); return(string.Format("{0} silos, {1} are Active, {2} are Dead{3}, Version={4}. All silos: {5}", Members.Count, active, dead, otherCounts, Version, Utils.EnumerableToString(Members, tuple => tuple.Item1.ToFullString()))); }
public override string ToString() => $"{GetType().Name}: Members={Members.Count()}";
public int CountMembersForTour(int tour) { // count the pilots for this tour. return(Members.Count(squadMember => WasPilotInSquadForThisTour(tour, squadMember))); }
public int MemberCount() { return(Members.Count()); }
internal int ClearOfflineMembers() { return(Members.Count(mem => mem.Value.Status == Status.Offline)); }
public void SeedData() { if (Members.Count() == 0 && Prices.Count() == 0 && Competitions.Count() == 0 && Threads.Count() == 0 && Posts.Count() == 0) { Console.Write("Seeding Opening Hours... "); CreateOpeningTime(0, 7, 19); CreateOpeningTime(1, 8, 20); CreateOpeningTime(2, 8, 20); CreateOpeningTime(3, 8, 20); CreateOpeningTime(4, 8, 21); CreateOpeningTime(5, 13, 22); CreateOpeningTime(6, 13, 22); Console.WriteLine("ok"); SaveChanges(); Console.Write("Seeding members... "); var admin = CreateMember("admin", "admin", "", "", "*****@*****.**", new DateTime(1980, 01, 01), Role.Admin, "admin.jpg"); var ben = CreateMember("ben", "ben", "Benoit", "Penelle", "*****@*****.**", new DateTime(1980, 01, 01), Role.Professor, "ben.jpg"); var bruno = CreateMember("bruno", "bruno", "Bruno", "Lacroix", "*****@*****.**", new DateTime(1980, 01, 01), Role.Professor, "donald.jpg"); var quentin = CreateMember("quentin", "quentin", "Quentin", "Locht", "*****@*****.**", new DateTime(1995, 01, 01), Role.Climber, "Quentin.jpg"); var gautier = CreateMember("gautier", "gautier", "Gautier", "Kiss", "*****@*****.**", new DateTime(1996, 01, 01), Role.Climber, "Gautier.jpg"); var guillaume = CreateMember("guillaume", "guillaume", "Guillaume", "Rigaux", "*****@*****.**", new DateTime(1997, 01, 01), Role.Climber, "Guillaume.jpg"); Console.WriteLine("ok"); SaveChanges(); Console.Write("Seeding prices... "); // Prix pour les competitions Price comp8140 = CreatePrice(PassType.Competition, SubscriptionType.DailyPass, "08-14", 2); Price comp14180 = CreatePrice(PassType.Competition, SubscriptionType.DailyPass, "14-18", 5); Price comp18990 = CreatePrice(PassType.Competition, SubscriptionType.DailyPass, "18-99", 7); Price comp8141 = CreatePrice(PassType.Competition, SubscriptionType.WeeklyPass, "08-14", 8); Price comp14181 = CreatePrice(PassType.Competition, SubscriptionType.WeeklyPass, "14-18", 13); Price comp18991 = CreatePrice(PassType.Competition, SubscriptionType.WeeklyPass, "18-99", 15); Price comp8142 = CreatePrice(PassType.Competition, SubscriptionType.MonthlyPass, "08-14", 10); Price comp14182 = CreatePrice(PassType.Competition, SubscriptionType.MonthlyPass, "14-18", 20); Price comp18992 = CreatePrice(PassType.Competition, SubscriptionType.MonthlyPass, "18-99", 25); Price comp8143 = CreatePrice(PassType.Competition, SubscriptionType.QuarterlyPass, "08-14", 28); Price comp14183 = CreatePrice(PassType.Competition, SubscriptionType.QuarterlyPass, "14-18", 55); Price comp18993 = CreatePrice(PassType.Competition, SubscriptionType.QuarterlyPass, "18-99", 65); Price comp8144 = CreatePrice(PassType.Competition, SubscriptionType.YearlyPass, "08-14", 110); Price comp14184 = CreatePrice(PassType.Competition, SubscriptionType.YearlyPass, "14-18", 130); Price comp18994 = CreatePrice(PassType.Competition, SubscriptionType.YearlyPass, "18-99", 150); // Prix pour les abonnements des 0-10 ans Price sub0010Daily = CreatePrice(PassType.Pass, SubscriptionType.DailyPass, "0-10", 7); Price sub0010Weekly = CreatePrice(PassType.Pass, SubscriptionType.WeeklyPass, "0-10", 25); Price sub0010Monthly = CreatePrice(PassType.Pass, SubscriptionType.MonthlyPass, "0-10", 40); Price sub0010Quarterly = CreatePrice(PassType.Pass, SubscriptionType.QuarterlyPass, "0-10", 100); Price sub0010Yearly = CreatePrice(PassType.Pass, SubscriptionType.YearlyPass, "0-10", 250); // Prix pour les abonnements des 11-15 ans Price sub1115Daily = CreatePrice(PassType.Pass, SubscriptionType.DailyPass, "11-15", 9); Price sub1115Weekly = CreatePrice(PassType.Pass, SubscriptionType.WeeklyPass, "11-15", 30); Price sub1115Monthly = CreatePrice(PassType.Pass, SubscriptionType.MonthlyPass, "11-15", 51); Price sub1115Quarterly = CreatePrice(PassType.Pass, SubscriptionType.QuarterlyPass, "11-15", 128); Price sub1115Yearly = CreatePrice(PassType.Pass, SubscriptionType.YearlyPass, "11-15", 320); // Prix pour les abonnements des 16-21 ans Price sub1621Daily = CreatePrice(PassType.Pass, SubscriptionType.DailyPass, "16-21", 11); Price sub1621Weekly = CreatePrice(PassType.Pass, SubscriptionType.WeeklyPass, "16-21", 40); Price sub1621Monthly = CreatePrice(PassType.Pass, SubscriptionType.MonthlyPass, "16-21", 63); Price sub1621Quarterly = CreatePrice(PassType.Pass, SubscriptionType.QuarterlyPass, "16-21", 157); Price sub1621Yearly = CreatePrice(PassType.Pass, SubscriptionType.YearlyPass, "16-21", 393); // Prix pour les abonnements des 21-99 ans Price sub2199Daily = CreatePrice(PassType.Pass, SubscriptionType.DailyPass, "21-99", 15); Price sub2199Weekly = CreatePrice(PassType.Pass, SubscriptionType.WeeklyPass, "21-99", 50); Price sub2199Monthly = CreatePrice(PassType.Pass, SubscriptionType.MonthlyPass, "21-99", 85); Price sub2199Quarterly = CreatePrice(PassType.Pass, SubscriptionType.QuarterlyPass, "21-99", 214); Price sub2199Yearly = CreatePrice(PassType.Pass, SubscriptionType.YearlyPass, "21-99", 535); // Prix pour les cours Price priceCourses10120 = CreatePrice(PassType.Course, SubscriptionType.DailyPass, "10-12", 5); Price PriceCourses12140 = CreatePrice(PassType.Course, SubscriptionType.DailyPass, "12-14", 5); Price PriceCourses14160 = CreatePrice(PassType.Course, SubscriptionType.DailyPass, "14-16", 5); Price PriceCourses16180 = CreatePrice(PassType.Course, SubscriptionType.DailyPass, "16-18", 5); Price PriceCourses18200 = CreatePrice(PassType.Course, SubscriptionType.DailyPass, "18-20", 5); Price PriceCourses20990 = CreatePrice(PassType.Course, SubscriptionType.DailyPass, "20-99", 5); Price priceCourses10121 = CreatePrice(PassType.Course, SubscriptionType.WeeklyPass, "10-12", 7); Price PriceCourses12141 = CreatePrice(PassType.Course, SubscriptionType.WeeklyPass, "12-14", 8); Price PriceCourses14161 = CreatePrice(PassType.Course, SubscriptionType.WeeklyPass, "14-16", 9); Price PriceCourses16181 = CreatePrice(PassType.Course, SubscriptionType.WeeklyPass, "16-18", 11); Price PriceCourses18201 = CreatePrice(PassType.Course, SubscriptionType.WeeklyPass, "18-20", 12); Price PriceCourses20991 = CreatePrice(PassType.Course, SubscriptionType.WeeklyPass, "20-99", 15); Price priceCourses10122 = CreatePrice(PassType.Course, SubscriptionType.MonthlyPass, "10-12", 18); Price PriceCourses12142 = CreatePrice(PassType.Course, SubscriptionType.MonthlyPass, "12-14", 22); Price PriceCourses14162 = CreatePrice(PassType.Course, SubscriptionType.MonthlyPass, "14-16", 24); Price PriceCourses16182 = CreatePrice(PassType.Course, SubscriptionType.MonthlyPass, "16-18", 28); Price PriceCourses18202 = CreatePrice(PassType.Course, SubscriptionType.MonthlyPass, "18-20", 30); Price PriceCourses20992 = CreatePrice(PassType.Course, SubscriptionType.MonthlyPass, "20-99", 36); Price priceCourses10123 = CreatePrice(PassType.Course, SubscriptionType.QuarterlyPass, "10-12", 45); Price PriceCourses12143 = CreatePrice(PassType.Course, SubscriptionType.QuarterlyPass, "12-14", 53); Price PriceCourses14163 = CreatePrice(PassType.Course, SubscriptionType.QuarterlyPass, "14-16", 60); Price PriceCourses16183 = CreatePrice(PassType.Course, SubscriptionType.QuarterlyPass, "16-18", 68); Price PriceCourses18203 = CreatePrice(PassType.Course, SubscriptionType.QuarterlyPass, "18-20", 75); Price PriceCourses20993 = CreatePrice(PassType.Course, SubscriptionType.QuarterlyPass, "20-99", 90); Price priceCourses10124 = CreatePrice(PassType.Course, SubscriptionType.YearlyPass, "10-12", 150); Price PriceCourses12144 = CreatePrice(PassType.Course, SubscriptionType.YearlyPass, "12-14", 175); Price PriceCourses14164 = CreatePrice(PassType.Course, SubscriptionType.YearlyPass, "14-16", 200); Price PriceCourses16184 = CreatePrice(PassType.Course, SubscriptionType.YearlyPass, "16-18", 225); Price PriceCourses18204 = CreatePrice(PassType.Course, SubscriptionType.YearlyPass, "18-20", 250); Price PriceCourses20994 = CreatePrice(PassType.Course, SubscriptionType.YearlyPass, "20-99", 300); Console.WriteLine("ok"); SaveChanges(); Console.Write("Seeding competitions... "); var compet1 = CreateCompetition(new DateTime(2020, 02, 22, 10, 00, 00), 20, "Grimp'EPFC", CompetitionType.Swiftness, "18-99"); compet1.DeclareWinner(guillaume); var compet2 = CreateCompetition(new DateTime(2020, 02, 23, 10, 00, 00), 20, "Grimp'EPFC", CompetitionType.Swiftness, "14-18"); var compet3 = CreateCompetition(new DateTime(2020, 03, 21, 10, 00, 00), 15, "Grimp'EPFC", CompetitionType.Block, "14-18"); var compet4 = CreateCompetition(new DateTime(2020, 03, 22, 10, 00, 00), 10, "Grimp'EPFC", CompetitionType.Difficulty, "08-14"); var compet5 = CreateCompetition(new DateTime(2020, 04, 18, 10, 00, 00), 20, "Grimp'EPFC", CompetitionType.Swiftness, "08-14"); var compet6 = CreateCompetition(new DateTime(2020, 04, 19, 10, 00, 00), 10, "Grimp'EPFC", CompetitionType.Difficulty, "18-99"); var compet7 = CreateCompetition(new DateTime(2020, 05, 30, 10, 00, 00), 15, "Grimp'EPFC", CompetitionType.Block, "18-99"); var compet8 = CreateCompetition(new DateTime(2020, 05, 31, 10, 00, 00), 15, "Grimp'EPFC", CompetitionType.Block, "08-14"); var compet9 = CreateCompetition(new DateTime(2020, 06, 21, 10, 00, 00), 10, "Grimp'EPFC", CompetitionType.Difficulty, "14-18"); Console.WriteLine("ok"); SaveChanges(); Console.Write("Seeding courses... "); // Cours pour les 10-12 ans CreateCourse(ben, 1, new DateTime(2020, 09, 02, 12, 00, 00), 15, "Grimp'EPFC", "10-12"); CreateCourse(bruno, 1, new DateTime(2020, 09, 03, 12, 00, 00), 15, "Grimp'EPFC", "10-12"); CreateCourse(ben, 1, new DateTime(2020, 09, 04, 12, 00, 00), 15, "Grimp'EPFC", "10-12"); CreateCourse(bruno, 1, new DateTime(2020, 09, 05, 12, 00, 00), 15, "Grimp'EPFC", "10-12"); CreateCourse(ben, 1, new DateTime(2020, 09, 06, 12, 00, 00), 15, "Grimp'EPFC", "10-12"); CreateCourse(bruno, 1, new DateTime(2020, 09, 07, 12, 00, 00), 15, "Grimp'EPFC", "10-12"); // Cours pour les 12-14 ans CreateCourse(ben, 1, new DateTime(2020, 09, 02, 13, 00, 00), 15, "Grimp'EPFC", "12-14"); CreateCourse(bruno, 1, new DateTime(2020, 09, 03, 13, 00, 00), 15, "Grimp'EPFC", "12-14"); CreateCourse(ben, 1, new DateTime(2020, 09, 04, 13, 00, 00), 15, "Grimp'EPFC", "12-14"); CreateCourse(bruno, 1, new DateTime(2020, 09, 05, 13, 00, 00), 15, "Grimp'EPFC", "12-14"); CreateCourse(ben, 1, new DateTime(2020, 09, 06, 13, 00, 00), 15, "Grimp'EPFC", "12-14"); CreateCourse(bruno, 1, new DateTime(2020, 09, 07, 13, 00, 00), 15, "Grimp'EPFC", "12-14"); // Cours pour les 14-16 ans CreateCourse(ben, 1, new DateTime(2020, 09, 02, 14, 00, 00), 15, "Grimp'EPFC", "14-16"); CreateCourse(bruno, 1, new DateTime(2020, 09, 03, 14, 00, 00), 15, "Grimp'EPFC", "14-16"); CreateCourse(ben, 1, new DateTime(2020, 09, 04, 14, 00, 00), 15, "Grimp'EPFC", "14-16"); CreateCourse(bruno, 1, new DateTime(2020, 09, 05, 14, 00, 00), 15, "Grimp'EPFC", "14-16"); CreateCourse(ben, 1, new DateTime(2020, 09, 06, 14, 00, 00), 15, "Grimp'EPFC", "14-16"); CreateCourse(bruno, 1, new DateTime(2020, 09, 07, 14, 00, 00), 15, "Grimp'EPFC", "14-16"); // Cours pour les 16-18 ans CreateCourse(ben, 1, new DateTime(2020, 09, 02, 15, 00, 00), 15, "Grimp'EPFC", "16-18"); CreateCourse(bruno, 1, new DateTime(2020, 09, 03, 15, 00, 00), 15, "Grimp'EPFC", "16-18"); CreateCourse(ben, 1, new DateTime(2020, 09, 04, 15, 00, 00), 15, "Grimp'EPFC", "16-18"); CreateCourse(bruno, 1, new DateTime(2020, 09, 05, 15, 00, 00), 15, "Grimp'EPFC", "16-18"); CreateCourse(ben, 1, new DateTime(2020, 09, 06, 15, 00, 00), 15, "Grimp'EPFC", "16-18"); CreateCourse(bruno, 1, new DateTime(2020, 09, 07, 15, 00, 00), 15, "Grimp'EPFC", "16-18"); // Cours pour les 18-20 ans CreateCourse(ben, 1, new DateTime(2020, 09, 02, 16, 00, 00), 15, "Grimp'EPFC", "18-20"); CreateCourse(bruno, 1, new DateTime(2020, 09, 03, 16, 00, 00), 15, "Grimp'EPFC", "18-20"); CreateCourse(ben, 1, new DateTime(2020, 09, 04, 16, 00, 00), 15, "Grimp'EPFC", "18-20"); CreateCourse(bruno, 1, new DateTime(2020, 09, 05, 16, 00, 00), 15, "Grimp'EPFC", "18-20"); CreateCourse(ben, 1, new DateTime(2020, 09, 06, 16, 00, 00), 15, "Grimp'EPFC", "18-20"); CreateCourse(bruno, 1, new DateTime(2020, 09, 07, 16, 00, 00), 15, "Grimp'EPFC", "18-20"); // Cours pour les adultes var course1 = CreateCourse(ben, 1, new DateTime(2020, 09, 02, 17, 00, 00), 15, "Grimp'EPFC", "20-99"); var course2 = CreateCourse(bruno, 1, new DateTime(2020, 09, 03, 17, 00, 00), 15, "Grimp'EPFC", "20-99"); var course3 = CreateCourse(ben, 1, new DateTime(2020, 09, 04, 17, 00, 00), 15, "Grimp'EPFC", "20-99"); var course4 = CreateCourse(bruno, 1, new DateTime(2020, 09, 05, 17, 00, 00), 15, "Grimp'EPFC", "20-99"); var course5 = CreateCourse(ben, 1, new DateTime(2020, 09, 06, 17, 00, 00), 15, "Grimp'EPFC", "20-99"); var course6 = CreateCourse(bruno, 1, new DateTime(2020, 09, 07, 17, 00, 00), 15, "Grimp'EPFC", "20-99"); Console.WriteLine("ok"); SaveChanges(); // Subscriptions pour des cours CreateSubscriptionToCourse(guillaume, new DateTime(2020, 05, 22), SubscriptionType.YearlyPass); CreateSubscriptionToCourse(gautier, new DateTime(2020, 05, 22), SubscriptionType.YearlyPass); CreateSubscriptionToCourse(quentin, new DateTime(2020, 05, 22), SubscriptionType.YearlyPass); SaveChanges(); guillaume.SubToCourse(course1); guillaume.SubToCourse(course2); gautier.SubToCourse(course3); gautier.SubToCourse(course4); quentin.SubToCourse(course5); quentin.SubToCourse(course6); quentin.SubToCourse(course1); // Subscriptions pour des competitions CreateSubscriptionToCompetition(guillaume, new DateTime(2020, 05, 22), SubscriptionType.MonthlyPass); CreateSubscriptionToCompetition(ben, new DateTime(2020, 05, 22), SubscriptionType.MonthlyPass); CreateSubscriptionToCompetition(bruno, new DateTime(2020, 05, 22), SubscriptionType.MonthlyPass); CreateSubscriptionToCompetition(gautier, new DateTime(2020, 05, 22), SubscriptionType.MonthlyPass); CreateSubscriptionToCompetition(quentin, new DateTime(2020, 05, 22), SubscriptionType.MonthlyPass); SaveChanges(); guillaume.SubToCompetition(compet1); guillaume.SubToCompetition(compet2); quentin.SubToCompetition(compet3); quentin.SubToCompetition(compet8); gautier.SubToCompetition(compet3); bruno.SubToCompetition(compet1); ben.SubToCompetition(compet1); // Subscriptions pour des pass CreateSubscriptionToPass(guillaume, new DateTime(2020, 05, 22), SubscriptionType.MonthlyPass); CreateSubscriptionToPass(quentin, new DateTime(2020, 05, 22), SubscriptionType.WeeklyPass); CreateSubscriptionToPass(gautier, new DateTime(2020, 05, 22), SubscriptionType.QuarterlyPass); CreateSubscriptionToPass(ben, new DateTime(2020, 05, 22), SubscriptionType.YearlyPass); SaveChanges(); Console.Write("Seeding threads & posts... "); var thread1 = CreateThread(guillaume, "Hello everyone, I'm looking forward to buy some new material buy I don't really know what brands are the best. Could you help me ?", "Do you know where I could buy some material ?"); CreatePost(ben, thread1, "Actually, Decathlon has strong material and not that expensive"); CreatePost(quentin, thread1, "I've bought my whole material at Decathlon, and I'm not disappointed at all"); CreatePost(gautier, thread1, "Here's a list of brands for professionnals : Beal, Black Diamond, Camp, Climbing Technology, Dreamtime, Mammut, Petzl, Wild Country."); CreatePost(guillaume, thread1, "Thanks everyone for your answers!"); var thread2 = CreateThread(admin, "You can directly sub in the competition section", "Grimp'EPFC is organizing the climb rock competition of the year"); CreatePost(gautier, thread2, "I'm already subbed hehe"); CreatePost(guillaume, thread2, "I'M IN !!!"); CreatePost(quentin, thread2, "Well, one more competition to win"); var thread3 = CreateThread(ben, "Due to the new season, all subscriptions will be deleted, you can sub to the course by clicking on it directly in the courses section", "Reminder : members of the annual courses must re-sub"); CreatePost(admin, thread3, "And a reminder : Prices have changed !!!"); CreatePost(guillaume, thread3, "Well, prices have changed but ok..."); CreatePost(quentin, thread3, "Wow... that's so expensive"); CreatePost(gautier, thread3, "Come on guys, it's still affordable"); var thread4 = CreateThread(admin, "The prices have changed, check the prices section !", "New annual pass price rating"); CreatePost(guillaume, thread4, "WTF???????"); CreatePost(gautier, thread4, "Ok, I'm leaving"); CreatePost(quentin, thread4, "How can you do that?"); CreatePost(admin, thread4, "Due to your reaction, we'll stick to the past season's rate. Sorry for that!"); var thread5 = CreateThread(bruno, "I'm sorry, I'm sick and I have to rest a bit", "Friday's course is canceled"); CreatePost(guillaume, thread5, "Get well soon"); CreatePost(gautier, thread5, "It's ok, I didn't want to come"); CreatePost(quentin, thread5, "gngng krkrkr"); CreatePost(admin, thread5, "Get well soon Bruno!2"); SaveChanges(); Console.WriteLine("ok"); } }
public int Number_Members() { return(Members.Count()); }
private void MainMenu() { try { int choice = terminal.MainMenu(Matches, Teams, new string[] { "Tabelle anzeigen", "Spielergebnis hinzufügen", "Team hinzufügen", "Team entfernen", "Mitglied hinzufügen", "Mitglied Teamwechsel", "Mitglied entfernen", "Programm beenden" }); if (choice != 7) { if (choice == 0) { //Tabelle aktualisieren if (Repository.IsDirty()) //TODO: insert dirty joke here! { switch (Terminal.Menu(new string[] { "Speichern", "Verwerfen" }, "Sie haben ungespeicherte Änderungen\nMöchten Sie diese Speichern oder Verwerfen?")) { case 0: Repository.Flush(); break; default: break; } } MainMenu(); } else if (choice == 1) { //Spielergebnis hinzufügen int?day = null; //spieltag foreach (Team team in Teams) { int teamMatchesAmount = Matches.Where(x => x.Team == team || x.Opponent == team).Count(); if (day == null || day > teamMatchesAmount) { day = teamMatchesAmount; } else { } } int gameday; if ((int?)day == null) { gameday = 1; } else { gameday = (int)day; } List <Team> possibleTeams = Teams.Where(x => (Matches.Where(y => y.Team == x || y.Opponent == x).Count() <= gameday)).ToList(); if (possibleTeams.Count() < 2) { throw new Exception.NoElementsException(); } else { } Team HomeTeam = possibleTeams[Terminal.Menu(possibleTeams.Select(x => x.Name).ToArray(), "Bitte Team wählen")]; List <Team> possibleGuests = possibleTeams.Where(x => x != HomeTeam).ToList(); Team GuestTeam = possibleGuests[Terminal.Menu(possibleGuests.Select(x => x.Name).ToArray(), "Bitte Team wählen")]; Match match = new Match( null, HomeTeam, GuestTeam, Terminal.AskForInteger("Tore eingeben"), Terminal.AskForInteger("Gegentore Tore eingeben") ); Repository.Save(match); MainMenu(); } else if (choice == 2) { //Team hinzufügen if (Teams.Count() < League.MaximumTeams) { Repository.Save(new Team(null, Terminal.AskForString("Team Name"), League)); } else { Terminal.Message("Maximal " + League.MaximumTeams + " Teams"); } MainMenu(); } else if (choice == 3) { //Team entfernen if (Teams.Count() < 1) { throw new Exception.NoElementsException(); } else { } Team team = Teams[Terminal.Menu(Teams.Select(i => i.Name).ToArray(), "Team löschen")]; team.League = null; Repository.Save(team); MainMenu(); } else if (choice == 4) { //Spieler entfernen if (Teams.Count() < 1) { throw new Exception.NoElementsException(); } else { } //Spieler hinzufügen Repository.Save( new Member( null, Terminal.AskForString("Name"), Teams[Terminal.Menu(Teams.Select(x => x.Name).ToArray(), "Bitte Team wählen")], Roles[Terminal.Menu(Roles.Select(x => x.Name).ToArray(), "Bitte Rolle wählen")]) ); MainMenu(); } else if (choice == 5) { //Spieler entfernen if (Teams.Count() < 2 || Members.Count() < 1) { throw new Exception.NoElementsException(); } else { } //Spieler Teamwechsel Team team = Teams[Terminal.Menu(Teams.Select(x => x.Name).ToArray(), "Bitte wählen")]; List <Member> teamMembers = Members.Where(x => x.Team == team).ToList(); Member member = teamMembers[Terminal.Menu(teamMembers.Select(x => " [" + x.Role.Name + "] " + x.Name).ToArray(), "Bitte wählen")]; member.Team = Teams.Where(x => x != member.Team).ToArray()[Terminal.Menu(Teams.Where(x => x != member.Team).Select(x => x.Name).ToArray(), "Bitte wählen")]; Repository.Save(member); MainMenu(); } else if (choice == 6) { //Spieler entfernen if (Teams.Count() < 1 || Members.Count() < 1) { throw new Exception.NoElementsException(); } else { } Team team = Teams[Terminal.Menu(Teams.Select(x => x.Name).ToArray(), "Bitte wählen")]; List <Member> teamMembers = Members.Where(x => x.Team == team).ToList(); Member member = teamMembers[Terminal.Menu(teamMembers.Select(x => " [" + x.Role.Name + "] " + x.Name).ToArray(), "Bitte wählen")]; member.Team = null; Repository.Save(member); MainMenu(); } else { } } else { Repository.Flush(); if (debug) { //wait a moment to view debug logs System.Threading.Thread.Sleep(1000); } else { } } } catch (Exception.NoElementsException) { Terminal.Message("Fehler\n Die Liste ist leer!"); MainMenu(); } }