예제 #1
0
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        

        public static RelatedClubs CreateRelatedClubs()
        {
            RelatedClubs clubs = new RelatedClubs();

            RelatedClubsMember newRelatedClubsMember = new RelatedClubsMember()
            {
                ClubId = 1,
                Name = "myclub"
            };
            newRelatedClubsMember.Type = Article.ArticleType.Club;
            clubs.ClubMember.Add(newRelatedClubsMember);

            newRelatedClubsMember = new RelatedClubsMember()
            {
                ClubId = 2,
                Name = "myclub2"
            };
            newRelatedClubsMember.Type = Article.ArticleType.Club;
            clubs.ClubMember.Add(newRelatedClubsMember);
            return clubs;
        }
예제 #2
0
        /// <summary>
        /// This methos gets the list of related clubs for a given article
        /// </summary>
        /// <param name="h2g2ID">The id of the article you want to get the related clubs for</param>
        static public RelatedClubs GetRelatedClubs(int h2g2ID, IDnaDataReaderCreator readerCreator)
        {
            RelatedClubs relatedClubs = new RelatedClubs();
            // Create a data reader to get all the clubs
            using (IDnaDataReader reader = readerCreator.CreateDnaDataReader("getrelatedclubs"))
            {
                reader.AddParameter("h2g2ID", h2g2ID);
                reader.Execute();
                // Add each club member in turn
                while (reader.Read())
                {
                    RelatedClubsMember member = new RelatedClubsMember();
                    member.ClubId = reader.GetInt32("ClubID");
                    member.Name = reader.GetString("Subject");
                    member.Type = Article.GetArticleTypeFromInt(reader.GetInt32NullAsZero("Type"));

                    

                    relatedClubs.ClubMember.Add(member);
                    //ExtraInfo clubExtraInfo = new ExtraInfo();
                    //clubExtraInfo.TryCreate(reader.GetInt32("Type"), reader.GetString("ExtraInfo"));
                    //clubNode.AppendChild(ImportNode(clubExtraInfo.RootElement.FirstChild));
                    //if (reader.Exists("DateCreated"))
                    //{
                    //    XmlNode dateCreatedNode = AddElementTag(clubNode, "DATECREATED");
                    //    dateCreatedNode.AppendChild(DnaDateTime.GetDateTimeAsElement(RootElement.OwnerDocument, reader.GetDateTime("DateCreated"), true));
                    //}
                    //if (reader.Exists("Lastupdated"))
                    //{
                    //    XmlNode dateCreatedNode = AddElementTag(clubNode, "LASTUPDATE");
                    //    dateCreatedNode.AppendChild(DnaDateTime.GetDateTimeAsElement(RootElement.OwnerDocument, reader.GetDateTime("DateCreated"), true));
                    //}

                    // NEED TO ADD EDITOR, CLUBMEMBERS, LOCAL, EXTRAINFO, STRIPPED NAME... CHECK CLUB MEMBERS
                }
            }
            return relatedClubs;
        }