示例#1
0
        public void GetAndUpdateTeam(V_PointScreen viewVong1)
        {
            BLL myBLL = new BLL();

            Model.Team team = myBLL.GetTeam(teamID);
            if (team != null)
            {
                if (_preGottenTeam == null)
                {
                    viewVong1.Diem   = team.Score;
                    viewVong1.TenDoi = team.Name;
                    //
                    _preGottenTeam = team;
                }
                else
                {
                    if (team.Score != _preGottenTeam.Score)
                    {
                        viewVong1.Diem   = team.Score;
                        viewVong1.TenDoi = team.Name;
                    }
                    _preGottenTeam = team;
                }
            }
        }
示例#2
0
        public Model.Team GetTeam(string teamID)
        {
            int year = DateTime.UtcNow.Year;
            List <Model.Team> teams = (new DAL()).GetPoint(year);

            Model.Team myTeam = teams.Find(x => x.ID == teamID);
            return(myTeam);
        }
示例#3
0
        public List <Model.Team> GetPoint(int nam)
        {
            SqlDataReader reader = null;

            try
            {
                SqlCommand cmd = new SqlCommand();
                cmd.CommandText = "exec GetPoint @nam='" + nam + "'";
                cmd.Connection  = connection;
                //
                List <Model.Team> teamS = new List <Model.Team>();
                //
                reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    string teamID   = reader.GetString(0);
                    string teamName = reader.GetString(1);


                    int score = 0;
                    if (!reader.IsDBNull(2))
                    {
                        score = reader.GetInt32(2);
                    }

                    string   round1State = reader.GetString(3);
                    string   round2State = reader.GetString(4);
                    string   round3State = reader.GetString(5);
                    DateTime dateTime    = reader.GetDateTime(6);
                    //
                    Model.Team team = new Model.Team();
                    team.ID          = teamID;
                    team.Name        = teamName;
                    team.Score       = score;
                    team.Round1State = round1State;
                    team.Round2State = round2State;

                    team.Round3State  = round3State;
                    team.LastModified = dateTime;
                    //
                    teamS.Add(team);
                }
                //
                reader.Close();
                connection.Close();
                return(teamS);
            }
            catch
            {
                reader.Close();
                connection.Close();
                return(null);
            }
        }
示例#4
0
        public Model.Team GetTeam(string teamId)
        {
            SqlDataReader reader = null;

            Model.Team team = null;
            try
            {
                SqlCommand cmd = new SqlCommand();
                cmd.CommandText = "exec GetTeam @id='" + teamId + "'";
                cmd.Connection  = connection;
                //
                //List<Model.Team> teamS = new List<Model.Team>();
                //
                reader = cmd.ExecuteReader();
                if (reader.Read())
                {
                    string   teamID      = reader.GetString(0);
                    string   teamName    = reader.GetString(1);
                    int      score       = reader.GetInt32(2);
                    string   round1State = reader.GetString(3);
                    string   round2State = reader.GetString(4);
                    string   round3State = reader.GetString(5);
                    DateTime dateTime    = reader.GetDateTime(6);
                    //
                    team              = new Model.Team();
                    team.ID           = teamID;
                    team.Name         = teamName;
                    team.Round1State  = round1State;
                    team.Round2State  = round2State;
                    team.Round3State  = round3State;
                    team.LastModified = dateTime;
                    //
                    //teamS.Add(team);
                }
                //
                reader.Close();
                connection.Close();
                return(team);
            }
            catch
            {
                reader.Close();
                connection.Close();
                return(null);
            }
        }