Posts

Sending Email from .NET

I have created an Email Class in C# which can be called from other applications to send email using SMTP protocol. We may create a C# DLL based on the following class and then add reference of the dll in the calling application. using System; using System.Collections.Generic; using System.Text; using System.Net.Mail; using System.Net; using System.IO; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; namespace   FazlulsEmail { public class Email { public string sendEmail( string [] toAddressList, string [] ccAddressList, string [] bccAddressList, string subject, string body, string fromAddress, bool isHTML) { MailMessage message = new MailMessage ( new MailAddress (fromAddress), new MailAddress (toAddressList[0])); for ( int i = 1; i < toAddressList.Length; i++) { message.To.Add( new MailAd...

Programmatically Export from SQL Reporting Services in C#

Here is the sample code for rendering SQL Reporting Services Report to desired file types (PDF, XLS etc.): private void generateReport( string _ReportName, string _period1, string _period2, string _division, string _department, string _employee) { try { string _ReportServer = System.Configuration. ConfigurationManager .ConnectionStrings[ "ReportServer" ].ToString(); string _ReportPath = System.Configuration. ConfigurationManager .ConnectionStrings[ "ReportPath" ].ToString(); ReportViewer1.ProcessingMode = ProcessingMode .Remote; Uri ReportURI = new Uri (_ReportServer); this .ReportViewer1.ServerReport.ReportServerUrl = ReportURI; this .ReportViewer1.ServerReport.ReportPath = _ReportPath + _ReportName; int repParams = 2; switch (_ReportName) { case "/ExpenseReportByDivision" : repParams = 2; break ; case "/ExpenseReportByDepartment" : repParams = 3; break ; case "/ExpenseReportByEmployee" : ...

Displaying Flash as SharePoint Dashboard

Image
There are many ways to display flash content in SharePoint. The easiest of these is to use Content Editor Web Part. We may have to create a document library to store uploaded flash files for Dashboard display. Then create a new Web Part Page. Then go to Site Actions-> Edit Page. This will open up the page in design mode. Click on Add Web Part on a specific region and Select Content Editor Web Part. Then click on Edit button from the top right corner of the Web Part and Select Modify Shared Web Part. The property panel of the web part will be displayed at the right side of the page. Then select the Source Editor button. Update and Paste the following text into the modal window of Source Editor:   <OBJECT id="Web Part By Fazlul" style="WIDTH: 828px; HEIGHT: 572px" codeBase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0 height=572 width=828 classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000>   <PARAM N...

How to Create & Deploy Stored Procedure from C# [CLR 3.5]

Image
It was really tough to go back and forth between Visual Studio and SQL management Studio to create and reference back stored procedures. And, you have to have the SQL skill set to create SQL scripts at the Back End. But, it has become simpler now a days. Microsoft came up with a new project type to create SQL database projects right inside Visual Studio 2008. Follow the same .NET syntaxes while creating a Data Connection/Data Commands/Data Readers etc. I will briefly walk through the process: 1. Create a SQL Server Project in C# 2. Select the Database Reference 3. Add a Stored Procedure Class 4. Write the Stored Procedure Like This: using System; using System.Data; using System.Data.SqlClient; using System.Data.SqlTypes; using Microsoft.SqlServer.Server; public partial class StoredProcedures { [Microsoft.SqlServer.Server.SqlProcedure] public static void MySP1(string _UNID) { try { SqlConnection conn = new SqlConnection(); conn.Connect...

Create your First Silverlight Application using LINQ and Web Services

Image
Create your First Silver light Application using LINQ and Web Services 1. Create a New Silverlight Application project and name it “ImageViewer” 2. Select ASP .NET Web Application Project and change the name for the web project to “ImageViewer_Web” 3. The solution includes two projects. One is for the Silverlight Control [i.e. ImageViewer] and Another one is for the ASP .NET web system [i.e ImageViewer_Web] 4. Now, we have to create a data context using LINQ to SQL features in ImageViewer_Web project. To do that, right click on the Web Project and Select Add->New Item and Select LINQ to SQL Classes 5. Then Open Server Explorer (View->Server Explorer). Create a connection to the “ImageViewer” database and drag and drop the Tables (tblIndex, DocType, tblDoc) into the left pane and Stored Procedures (getDocuments(), getDocumentTypes()) into the right pane of ImgDataManager.dbml 6. Name the data context as “ImgDataManagerDataContext” and set Serialization mode to Unidirectional 7. If...

Developing Business Process and Integration Solutions Using Microsoft BizTalk Server 2006

Windows Workflow Foundation - ORCAS