public IEnumerable <Picture> GetAll()
        {
            var pictures = new List <Picture>();

            using (var connection = new SqlConnection(helper.GetConnectionString()))
            {
                connection.Open();

                using (var command = new SqlCommand("GetPictures", connection))
                {
                    command.CommandType = CommandType.StoredProcedure;
                    SqlDataReader reader = command.ExecuteReader();

                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            var picture = new Picture
                            {
                                Id   = Convert.ToInt32(reader["Id"]),
                                Path = reader["Path"].ToString()
                            };

                            pictures.Add(picture);
                        }
                    }

                    reader.Close();
                }
            }

            return(pictures);
        }
        public IEnumerable <Email> GetAll()
        {
            var emails = new List <Email>();

            using (var connection = new SqlConnection(helper.GetConnectionString()))
            {
                connection.Open();

                using (var command = new SqlCommand("GetEmails", connection))
                {
                    command.CommandType = CommandType.StoredProcedure;
                    SqlDataReader reader = command.ExecuteReader();

                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            var email = new Email
                            {
                                Id      = Convert.ToInt32(reader["Id"]),
                                Address = reader["Address"].ToString()
                            };

                            emails.Add(email);
                        }
                    }

                    reader.Close();
                }
            }

            return(emails);
        }
        public IEnumerable <Category> GetAll()
        {
            var categories = new List <Category>();

            using (var connection = new SqlConnection(helper.GetConnectionString()))
            {
                connection.Open();

                using (var command = new SqlCommand("GetCategories", connection))
                {
                    command.CommandType = CommandType.StoredProcedure;
                    SqlDataReader reader = command.ExecuteReader();

                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            var category = new Category
                            {
                                Id   = Convert.ToInt32(reader["Id"]),
                                Name = reader["Name"].ToString()
                            };

                            categories.Add(category);
                        }
                    }

                    reader.Close();
                }
            }

            return(categories);
        }
        public IEnumerable <Event> GetAll()
        {
            var events = new List <Event>();

            using (var connection = new SqlConnection(helper.GetConnectionString()))
            {
                connection.Open();

                using (var command = new SqlCommand("GetEvents", connection))
                {
                    command.CommandType = CommandType.StoredProcedure;
                    SqlDataReader reader = command.ExecuteReader();

                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            var eventInst = new Event
                            {
                                Id   = Convert.ToInt32(reader["Id"]),
                                Name = reader["Name"].ToString()
                            };

                            events.Add(eventInst);
                        }
                    }

                    reader.Close();
                }
            }

            return(events);
        }
        public IEnumerable <Record> GetAll()
        {
            var records = new List <Record>();

            using (var connection = new SqlConnection(helper.GetConnectionString()))
            {
                connection.Open();

                using (var command = new SqlCommand("GetRecords", connection))
                {
                    command.CommandType = CommandType.StoredProcedure;
                    SqlDataReader reader = command.ExecuteReader();

                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            var record = new Record
                            {
                                Id          = Convert.ToInt32(reader["Id"]),
                                Name        = reader["Name"].ToString(),
                                CreateDate  = Convert.ToDateTime(reader["CreateDate"]),
                                Description = reader["Description"].ToString(),
                                CategoryId  = Convert.ToInt32(reader["CategoryId"]),
                                PictureId   = Convert.ToInt32(reader["PictureId"])
                            };

                            records.Add(record);
                        }
                    }

                    reader.Close();
                }
            }

            return(records);
        }
        public IEnumerable <User> GetAll()
        {
            var users = new List <User>();

            using (var connection = new SqlConnection(helper.GetConnectionString()))
            {
                connection.Open();

                using (var command = new SqlCommand("GetUsers", connection))
                {
                    command.CommandType = CommandType.StoredProcedure;
                    SqlDataReader reader = command.ExecuteReader();

                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            var user = new User
                            {
                                Id       = Convert.ToInt32(reader["Id"]),
                                Name     = reader["Name"].ToString(),
                                Password = reader["Password"].ToString(),
                                RoleId   = Convert.ToInt32(reader["RoleId"]),
                                EmailId  = Convert.ToInt32(reader["EmailId"])
                            };

                            users.Add(user);
                        }
                    }

                    reader.Close();
                }
            }

            return(users);
        }