Adding records to Umbraco Contour programmatically

I just had to programmatically add records to an Umbraco Contour Form. Since I couldn’t find any documentation on how to do this, I thought I would post how I did this.

I have an input box (tbEmail) and a button (btnSubmit). On the click event of btnSubmit I got the following code, that adds a record to the form.

btnSubmit_Click
  1. protected void btnSubmit_Click(object sender, EventArgs e)
  2.         {
  3.             var recordStorage = new RecordStorage();
  4.             var formStorage = new FormStorage();
  5.             var form = formStorage.GetForm(new Guid("my form guid"));
  6.  
  7.             var recordService = new RecordService(form);
  8.             recordService.Open();
  9.  
  10.             var record = recordService.Record;
  11.             record.IP = Request.UserHostAddress;
  12.             record.UmbracoPageId = umbraco.presentation.nodeFactory.Node.GetCurrent().Id;
  13.             recordStorage.InsertRecord(record, form);
  14.             foreach (var field in recordService.Form.AllFields)
  15.             {
  16.                 if (field.Caption == "#Email")
  17.                 {
  18.                     var key = Guid.NewGuid();
  19.                     var recordField = new RecordField()
  20.                     {
  21.                         Field = field,
  22.                         Key = key,
  23.                         Record = record.Id,
  24.                         Values = new List<object>() { tbEmail.Text }
  25.                     };
  26.                     var recordFieldStorage = new RecordFieldStorage();
  27.                     recordFieldStorage.InsertRecordField(recordField);
  28.                     record.RecordFields.Add(key, recordField);
  29.                 }
  30.             }
  31.             recordService.Submit();
  32.             recordService.SaveRecord();
  33.             recordService.Dispose();
  34.         }</object>

New Umbraco Package

I’ve just made a new Umbraco Package. What it does is, that it automatically creates canonical meta tags, if the url used is not the one found by Umbracos NiceUrl. Especially useful if you use umbracoUrlAlias or umbracoUseDirectoryUrls

To use the extension, download the package and install it to your Umbraco solution. When done, just add the [DI]Canonical macro to your templates. If you have a page, that uses that template and uses umbracoUrlAlias and the user/search enginge came via that link, the canonical meta tag will be present in the header.

You can download the source and package at codeplex

Videos from past concerts

Just added some videos from previous ceoncerts I’ve been to.

See them here

“Wild life” vacation day 3

On the third day of our vacation we took the ferry from Fynshav to Bøjden on Fyn. From here we drove to Langeland with a stop at Valdemar Castle where Sigurd was in the ocean and played with his new toy – a floating ring.

After Valdemar Slot we went to Langeland, which is a very beautiful island. Especially the southern part of Langeland. We didn’t do much here except enjoying the nature and each other. One of the things we did see was a sanctuary which among other species also had wild horses.

“Wild life” vacation day 2

On the second day of our vacation we decided to go further south. The newest member of the royal family was to be christened on this day in Møgeltønder. We didn’t know when, but decided to go to Møgeltønder in the morning, and see what all the excitement was all about. When we arrived there wasn’t much excitement though, only a lot of people from the press setting up equipment. We decided to call a lifeline, to hear at what time the christening was planned. It turned out there were several hours to the event. So we decided to take a walk in the park and the beautiful old city and then move on.

After our stroll in the park and city, we went to Højer Sluse to see the view, then Tønder where we had lunch. After lunch we drove to Als and found a nice spot in a forest just next to the beach with a view over Fynshav. We also brought a bit of luxury into the wild, so opened a bottle of Rosé and a box of the best chocolate in the world – Neuhaus and enjoyed each others company, the wine, chocolate and the view.

“Wild life” vacation day 1

In this week we (my girlfriend Karin, My self and our dog Sigurd) went on a tent trip. The first of its kind for me – hence the title. We packed the car with a tent, sleeping bags, clothes, cooling back etc. and went on our adventure. We planned in advance that we would go to the southern part of Denmark. According to DMI that part of the country had the best weather forecast.

On the first day we first went to Givskud Zoo. After that visit we went furher south to Jels. Parked the car by Nedersø, which we to a walk around. Had dinner at Royal Oak Golf Club half ways and then went for rest of the walk.
At night we stayed at campsite. Don’t want to start the “wild life” vacation out to hard…..

Walk in closet pt. 1

Our new closet can now be taken into use. Still not finished, but usable.

We went looking

Yesterday we went looking at three different houses. They were all good in their own way, but one stood out. The house I mentioned the other day. So if we can agree on a contract, that is going to be our new home :-)

nemhandel.dk on Umbraco

How did I forget about this. Last week we launched nemhandel.dk. Nemhandel.dk is build on Umbraco and is, what I think a nice implementation of a public sector site.

New potential house

After this weekends situation regarding our housing situation, we’ve managed to find an even better potential. It’s located in a city near Aarhus called Hørning. It looks very positive. We are going to see it in live on wednesday and hopefully it’s as good as it seems, although nothing ever seems to be :-)

You can see a few pictures here:

←Older