C# Tips, tricks and other .NET community related information like event notifications and helpful (hopefully :P) information. Please feel free to leave comments and/or contact me at any of methods on the left.

Community Lead wanted - Rhodes University - contact me ...

We are looking to setup a user community at Rhodes University in Grahamstown. I am looking for someone to help set it up... please mail me: dcoates at qzcreative.co.za

Integrate external content into your Sitefinity websites i.e. Picasa, Youtube, Facebook etc.

I found this and thought it might be useful. I didn’t write this. I have merely mastered and applied the art of Copy and Paste :). The original article is here -> http://www.graywebtech.com/blog/2009-06-12/Developers-Corner-Sitefinity-Social-Media-and-Multimedia-Enhancements.aspx

clip_image001[4]

Facebook Integration

Pull in friend lists and other information from facebook. Create seamless links between your website and facebook. Here is an article with the technical nuts and bolts; keep an eye out for future posts and examples. Read More

clip_image002[4]

YouTube Video List

Include your YouTube video play lists on your site. Visitors can scroll through and select a video to watch. Technical information

clip_image003[4]

Picasa Photo Gallery Integration

Take advantage of Picasa to highlight your product images and other photography. Our Picasa controls make it simple to integrate your albums into your website. Read More

clip_image004[4]

Enhanced Integration of 3rd Party RSS Feeds

It’s easier than ever to pull in news articles, blog posts, twitter feeds or any other RSS based information from other sites or applications. Take a look at this

clip_image005[4]

Native Integration of Windows Media Player

Quickly and easily add Windows Media Player audio and video files to your Sitefinity driven website. Upload videos from the administrative section just like any other file and select what page to add the video to. Read More

clip_image006[4]

Google Checkout Integration

Makes setting up an ecommerce site even easier. Read More

Presenter Profile - Ian van der Walt

Thanks to Ian for doing a presentation on Code Access Security last week. He gave a broad overview of the concepts of Code Access Security and how to get started.

Here is a little more about Ian: Although he started out with a MCP VB 6 for Desktop Applications qualification, his first couple of years in IT was spent mostly in web development - ASP, Javascript and VB, and then moving on to ASP.NET. Later he had his first proper exposure to Windows Forms development joining the corporate world as senior developer at a large national health company. However, the differences between IT as a cost center in a large organisation, to IT as the profit center meant he couldn't resist the opportunity to move to a small, dynamic and cutting edge IT company which is where he is currently employed as Senior Systems Developer. At the moment he is using C# and SQL Server on the .NET platform, in conjunction with the LLBLGen Pro ORM, on his biggest project to date, a Windows Forms billing system for a local municipality.

 

 

Enable Tracing and Output of generated SQL in LLBLGen Pro

We had the LLBLGen Pro Workshop on the weekend and discussed viewing the query generated by LLBLGen Pro during debugging or if you would like to learn how LLBLGen Pro works and how it generates the required SQL. Ian van der Walt checked the documentation and provided the following excerpt:

(See: Generated code - Troubleshooting and debugging)
"LLBLGen Pro's generated code offers two categories of tracing: info level and verbose level, and a variety of trace switches to switch tracing on or off. When a trace switch is switched on, the runtime libraries will produce trace output, depending on which switch you've turned on and to which level: verbose or info.
...
All trace switches have to be defined in the .config file, in a system.Diagnostics tag, which has to be placed inside the configuration tag. You don't have to define all switches, you can omit any switch definition if you'd like. When a switch isn't defined, it's considered turned off and no trace information is produced which is tied to that switch. The following snippet shows all available trace switches. These switches are described in detail in the following sections. The snippet below defines some switches with the value '3' (info level, switched on), '4' (verbose level, switched on) or '0' (switched off)

<system.diagnostics>
<
switches>
<
add name="SqlServerDQE" value="3" />
<
add name="AccessDQE" value="4" />
<
add name="OracleDQE" value="4" />
<
add name="FirebirdDQE" value="4" />
<
add name="MySqlDQE" value="4" />
<
add name="DB2DQE" value="4" />
<
add name="PostgeSqlDQE" value="4" />
<
add name="SybaseAsaDQE" value="4" />
<
add name="SybaseAseDQE" value="4" />
<
add name="ORMGeneral" value="0" />
<
add name="ORMStateManagement" value="0" />
<
add name="ORMPersistenceExecution" value="3" />
<
add name="LinqExpressionHandler" value="3" />
</
switches>
</
system.diagnostics>


I recommend Verbose Level (4) in order to view the SQL generated in the Output window when debugging the application.



Thanks for pointing us in the right direction Ian! :)



Comma separated list from CheckedListBox checked items

I needed to get a comma separated list of all the text values of the checked items and/or their values on a checkedlistbox, so I decided to write methods we can use in our helper class library. Here are the methods I wrote. Hopefully someone else will find it useful:

       /// <summary>
///
Gets the text from checked list.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="control">
The control.</param>
/// <param name="columnName">
Name of the column.</param>
/// <returns></returns>
/// <remarks>
Dave Coates - 2009/06/24</remarks>
public static string GetTextFromCheckedList<T>(T control) where T : CheckedListBox
{
string strCheckedItemsText = "";
System.Windows.Forms.CheckedListBox ListControl = control as CheckedListBox;

if (ListControl.CheckedItems.Count > 0)
{
for (int i = 0; i < ListControl.Items.Count; i++)
{
if (ListControl.GetItemChecked(i))
{
strCheckedItemsText += ListControl.GetItemText(ListControl.Items[i]) + ",";
}
}
strCheckedItemsText = strCheckedItemsText.TrimEnd(',');
}
return strCheckedItemsText;
}

/// <summary>
///
Gets the indices from checked list box.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="control">
The control.</param>
/// <returns></returns>
/// <remarks>
Dave Coates - 2009/06/24</remarks>
public static string GetIndicesFromCheckedListBox<T>(T control) where T : CheckedListBox
{
string strSelectedIndices = "";
System.Windows.Forms.CheckedListBox ListControl = control as CheckedListBox;

if (ListControl.CheckedItems.Count > 0)
{
for (int i = 0; i < ListControl.Items.Count; i++)
{
if (ListControl.GetItemChecked(i))
{
strSelectedIndices += ((System.Data.DataRowView)(ListControl.Items[i])).Row.ItemArray[1].ToString() + ",";
}
}
strSelectedIndices = strSelectedIndices.TrimEnd(',');
}
else
{
strSelectedIndices = "-1";
}
return strSelectedIndices;
}