Are you going to the OpenForce Europe conference being held in conjunction with the annual SDC (Software Developers Conference) in the Netherlands..

This is the second OpenForce Europe conference, although SDC has been running much longer.

If so – I look forward to meeting you.  I will be presenting 3 talks.

  • NN15 – Creating Testable Modules
  • NN16 – A Deep Dive into DotNetNuke 5.0
  • NN17 – A Deep Dive into the DotNetNuke Proeprty Editor

So come on by and introduce yourself.


Posted in: DotNetNuke  Tags: , ,

In previous blog posts in this series on creating testable modules I have show how the various layers of a DotNetNuke module can be built and tested independently.  In this blog we will create the LinksView UserControl and demonstrate in the browser that everything does indeed work as expected.

The LinksView UserControl

Lets first take a look at the code file for the UserControl.  As we would expect the UserControl has to implement the ILinksView interface.  As we are writing a DotNetNuke Module it must also implement the IModuleControl interface.  In DotNetNuke 5.0 the IModuleControl interface replaces the PortalModuleBase class as the contract which all module controls must implement.

Listing 1 – The LinskView UserControl’s Code File
   1:  public partial class LinksView : ModuleUserControlBase, ILinksView
   2:  {
   3:      LinksViewPresenter presenter;
   4:   
   5:      public LinksView()
   6:      {
   7:          //Instantiate associated Presenter
   8:          presenter = new LinksViewPresenter(this, 
   9:                      new LinksRepository(new DataService()));
  10:      }
  11:   
  12:      public int ModuleId
  13:      {
  14:          get { return this.ModuleContext.ModuleId; }
  15:      }
  16:   
  17:      public List<Link> Links
  18:      {
  19:          set
  20:          {
  21:              grdLinks.DataSource = value;
  22:              grdLinks.DataBind();
  23:          }
  24:      }
  25:   
  26:      protected override void OnLoad(EventArgs e)
  27:      {
  28:          base.OnLoad(e);
  29:          presenter.OnViewLoaded();
  30:      }
  31:  }

In this case as we are creating a UserControl we can inherit from the new ModuleUserControlBase.  The View has to create an instance of the LinksViewPresenter, which in turn requires an instance of LinksRepository and an instance of DataService, and this is all wired up in the Constructor. 

The ModuleId property, which the presenter uses, wraps the ModuleId property of the IModuleControl’s ModuleContext property, while the Links property wraps the DataSource property of a DataGrid control on the ascx page.  Finally, the view’s OnLoad method calls the presenter’s OnViewLoaded method to make everything work.  This is similar to how we wired up the concrete View control in our HelloWorldMVP application.

Listing 2 - The LinskView UserControl’s ASCX File
   1:  <asp:DataGrid ID="grdLinks" runat="server" AutoGenerateColumns="false" 
   2:                  GridLines="None" ShowHeader="false">
   3:      <Columns>
   4:          <asp:TemplateColumn>
   5:              <ItemTemplate>
   6:                  <asp:HyperLink 
   7:                      ID="lnkLink" runat="server" CssClass="CommandButton" 
   8:                      NavigateUrl='<%# DataBinder.Eval(Container.DataItem,"LinkUrl") %>' 
   9:                      Text='<%# DataBinder.Eval(Container.DataItem,"LinkText") %>'
  10:                      ToolTip='<%# DataBinder.Eval(Container.DataItem,"Title")%>' />
  11:              </ItemTemplate>
  12:          </asp:TemplateColumn>
  13:      </Columns>
  14:  </asp:DataGrid>

Listing 2 shows the ascx file for the UserControl.  Here we just set up the binding to the various properties of our Link objects.

Registering the LinksMVP Module

We are now ready to Register the Links MVP module.  The process has changed a little in DotNetNuke 5.0. In Host/Module Definitions (or Host/Extensions) select the Create New action.  On the first page of the Create new Extension Wizard fill out the Package level properties (Figure 1) – Note:  if you launched the Wizard from the Module Definitions page (Rather than Extensions) you will not see the Select Extension Type drop-down.

Figure 1 – Creating the New Module Definition – Page 1
LinksMVPCreateModule1

The next Wizard page will allow you to set the Module properties. (Figure 2).

Figure 2 – Creating the New Module Definition – Page 2
LinksMVPCreateModule2

Finally, on the last Wizard page, if you intend this module for distribution, you can add some information about you or your company (Figure 3).

Figure 3 – Creating the New Module Definition – Page 3
LinksMVPCreateModule3

After selecting Next the Module will be registered.  You will need to add the Module Definition and the Module Control reference.  This is done in much the same way as it was prior to 5.0.

Setting up the Database

The last step is to create the database objects we will need.  We will do this by executing the same SQL we used in our DataService tests.

Listing 3 – The TSQL required to create the Links Table and GetLinks Procedure
   1:  CREATE TABLE {databaseOwner}[{objectQualifier}LinksMVP_Links](
   2:      [LinkId] [int] IDENTITY(1,1) NOT NULL,
   3:      [ModuleId] [int] NULL,
   4:      [LinkText] [nvarchar](250) NULL,
   5:      [LinkURL] [nvarchar](1000) NULL,
   6:      [Title] [nvarchar](250) NULL
   7:      CONSTRAINT [PK_{objectQualifier}LinksMVP_Links] PRIMARY KEY CLUSTERED ([LinkId] ASC)
   8:  )
   9:   
  10:  CREATE PROCEDURE {databaseOwner}[{objectQualifier}LinksMVP_GetLinks]
  11:            @ModuleId int
  12:  AS
  13:      SELECT *
  14:      FROM {databaseOwner}{objectQualifier}LinksMVP_Links
  15:                     WHERE ModuleID = @ModuleID
  16:  GO


