//Metodo de tipo select cargados con lsita generica

        #region Metodo de cargar con lista generica de deportes
        public List <Sports> Cargar_Deportes(String SentenciaSQL)
        {
            List <Sports> Objeto_Deporte = new List <Sports>();

            try
            {
                Comando.CommandText = SentenciaSQL;
                Conexion            = ConexionMySQL.ConectarConMySQL();
                Comando.Connection  = Conexion;
                Conexion.Open();
                MySqlDataReader lector = Comando.ExecuteReader();

                while (lector.Read())
                {
                    Sports entidad_confi = new Sports();

                    entidad_confi.Description = lector.GetString(2);
                    entidad_confi.Deporte     = lector.GetString(1);
                    entidad_confi.Id          = lector.GetInt16(0);
                    Objeto_Deporte.Add(entidad_confi);
                }
                lector.Close();
            }
            catch (MySqlException e)
            {
                e.Message.ToString();
            }
            finally
            {
                Conexion.Close();
            }

            return(Objeto_Deporte);
        }
예제 #2
0
        public SportsViewModel GetSportsDetails(int id)
        {
            try
            {
                Sports sports = _context.Sports
                                .Where(x => x.SportId == id)
                                .Include(x => x.Student)
                                .FirstOrDefault();

                SportsViewModel model = new SportsViewModel
                {
                    SportID    = sports.SportId,
                    SportsType = sports.SportsType,
                    IsOwingKit = sports.IsOwingKit,
                    StudentID  = sports.StudentId,
                    FullName   = sports.Student.FullName,

                    StudentIndexList  = new SelectList(_studentService.GetStudents(), "StudentID", "FullName", sports.SportId),
                    StudentDepartList = new SelectList(_studentService.GetStudents(), "StudentID", "StudentId", sports.SportId)
                };

                return(model);
            }
            catch (Exception)
            {
                SportsViewModel emptyModel = new SportsViewModel();
                return(emptyModel);
            }
        }
예제 #3
0
        public void PrepareSportsDataForClient_When_executed_return_dto()

        {
            var sport = new Sports()
            {
                Id    = 1,
                Name  = "BasketBall",
                Email = "*****@*****.**",
            };
            var location = new Programs()
            {
                Id              = 2,
                Name            = "Stonewall",
                SportNavigation = sport
            };

            sport.Programs.Add(location);


            SportLocationDto actual = _worker.PrepareSportsDataForClient(location);

            Assert.Equal(sport.Email, actual.Email);
            Assert.Equal(sport.Name, actual.SportName);
            Assert.Equal(sport.Id, actual.SportId);
            Assert.Equal(location.Id, actual.ProgramId);
            Assert.Equal(location.Name, actual.ProgramName);
        }
        public async Task <IActionResult> PutSports([FromRoute] int id, [FromBody] Sports sports)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != sports.Id)
            {
                return(BadRequest());
            }

            _context.Entry(sports).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!SportsExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
예제 #5
0
        public Client(Random rnd, int id, string firstName, string lastName, int age, int currentSkill, int potentialSkill, int popularity, int agencyHappiness, int teamHappiness, Sports sport, Months birthMonth, int birthWeek)
        {
            Id = id;

            First    = firstName;
            Last     = lastName;
            FullName = firstName + " " + lastName;
            Age      = age;

            CurrentSkill   = currentSkill;
            PotentialSkill = potentialSkill;
            if (PotentialSkill < CurrentSkill)
            {
                PotentialSkill = CurrentSkill;
            }

            Popularity            = DeterminePopularity(rnd, CurrentSkill, PotentialSkill, Age);
            PopularityDescription = DescribePopularity(Popularity);
            PopularityString      = EnumToString(PopularityDescription.ToString());

            TeamHappiness            = DetermineTeamHappiness(rnd);
            TeamHappinessDescription = DescribeHappiness(TeamHappiness);
            TeamHappinessString      = EnumToString(TeamHappinessDescription.ToString());

            AgencyHappiness            = DetermineAgencyHappiness(rnd, TeamHappiness);
            AgencyHappinessDescription = DescribeHappiness(AgencyHappiness);
            AgencyHappinessString      = EnumToString(AgencyHappinessDescription.ToString());

            Sport = sport;

            BirthMonth = birthMonth;
            BirthWeek  = birthWeek;
            Birthday   = new Date((int)birthMonth, birthMonth, birthWeek);
        }
