Ejemplo n.º 1
0
        public List <prpplayers> Find_rec(Int32 id)
        {
            if (con.State == ConnectionState.Closed)
            {
                con.Open();
            }
            SqlCommand cmd = new SqlCommand("findplayers", con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@id", SqlDbType.Int).Value = id;
            SqlDataReader     dr  = cmd.ExecuteReader();
            List <prpplayers> obj = new List <prpplayers>();

            if (dr.HasRows)
            {
                dr.Read();
                prpplayers k = new prpplayers();
                k.id       = Convert.ToInt32(dr[0]);
                k.name     = dr[1].ToString();
                k.category = dr[2].ToString();
                k.value    = Convert.ToSingle(dr[3]);
                // k.points = Convert.ToInt32(dr[4]);
                k.team = dr[4].ToString();
                obj.Add(k);
            }
            dr.Close();
            cmd.Dispose();
            con.Close();
            return(obj);
        }
Ejemplo n.º 2
0
        public List <prpplayers> Disp_Rec()
        {
            if (con.State == ConnectionState.Closed)
            {
                con.Open();
            }
            SqlCommand cmd = new SqlCommand("displayers", con);

            cmd.CommandType = CommandType.StoredProcedure;
            SqlDataReader     dr   = cmd.ExecuteReader();
            List <prpplayers> obj1 = new List <prpplayers>();

            while (dr.Read())
            {
                prpplayers k = new prpplayers();
                k.id       = Convert.ToInt32(dr[0]);
                k.name     = dr[1].ToString();
                k.category = dr[2].ToString();
                k.value    = Convert.ToSingle(dr[3]);
                k.team     = dr[4].ToString();
                obj1.Add(k);
            }

            dr.Close();
            cmd.Dispose();
            con.Close();
            return(obj1);
        }
Ejemplo n.º 3
0
        public void Del_rec(prpplayers p)
        {
            if (con.State == ConnectionState.Closed)
            {
                con.Open();
            }
            SqlCommand cmd = new SqlCommand("delplayers", con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@id", SqlDbType.Int).Value = p.id;
            cmd.ExecuteNonQuery();
            cmd.Dispose();
            con.Close();
        }
Ejemplo n.º 4
0
        public void Save_Rec(prpplayers p)
        {
            if (con.State == ConnectionState.Closed)
            {
                con.Open();
            }

            SqlCommand cmd = new SqlCommand("insplayers", con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@name", SqlDbType.VarChar, 50).Value     = p.name;
            cmd.Parameters.Add("@category", SqlDbType.VarChar, 50).Value = p.category;
            cmd.Parameters.Add("@value", SqlDbType.Float).Value          = p.value;
            cmd.Parameters.Add("@team", SqlDbType.VarChar, 50).Value     = p.team;
            cmd.ExecuteNonQuery();
            con.Close();
            cmd.Dispose();
        }