Beispiel #1
0
        private bool DoesRunnerSponsorExists(RunnerSponsor runnerSponsor)
        {
            var connection = new SqlConnection(ConnectionString);

            connection.Open();

            var command =
                new SqlCommand(
                    string.Format(
                        "SELECT runnerid FROM runnersponsor WHERE runnerid = {0} AND sponsorid = {1}",
                        runnerSponsor.RunnerId,
                        runnerSponsor.SponsorId),
                    connection);

            using (var reader = command.ExecuteReader())
            {
                if (reader.HasRows)
                {
                    connection.Close();
                    return(true);
                }

                connection.Close();
                return(false);
            }
        }
Beispiel #2
0
        private void UpdateRunnerSponsor(RunnerSponsor runnerSponsor)
        {
            using (var connection = new SqlConnection(ConnectionString))
            {
                connection.Open();

                var command =
                    new SqlCommand(
                        string.Format(
                            "UPDATE runnersponsor SET betrag = {0} where runnerid = {1} and sponsorid = {2}",
                            runnerSponsor.Betrag,
                            runnerSponsor.RunnerId,
                            runnerSponsor.SponsorId),
                        connection);

                command.ExecuteNonQuery();
            }
        }
Beispiel #3
0
        private void CreateRunnerSponsor(RunnerSponsor runnerSponsor)
        {
            using (var connection = new SqlConnection(ConnectionString))
            {
                connection.Open();

                var command =
                    new SqlCommand(
                        string.Format(
                            "INSERT INTO runnersponsor (runnerid, sponsorid, betrag) VALUES ({0}, {1}, {2})",
                            runnerSponsor.RunnerId,
                            runnerSponsor.SponsorId,
                            runnerSponsor.Betrag),
                        connection);

                command.ExecuteNonQuery();
            }
        }
        private void CreateRunnerSponsor(RunnerSponsor runnerSponsor)
        {
            using (var connection = new SqlConnection(ConnectionString))
            {
                connection.Open();

                var command =
                    new SqlCommand(
                        string.Format(
                            "INSERT INTO runnersponsor (runnerid, sponsorid, betrag) VALUES ({0}, {1}, {2})",
                            runnerSponsor.RunnerId,
                            runnerSponsor.SponsorId,
                            runnerSponsor.Betrag),
                        connection);

                command.ExecuteNonQuery();
            }
        }
        private void UpdateRunnerSponsor(RunnerSponsor runnerSponsor)
        {
            using (var connection = new SqlConnection(ConnectionString))
            {
                connection.Open();

                var command =
                    new SqlCommand(
                        string.Format(
                            "UPDATE runnersponsor SET betrag = {0} where runnerid = {1} and sponsorid = {2}",
                            runnerSponsor.Betrag,
                            runnerSponsor.RunnerId,
                            runnerSponsor.SponsorId),
                        connection);

                command.ExecuteNonQuery();
            }
        }
        private bool DoesRunnerSponsorExists(RunnerSponsor runnerSponsor)
        {
            var connection = new SqlConnection(ConnectionString);
            connection.Open();

            var command =
                new SqlCommand(
                    string.Format(
                        "SELECT runnerid FROM runnersponsor WHERE runnerid = {0} AND sponsorid = {1}",
                        runnerSponsor.RunnerId,
                        runnerSponsor.SponsorId),
                    connection);

            using (var reader = command.ExecuteReader())
            {
                if (reader.HasRows)
                {
                    connection.Close();
                    return true;
                }

                connection.Close();
                return false;
            }
        }