Example #1
0
        public object[] ScoreFill(object[] ojc, int n)
        {
            DBfunk dbClass = new DBfunk();

            using (var conn = dbClass.Score())
            {
                ListBox ls = new ListBox();
                ls.Items.AddRange(ojc);
                //  conn.Parameters.AddWithValue("@MemberNr", text);
                var data = ls.Items.OfType <string>().Select(line => line.Split(new char[] { '\t', ' ' }, StringSplitOptions.RemoveEmptyEntries))
                           .Select(items => new
                {
                    PlayerNrL = items[0],
                    Vorname   = items[1],
                    Nachname  = items[2],
                });
                int b = 0;
                foreach (var item in data)
                {
                    if (n == b)
                    {
                        conn.Parameters.AddWithValue("@PlayerNr", SqlDbType.NVarChar).Value = item.PlayerNrL;
                        conn.ExecuteNonQuery();
                        break;
                    }
                    else
                    {
                        b++;
                    }
                }
                object[] objCollection = new object[ls.Items.Count];
                ls.Items.CopyTo(objCollection, 0);
                return(objCollection);
            }
        }
Example #2
0
        public DataTable Befor()
        {
            DBfunk dbClass = new DBfunk();

            using (var conn = dbClass.LoadMem())
            {
                DataTablesFun dataTablesFunktions = new DataTablesFun();
                SqlDataReader reader;
                reader = conn.ExecuteReader();

                DataTable dt = dataTablesFunktions.dt();


                dt.Load(reader);

                return(dt);
            }
        }
Example #3
0
        public object[] Fore2()
        {
            DBfunk dbClass = new DBfunk();

            using (var conn = dbClass.LoadMem())
            {
                SqlDataReader reader;
                reader = conn.ExecuteReader();

                var Listt = new ListBox();
                while (reader.Read())
                {
                    Listt.Items.Add(reader[3].ToString() + "   " + reader[1].ToString() + "     " + reader[2].ToString());
                }
                object[] objCollection = new object[Listt.Items.Count];
                Listt.Items.CopyTo(objCollection, 0);
                return(objCollection);
            }
        }
Example #4
0
        public bool UsernameCheck(string Nummer)
        {
            bool       isUserExisted = false;
            DBfunk     DBfunk        = new DBfunk();
            SqlCommand cmd           = DBfunk.NumberCheck();

            cmd.Parameters.AddWithValue("@PlayerNr", Nummer);

            SqlDataReader dr = cmd.ExecuteReader();

            while (dr.Read())
            {
                if (dr.HasRows == true)
                {
                    isUserExisted = true;
                    break;
                }
            }
            return(isUserExisted);
        }
Example #5
0
        public object[] Fore3(string text)
        {
            DBfunk dbClass = new DBfunk();

            using (var conn = dbClass.SerMembr())
            {
                conn.Parameters.AddWithValue("@PlayerNr", text);

                SqlDataReader reader;
                reader = conn.ExecuteReader();

                var Listt = new ListBox();
                while (reader.Read())
                {
                    Listt.Items.Add(reader[3].ToString() + "   " + reader[1].ToString() + "     " + reader[2].ToString());
                }
                object[] objCollection = new object[Listt.Items.Count];
                Listt.Items.CopyTo(objCollection, 0);
                return(objCollection);
            }
        }
Example #6
0
        public void User(string Name, string Surname, string Nummer)
        {
            DBfunk dbClass = new DBfunk();

            using (var conn = dbClass.newMemb())
            {
                conn.Parameters.AddWithValue("@Name", Name);
                conn.Parameters.AddWithValue("@Surname", Surname);



                bool isUserExisted = UsernameCheck(Nummer);

                if (isUserExisted)
                {
                    MessageBox.Show("MitgliedNr ist Vergeben");
                }
                else
                {
                    conn.Parameters.AddWithValue("@PlayerNr", Nummer);
                    conn.ExecuteNonQuery();
                }
            }
        }