Example #1
0
 public Exercise GetExerciseByID(int exerciseID)
 {
     Exercise exercise = new Exercise();
     string query = "SELECT * FROM Exercise WHERE ExerciseID = @exerciseID";
     helper.AddParameters(new List<SqlParameter>() { new SqlParameter("@exerciseID", exerciseID) });
     SqlDataReader reader = helper.ExecuteReader(query);
     reader.Read();
     exercise.ExerciseID = exerciseID;
     exercise.ExerciseType = reader.GetString(1);
     reader.Close();
     return exercise;
 }
Example #2
0
        public MyDictionary GetWordByID(int wordID)
        {
            string query = "SELECT * FROM Dictionary WHERE WordID = @wordID";

            helper.AddParameters(new List <SqlParameter>()
            {
                new SqlParameter("@wordID", wordID)
            });
            SqlDataReader reader = helper.ExecuteReader(query);

            reader.Read();
            MyDictionary word = GetWord(reader);

            reader.Close();
            return(word);
        }
Example #3
0
        public Payment GetPaymentByID(int paymentID)
        {
            string query = "SELECT * FROM Payment WHERE PaymentID = @paymentID";

            helper.AddParameters(new List <SqlParameter>()
            {
                new SqlParameter("@paymentID", paymentID)
            });
            SqlDataReader reader = helper.ExecuteReader(query);

            reader.Read();
            Payment payment = GetPayment(reader);

            reader.Close();
            return(payment);
        }
Example #4
0
        public PaymentType GetTypeByID(int typeID)
        {
            string query = "SELECT * FROM PaymentType WHERE TypeID = @typeID";

            helper.AddParameters(new List <SqlParameter>()
            {
                new SqlParameter("@typeID", typeID)
            });
            SqlDataReader reader = helper.ExecuteReader(query);

            reader.Read();
            PaymentType type = GetPaymentType(reader);

            reader.Close();
            return(type);
        }
Example #5
0
        public UserRole GetRoleByID(int RoleID)
        {
            UserRole role  = new UserRole();
            string   query = "SELECT * FROM UserRole WHERE RoleID = @roleID";

            helper.AddParameters(new List <SqlParameter>()
            {
                new SqlParameter("@roleID", RoleID)
            });
            SqlDataReader reader = helper.ExecuteReader(query);

            reader.Read();
            role.RoleID   = RoleID;
            role.RoleName = reader["RoleName"].ToString();
            reader.Close();
            return(role);
        }
Example #6
0
        public Pool GetPoolByID(int poolID)
        {
            Pool   deadpool = new Pool();
            string query    = "SELECT * FROM Pool WHERE PoolID = @poolID";

            helper.AddParameters(new List <SqlParameter>()
            {
                new SqlParameter("@poolID", poolID)
            });
            SqlDataReader reader = helper.ExecuteReader(query);

            reader.Read();
            deadpool.PoolID      = poolID;
            deadpool.ExerciseID  = reader.GetInt32(1);
            deadpool.UserID      = reader.GetInt32(2);
            deadpool.PoolName    = reader.GetString(3);
            deadpool.CreatedDate = reader.GetDateTime(4);
            deadpool.IsActive    = reader.GetBoolean(5);
            reader.Close();
            return(deadpool);
        }
Example #7
0
        public User GetUserByID(int userID)
        {
            string query = "SELECT * FROM [User] WHERE UserID = @userID";
            User   user  = new User();

            _helper.AddParameters(new List <SqlParameter>()
            {
                new SqlParameter("@userID", userID)
            });
            SqlDataReader reader = _helper.ExecuteReader(query);

            reader.Read();
            user = GetUser(reader);
            reader.Close();
            return(user);
        }