Add the Module to a Page

Once the Module is registered and the Database obejcts have been created we can add an instance of our new module to a test page.  As there is no data we will not see anything, but we can use SQL Server Management Studio to add some links to the database.

Figure 4 – Adding Data to the Links Table
LinksMVPLinksTableData1

After adding links to the table, we can refresh the page and we should see a list of the links (Figure 5)

Figure 5 – The LinksMVP Module with two Links
LinksMVPLinksView

In the previous post in this series on my family history I described my research on the early references to Nurses in North Somerset, in particular the history of William Nurse of Chew Stoke.

Whether the theory discussed in this earlier article is correct or not the Nurse family can be traced with a high degree of confidence to a Robert and Sarah Nurse, who were living in Compton Dando in the 1730’s.[1]  Compton Dando parish is just south and west of Keynsham in the north of Somerset.

The first reference to Robert and Sarah Nurse in the parish register is to the baptism of a daughter, Ann on 8th July 1736.

In 1748 Robert leased a cottage[2] and some land “on the east side of the highway leading from Woollard to Houndstreet” for the princely sum of 3s 4d payable “at the 2 most usual feasts terms in the year (that is to say) the feast of St Michael the Archangel and the Annunciation of the Blessed Virgin Mary”.

In the lease, Robert is described as a Yeoman of the parish of Compton Dando.[3][4] There is another lease for the same property in 1762 where the rent increased to 4s 0d.

Figure 1 - Map of the Area around Compton Dando (~1782)
ComptonDandoMap1782

Figure 1 shows a map of the area around Compton Dando as it was in about 1782, where the road from Woollard to Houndstreet is shown quite clearly.

Over the course of the next 18 years six more of Robert and Sarah’s children were baptised in the parish church of Compton Dando. The two daughters and two sons - Thomas and John - were married in Compton Dando, Ann in 1757 to Thomas Ford, Thomas in 1763 to Mary Long (and in 1781 to Jane Pow), Sarah, the youngest, in 1773 to Robert Ashley and John, also in 1773, to Ann Dozens.

Samuel, my direct ancestor married Rachel Dolman at Keynsham on the 11th October 1772.[5][6] Keynsham was the home of the Dolman family[7], and the parish registers, and Land Tax records both contain many references to the Dolman name. [5][8]

In the Compton Dando Land Tax assessments for 1781,[9] Robert Nurse is mentioned as the occupier of three pieces of land, owned by James Pittman, Robert Ford and John Ford, the total assessment for these three pieces of land being £1 14s 3d (quite a considerable sum in those days). This may have been the same land on the Woolard-Houndstreete road mentioned earlier. [10]

Figure 2 - The Family of Robert and Sarah Nurse
 RobertSarahNurse

In December of 1781, just before Christmas, Robert Nurse died. He was buried at Compton Dando on 23rd December 1781. In the following year’s tax assessment, Sarah Nurse is shown as the occupier of only one of the pieces of land - the piece owned by James Pittman, which she continued to occupy until her death in December 1792.

She was also buried in Compton Dando, on 12th December 1792. In the parish register entry for her death it states that she was 84 years old. This is probably not completely accurate, as it would mean that she was 28 years old when she had her first child, and 46 years old when she had her last child. However, even if it is a slight exaggeration it was still a ripe old age indeed for the 18th century. It also states that she was a pauper.


Bibliography and Notes

[1] Parish Register for the Parish of Compton Dando Somerset, 1652-1812. Microfiched by the Somerset Record Office, Taunton.

[2] Somerset Record Office Ref DD / CD 5

[3] In English History a Yeoman refers to a class of men intermediate between the gentry and the labourers; a yeoman was usually a landholder, but could also be a retainer, guard, attendant, or subordinate official.

[4] Encyclopedia Brittanica, 15th Edition (1980), Micropaedia, X, p 814.

[5] Parish Register for the Parish of St. John, Keynsham, 1750 - 1807. Microfilmed by the Church of Jesus Christ Of Latter-Day Saints, Film No. 1526662.

[6] By the late 18th century, parishes were required to complete a standard registration form, and for both Sarah and Samuel’s marriages Robert Nurse is listed as a witness. Whether, this was the father or the elder brother is not clear, but it was probably the brother, as Samuel and Robert both moved to the Hanham area.

[7] Rachel Dollman was baptized in Keynsham parish on 16 Apr 1749 – the daughter of Jonathan and Sarah Dollman. There is no reference to Jonathan and Sarah’s marriage, but Jonathan was apparently baptized on 6 Jan 1714 – the son of Barnabas and Mary Dolman. Joanathan was buried in Keynsham Church on 4 Apr 1790 and his wife Sarah was buried on 20 Jul 1785. .

[8] Land Tax Records for the Parish of Keynsham, Somerset, 1766 – 1831. Microfilmed by the Church of Jesus Christ Of Latter-Day Saints, Film No. 1526847.

[9] Land Tax Records for the Parish of Compton Dando, Somerset, 1766 – 1831. Microfilmed by the Church of Jesus Christ Of Latter-Day Saints, Film No. 1526847.

[10] Whether this was the same land mentioned in the leases of 1748 and 1762 is not clear as the Land Tax records are specified differently from the lease documents.


 Search Blog

 Adsense

 Calendar

«  September 2010  »
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
27282930123
45678910
View posts in large calendar

 Tags

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2010 Thoughts from the Wet Coast