예제 #1
0
        internal Institution LoadInstitution(Attendee a)
        {
            Institution institution = null;
            var         im          = new InstitutionMapper(this.context);
            var         parameters  = new List <IDataParameter>
            {
#pragma warning disable IDE0009 // Member access should be qualified.
                new SqlParameter("@id", a.Id)
#pragma warning restore IDE0009 // Member access should be qualified.
            };
            var query = "Select institutionId from [User] where id=@id";

            using (var rd = this.ExecuteReader(query, parameters))
            {
                while (rd.Read())
                {
                    var key = rd.GetInt32(0);
                    institution = im.Read(key);
                }
            }

            return(institution);
        }
예제 #2
0
        public IEnumerable <Reviewer> GetCompatibleReviewers(int article)
        {
            var list   = new List <Reviewer>();
            var mapper = new InstitutionMapper(this.context);

            using (IDbCommand command = this.context.CreateCommand())
            {
                command.CommandText = "GetCompatibleReviewersForArticle";
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.Add(new SqlParameter("@articleId", article));
                var reader = command.ExecuteReader();
                while (reader.Read())
                {
                    list.Add(new Reviewer
                    {
                        Id          = reader.GetInt32(0),
                        Name        = reader.GetString(1),
                        Email       = reader.GetString(2),
                        Institution = mapper.Read(reader.GetInt32(3))
                    });
                }
            }
            return(list);
        }