예제 #6
0
 public MMAFighter(Random rnd, int id, Sports sport, int age)
     : base(rnd, id, sport, age)
 {
     Wins       = 0;
     Losses     = 0;
     KnockedOut = false;
 }
        public Goal OutOfGoalViewModel(GoalViewModel goalViewModel, string username)
        {
            Sports sports = new Sports(SessionProvider.CurrentSession);
            Venues venues = new Venues(SessionProvider.CurrentSession);
            Goals goals = new Goals(SessionProvider.CurrentSession);
            Users users = new Users(SessionProvider.CurrentSession);

            Goal goal;
            if(goalViewModel.Id == 0)
            {
                goal = new Goal();
                goal.CreatedOn = DateTime.Now;
                goal.UserCreator = users.GetByUserName(username);
            }
            else
            {
                goal = goals.GetById(goalViewModel.Id);
            }
            
            goal.Name = goalViewModel.Name;
            goal.Date = goalViewModel.Date;
            goal.Description = goalViewModel.Description;

            goal.Web = goalViewModel.Web;
            goal.Venue = venues.GetById(Convert.ToInt32(goalViewModel.VenueId));
            goal.Sport = sports.GetById(Convert.ToInt32(goalViewModel.SportId));

            goal.Venue.Latitude = Convert.ToInt32(goalViewModel.VenueLatitude);
            goal.Venue.Longitude = Convert.ToInt32(goalViewModel.VenueLongitude);

            return goal;
        }
        public async Task <IActionResult> Edit(int id, [Bind("SportId,SportName,PhotoUrl,InfoSport")] Sports sports)
        {
            if (id != sports.SportId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(sports);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SportsExists(sports.SportId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(sports));
        }
        static void Main(string[] args)
        {
            //定义一个程序集,并加载程序集SomeSports
            Assembly assembly = Assembly.Load("SomeSports");
            //定义一个模块,并获取程序集assembly的SomeSports.dll模块
            Module module = assembly.GetModule("SomeSports.dll");

            //获取模块module的Football的类型
            Type[] types = module.FindTypes(Module.FilterTypeName, "Football");
            //输出Football类型的名称
            if (types.Length != 0)
            {
                ConstructorInfo ci      = types[0].GetConstructor(new Type[0]);
                Sports          program = (Sports)ci.Invoke(new Object[0]);
                Console.WriteLine("Sport's name is :" + program.ToString());
            }
            else
            {
                Console.WriteLine("Type not found");
            }
            //获取相关的程序集的属性值
            Module mod = Assembly.GetEntryAssembly().GetModules()[0];

            Console.WriteLine("Module Name is " + mod.Name);
            Console.WriteLine("Module FullyQualifiedName is " + mod.FullyQualifiedName);
            Console.WriteLine("Module ScopeName is " + mod.ScopeName);
        }
        private void ListView_MemberSportsSelection(object sender, SelectionChangedEventArgs e)
        {
            var item = (sender as ListView).SelectedItem as Sport;

            if (item != null)
            {
                Sports.Add(item);
                MemberSports.Remove(item);
                Clubs.Clear();
                foreach (Sport memberSport in MemberSports)
                {
                    foreach (Club clubMemberSport in memberSport.Clubs)
                    {
                        Clubs.Add(clubMemberSport);
                    }
                }

                var memClubs = new List <Club>();
                foreach (Club c in MemberClubs)
                {
                    memClubs.Add(c);
                }

                foreach (Club c in memClubs)
                {
                    foreach (Club club in item.Clubs)
                    {
                        if (club.Id == c.Id)
                        {
                            MemberClubs.Remove(c);
                        }
                    }
                }
            }
        }
예제 #11
0
 private void PrintSport(Sports sport)
 {
     Console.WriteLine(new string('-', 40));
     Console.WriteLine($"ID: {sport.Id}");
     Console.WriteLine($"Name: {sport.Name}");
     Console.WriteLine(new string('-', 40));
 }
    bool currentActiveState = false;//このSportsがリストに入ているならtrueそうでないならfalse


    void Start()
    {
        sport = new Sports(cost, ticket, live, location, popularity);
        GetComponent <Image>().color = Color.gray;
        GetComponent <Button>().onClick.AddListener(ClickBehavior);
        UpdateSport();
    }
예제 #13
0
        public void SportTypes1()
        {
            var list = Sports.SportTypes(5);

            Assert.IsNotNull(list);
            Assert.IsTrue(list.Count == 5);
        }
예제 #14
0
        public void GetSportByName()
        {
            var options = new DbContextOptionsBuilder <OlympicGamesDBContext>()
                          .UseInMemoryDatabase(databaseName: "GetSportByNameDB")
                          .Options;

            var data = new List <Sports>()
            {
                new Sports {
                    Id = 1, Name = "Sport1"
                },
                new Sports {
                    Id = 2, Name = "Sport2"
                },
                new Sports {
                    Id = 3, Name = "Sport3"
                },
            }.AsQueryable();

            using (OlympicGamesDBContext context = new OlympicGamesDBContext(options))
            {
                SportsBusiness business = new SportsBusiness(context);
                data.ToList().ForEach(t => context.Sports.Add(t));
                context.SaveChanges();

                Sports t = business.GetSportByName("Sport1");
                Assert.AreEqual("Sport1", t.Name);
            }
        }
        static void Main2(string[] args)
        {
            Sports sports = new Sports();
            var    str0   = sports[0];

            System.Console.WriteLine(str0);// Baseball
        }
예제 #16
0
        public string DisplayAgencyRetirements(Sports sport)
        {
            List <Player> list   = new List <Player>();
            string        output = "";

            foreach (Agent a in Agents)
            {
                foreach (Player client in a.ClientList)
                {
                    if (client.Sport == sport)
                    {
                        list.Add(client);
                    }
                }
            }

            if (list.Count > 0)
            {
                output = sport.ToString() + " retirement report:";

                for (int i = 0; i < list.Count; i++)
                {
                    if (list[i].Retiring)
                    {
                        output += Environment.NewLine + "- " + list[i].Position.ToString() + " " + list[i].FullName;
                    }
                }
            }
            else
            {
                output = "No " + sport.ToString() + " retirements for the agency this year.";
            }

            return(output);
        }
예제 #17
0
        public async Task <Sports> AddAsync(Sports item)
        {
            context.Sports.Add(item);
            await context.SaveChangesAsync();

            return(item);
        }
예제 #18
0
        // constructor method for Progression/Regression for leagues
        public CalendarEvent(string s, League l)
        {
            int month;
            int week;

            if (l.SeasonEnd.MonthNumber == 12)
            {
                month = 0;
            }
            else
            {
                month = l.SeasonEnd.MonthNumber;
            }

            if (l.SeasonEnd.Week == 5)
            {
                week = 4;
            }
            else
            {
                week = l.SeasonEnd.Week;
            }

            EventType = CalendarEventType.ProgressionRegression;
            EventName = l.Abbreviation + " Progression/Regression";
            EventDate = new Date(month + 1, week);
            Sport     = l.Sport;
        }
예제 #19
0
        public string DisplayAgencyProgressionRegression(Sports sport)
        {
            List <Player> progressionList = new List <Player>();

            foreach (Agent a in Agents)
            {
                foreach (Player client in a.ClientList)
                {
                    if (client.Sport == sport)
                    {
                        progressionList.Add(client);
                    }
                }
            }

            string output = sport.ToString() + " progression/regression report:" + Environment.NewLine;

            for (int i = 0; i < progressionList.Count; i++)
            {
                if (progressionList[i].CurrentSkill >= progressionList[i].PreviousCurrentSkill)
                {
                    output += progressionList[i].FullName + " progressed by " + (progressionList[i].CurrentSkill - progressionList[i].PreviousCurrentSkill).ToString() + " points.";
                }
                else
                {
                    output += progressionList[i].FullName + " regressed by " + (progressionList[i].PreviousCurrentSkill - progressionList[i].CurrentSkill).ToString() + " points.";
                }
                output += Environment.NewLine;
            }

            return(output);
        }
예제 #20
0
        // constructor method for AssociationEvent

        /*public CalendarEvent(Event e)
         * {
         *  EventType = CalendarEventType.AssociationEvent;
         *  EventName = e.Year + " " + e.Name;
         *  EventDate = e.EventDate;
         *  Sport = e.Sport;
         *  EventID = e.Id;
         * }*/

        // constructor method for LeagueYearBegins
        public CalendarEvent(League l)
        {
            EventType = CalendarEventType.LeagueYearBegins;
            EventName = l.Abbreviation + " Year Begins";
            EventDate = l.SeasonStart;
            Sport     = l.Sport;
        }
예제 #21
0
 // constrcutor method for LeagueYearBeings and LeagueYearEnds
 public CalendarEvent(League l, string s)
 {
     EventType = CalendarEventType.LeagueYearEnds;
     EventName = l.Abbreviation + " Year Ends";
     EventDate = l.SeasonEnd;
     Sport     = l.Sport;
 }
예제 #22
0
        // constructor method for Progression/Regression for Associations

        /*public CalendarEvent(Association a)
         * {
         *  EventType = CalendarEventType.ProgressionRegression;
         *  EventName = a.Abbreviation + " Progression/Regression";
         *  EventDate = new Date(11, Months.December, 1);
         *  Sport = a.Sport;
         * }*/
        //constructor method for DraftDeclaration for Leagues
        public CalendarEvent(League l, Date d)
        {
            EventType = CalendarEventType.DraftDeclaration;
            EventName = l.Abbreviation + " Draft Declaration";
            EventDate = d;
            Sport     = l.Sport;
        }
        private void SetData(object sender, PropertyChangedEventArgs e)
        {
            if (_socketManager.ServerResponse.RequestTarget == "members")
            {
                Data = JsonConvert.DeserializeObject <ObservableCollection <Member> >(
                    _socketManager.ServerResponse.RequestContent.ToString());
            }

            if (_socketManager.ServerResponse.RequestTarget == "clubs")
            {
                AllClubs = JsonConvert.DeserializeObject <ObservableCollection <Club> >(
                    _socketManager.ServerResponse.RequestContent.ToString());

                Clubs.Clear();
            }

            if (_socketManager.ServerResponse.RequestTarget == "sports")
            {
                AllSports = JsonConvert.DeserializeObject <ObservableCollection <Sport> >(
                    _socketManager.ServerResponse.RequestContent.ToString());

                Sports.Clear();
                foreach (Sport s in AllSports)
                {
                    Sports.Add(s);
                }
            }
        }
예제 #24
0
 // constructor method for Progression/Regression for Associations
 public CalendarEvent(Association a)
 {
     EventType = CalendarEventType.ProgressionRegression;
     EventName = a.Abbreviation + " Progression/Regression";
     EventDate = new Date(11, Months.December, 1);
     Sport     = a.Sport;
 }
예제 #25
0
        //Adding items to user list
        public ActionResult AddToUserList(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Sports sports = db.sports.Find(id);

            if (sports == null)
            {
                return(HttpNotFound());
            }

            UserManager <ApplicationUser> UserManager = new UserManager <ApplicationUser>(new UserStore <ApplicationUser>(db));
            ApplicationUser currentUser = UserManager.FindById(User.Identity.GetUserId());

            UserList newlist = new UserList();

            newlist.Title          = sports.Title;
            newlist.Description    = sports.Description;
            newlist.Link           = sports.Link;
            newlist.Location       = sports.Location;
            newlist.ListCategoryId = 5;  //have to use # be sure to confirm the numbers in List Categories.
            newlist.UserName       = currentUser;
            db.UserLists.Add(newlist);
            db.SaveChanges();

            return(RedirectToAction("Index"));
        }
예제 #26
0
        public ActionResult DeleteConfirmed(int id)
        {
            Sports sports = db.sports.Find(id);

            db.sports.Remove(sports);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #27
0
        private void listBoxToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Sports settingsForm = new Sports();

            // Show the settings form
            settingsForm.Show();
            settingsForm.BringToFront();
        }
예제 #28
0
 private void PrintCoach(Coaches coach, Sports sport)
 {
     Console.WriteLine(new string('-', 40));
     Console.WriteLine($"ID: {coach.Id}");
     Console.WriteLine($"Name: {coach.Name}");
     Console.WriteLine($"Sport Name: {sport.Name}");
     Console.WriteLine(new string('-', 40));
 }
예제 #29
0
 public Licenses(Sports sport, int applicationFee, int yearlyDues, Months monthOfRenewal, int monthOfRenewalNumber)
 {
     Sport                = sport;
     ApplicationFee       = applicationFee;
     YearlyDues           = yearlyDues;
     MonthOfRenewal       = monthOfRenewal;
     MonthOfRenewalNumber = monthOfRenewalNumber;
 }
예제 #30
0
 // constructor method for AssociationEvent
 public CalendarEvent(Event e)
 {
     EventType = CalendarEventType.AssociationEvent;
     EventName = e.Year + " " + e.Name;
     EventDate = e.EventDate;
     Sport     = e.Sport;
     EventID   = e.Id;
 }
예제 #31
0
        public void Test14_The_Correction_Of_Video()
        {
            ExercisePage page   = new ExercisePage();
            Sports       expect = Sports.JumpingJacks;
            Sports       actual = page.ExerciseName;

            Assert.AreEqual(expect, actual);
        }
예제 #32
0
 private void Initialize()
 {
     countries = new Countries(session);
     cities = new Cities(session);
     venues = new Venues(session);
     users = new Users(session);
     sports = new Sports(session);
     goals = new Goals(session);
 }
        public void html([Bind(Prefix = "id")] string name)
        {
            Goals goals = new Goals(SessionProvider.CurrentSession);
            Sports sports = new Sports(SessionProvider.CurrentSession);
            var goalList = goals.GetAllBySport(sports.GetByName(name));
            string html = "<ul>";
            foreach (Goal goal in goalList)
            {
                html += string.Format("<li> -Name: {0} <br/>-Description: {1}</li>", goal.Name, goal.Description);
            }
            html += "</ul>";

            Response.Write(html);
        }
        private void Initialize()
        {
            InitalizeSessionFactory(
                typeof (Country).Assembly,
                typeof (Goal).Assembly,
                typeof (User).Assembly,
                typeof (Venue).Assembly,
                typeof (Country).Assembly,
                typeof (Sport).Assembly);

            countries = new Countries(session);
            cities = new Cities(session);
            venues = new Venues(session);
            users = new Users(session);
            sports = new Sports(session);
            goals = new Goals(session);
            goalParticipants = new GoalParticipants(session);
        }
예제 #35
0
        private GenerateTeams parseFile(Sports league)
        {
            startTime();

            workingProgressLabel.Text = "Starting Calculations";
            GenerateTeams teamGenerator;
            int salaryCap = Convert.ToInt32(salaryCapTextBox.Text);
            int threshold = Convert.ToInt32(salaryThresholdTextBox.Text);

            if (league == Sports.Football)
            {
                teamGenerator = new FootballTeamGenerator(salaryCap, threshold);
            }
            else if (league == Sports.Hockey) {
                teamGenerator = new NHLTeamGenerator(salaryCap, threshold);
            }
            else if (league == Sports.Basketball)
            {
                teamGenerator = new BasketballTeamGenerator(salaryCap, threshold);
            }
            else if (league == Sports.Golf)
            {
                teamGenerator = new GolfTeamGenerator(salaryCap, threshold);
            }
            else
            {
                throw new NotImplementedException();
            }

            OpenFileDialog file = new OpenFileDialog();
            file.Multiselect = false;

            if (file.ShowDialog() == DialogResult.OK)
            {
                Console.WriteLine(file.FileName);
                var reader = new StreamReader(File.OpenRead(file.FileName));

                while (!reader.EndOfStream)
                {
                    var line = reader.ReadLine();
                    String[] values = line.Split(',');
                    for (int i = 0; i < values.Length; i++)
                    {
                        values[i] = values[i].Replace("\"", String.Empty);
                    }

                    Player.Positions pos = Player.convertToEnum(values[0]);
                    if (pos == Player.Positions.INVALID)
                    {
                        continue;
                    }

                    int salary;
                    Int32.TryParse(values[2], out salary);
                    double points;
                    Double.TryParse(values[4], out points);

                    Player player = new Player(pos, values[1], uniqueID++, salary, points);
                    teamGenerator.addPlayer(player);
                }
                reader.Close();
                return teamGenerator;
            }

            return null;
        }
예제 #36
0
 private void calculatePlayerStats(Sports sport)
 {
     GenerateTeams teamGen = parseFile(sport);
     if (teamGen != null)
     {
         saveFile(teamGen.convertPlayersToValues());
     }
 }
        public ActionResult JsonSport([Bind(Prefix = "id")] string name)
        {
            Goals goals = new Goals(SessionProvider.CurrentSession);
            Sports sports = new Sports(SessionProvider.CurrentSession);
            var goalList = goals.GetAllBySport(sports.GetByName(name));

            var jsonGoals = JsonBuilder.BuildJsonGoal(goalList);

            return Json(new { success = jsonGoals }, JsonRequestBehavior.AllowGet);
        }