Exemple #1
0
        public ArrayList getPlayerChoices(int TeamId)
        {
            int Avg;
            ArrayList arr = new ArrayList();
            PlayerProfileEntity player;
            int proceed;

            //string sql = " SELECT AVG( Choice ) as 'Average' FROM Game  WHERE (ID =@TeamId OR Team_ID =@TeamId) and Choice<>-1";
            string sql = " SELECT ID,TOTAL,Parent_ID as 'Average' FROM Profile  WHERE (ID =@TeamId OR Parent_ID =@TeamId) ";

            MySqlConnection conn = new MySqlConnection(connStr);

            MySqlCommand cmd = new MySqlCommand(sql, conn);
            conn.Open();
            cmd.Parameters.Add("@TeamId", MySqlDbType.Int16).Value = TeamId;
            cmd.Prepare();
            MySqlDataReader reader = cmd.ExecuteReader();
            Avg = 0;
            while (reader.Read())
            {
                player = new PlayerProfileEntity();
                player.strId = reader["ID"].ToString();

                player.Total = reader["TOTAL"].ToString();
                //if(reader["TOTAL"].ToString() != "-1")
                //player.Total  = reader["TOTAL"].ToString();
                //else
                //    player.Total = "0";
                arr.Add(player);
            }

            reader.Close();
            conn.Close();
            return arr;
        }
Exemple #2
0
        public ArrayList getplayerschoices(int intTeamid, int parentroundid, int intChildroundid)
        {
            ArrayList arr = new ArrayList();
            PlayerProfileEntity player;
            DataSet ds = new DataSet();
            MySqlConnection conn = new MySqlConnection(connStr);
            MySqlCommand cmd = new MySqlCommand("spgetdataforchilround", conn);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@teamidp", MySqlDbType.Int16).Value = intTeamid;
            cmd.Parameters.Add("@intsubroundidp", MySqlDbType.Int16).Value = parentroundid;
            cmd.Parameters.Add("@childroundidp", MySqlDbType.Int16).Value = intChildroundid;
            conn.Open();
            cmd.Prepare();

            MySqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                player = new PlayerProfileEntity();
                player.strId = reader["randomroundsessionid"].ToString();
                player.Total = reader["scoreforround"].ToString();
                arr.Add(player);
            }

            reader.Close();
            conn.Close();
            return arr;

            //MySqlDataAdapter dta = new MySqlDataAdapter(
        }
Exemple #3
0
        public PlayerProfileEntity ValidateUser(string Name, string Email)
        {
            DataSet dsUserInfo = new DataSet();

            string sql = " Select * from Profile where Email='"+ Email +"' and Name='"+Name+"'";
            MySqlConnection conn = new MySqlConnection(connStr);
            conn.Open();
            //MySqlCommand cmd = new MySqlCommand(sql, conn);
            //cmd.Parameters.Add("@Email", MySqlDbType.VarChar, 50).Value = Email;
            //cmd.Parameters.Add("@Name", MySqlDbType.VarChar, 50).Value = Name;
            //cmd.Prepare();
            MySqlDataAdapter dta = new MySqlDataAdapter(sql, conn);
            dta.Fill(dsUserInfo);
            if (dsUserInfo.Tables[0].Rows.Count > 0)
            {

                PlayerProfileEntity obj = new PlayerProfileEntity();
                obj.strName = dsUserInfo.Tables[0].Rows[0]["Name"].ToString();
                obj.strId = dsUserInfo.Tables[0].Rows[0]["ID"].ToString();
                obj.gender = dsUserInfo.Tables[0].Rows[0]["Gender"].ToString();
                obj.Age = dsUserInfo.Tables[0].Rows[0]["Age"].ToString();
                obj.Email = dsUserInfo.Tables[0].Rows[0]["Email"].ToString();
                obj.Location = dsUserInfo.Tables[0].Rows[0]["Location"].ToString();
                obj.Date = dsUserInfo.Tables[0].Rows[0]["Date"].ToString();
                obj.Total = dsUserInfo.Tables[0].Rows[0]["Total"].ToString();
                return obj;

            }
            return null;
            if (conn.State == ConnectionState.Open)
            {
                conn.Close();
            }

            //MySqlDataReader reader = cmd.ExecuteReader();
            //while (reader.Read())
            //{
            //    return true;
            //}
            //reader.Close();

            //conn.Close();
            //return null;
        }