<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-8958778003335982314</id><updated>2011-07-08T21:13:33.667+05:00</updated><category term='c#'/><category term='visual studio 2010 Beta'/><category term='.net framework 4.0'/><category term='Observer pattern in dot net'/><category term='dynamic'/><category term='Observer Design pattern'/><category term='SSRS'/><category term='Sql Server'/><category term='Sql Server Reporting Service'/><category term='IObserver(T)'/><category term='IObservable(T)'/><category term='Render SSRS Report'/><category term='Report'/><category term='Code Contact'/><title type='text'>Yet Another Dot Net Blog</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://rkzico.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8958778003335982314/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://rkzico.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>zico</name><uri>http://www.blogger.com/profile/10859686585050923448</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>12</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8958778003335982314.post-5551912894994909447</id><published>2009-12-31T19:05:00.014+05:00</published><updated>2010-01-13T15:19:35.274+05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='IObservable(T)'/><category scheme='http://www.blogger.com/atom/ns#' term='.net framework 4.0'/><category scheme='http://www.blogger.com/atom/ns#' term='Observer pattern in dot net'/><category scheme='http://www.blogger.com/atom/ns#' term='Observer Design pattern'/><category scheme='http://www.blogger.com/atom/ns#' term='IObserver(T)'/><title type='text'>IObservable (T) and IObserver(T)  in .Net 4.0: Implemt push based notification using observer pattern</title><content type='html'>&lt;div&gt;.Net framework 4.0 is going to come up with two new interfaces &lt;a href="http://msdn.microsoft.com/en-us/library/dd990377%28VS.100%29.aspx"&gt;IObservable&lt;/a&gt;&lt;t&gt; and &lt;a href="http://msdn.microsoft.com/en-us/library/dd783449%28VS.100%29.aspx"&gt;IObserver&lt;/a&gt;&lt;t&gt;. These interfaces is going to give a cleaner way to implement &lt;a href="http://en.wikipedia.org/wiki/Observer_pattern"&gt;observer pattern&lt;/a&gt; in your code. In observer design pattern there are two parties involved. One is observer  and another is subject.The subject maintains a list of observers and notifies  them in case of change in its state.&lt;/t&gt;&lt;/t&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In .net framework 4 the implementation of observer pattern can be achieved by implementing two interfaces IObservable&lt;t&gt; and IObserver&lt;t&gt;. The class implementing IObservable&lt;t&gt; plays the role of subject and the class implemeniting IObserver&lt;t&gt; acts as observer.&lt;/t&gt;&lt;/t&gt;&lt;/t&gt;&lt;/t&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;Let us assume that a 'Blog' has some subscribers who want to be notified after every article posted in the 'Blog'. So we can say that here the readers are subscribers to the 'Blog' and they are observer. On the other hand 'Blog' is the subject or observable. When a new article is posted in the blog subscriber will be notified about the article. The following block of codes will help you to understand  you can implement this in .net framework 4.0 with two new interfaces.&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;namespace ObserverExample&lt;br /&gt;{&lt;br /&gt;    class Program&lt;br /&gt;    {&lt;br /&gt;        static void Main(string[] args)&lt;br /&gt;        {&lt;br /&gt;         Blog blog = new Blog();&lt;br /&gt;         /***********Subscribe to the blog********/&lt;br /&gt;         blog.Subscribe(new Subscriber { Name = "Alex" , Email="alex@abc.com"});&lt;br /&gt;         blog.Subscribe(new Subscriber { Name = "Kevin",  Email = "kevin@abc.com" });&lt;br /&gt;         blog.Subscribe(new Subscriber { Name = "Kelly",  Email="kelly@mail.com"});  &lt;br /&gt;&lt;br /&gt;         blog.PostArticle();&lt;br /&gt;         Console.ReadLine();&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public class Article&lt;br /&gt;    {&lt;br /&gt;        public string Title&lt;br /&gt;        {&lt;br /&gt;            get;&lt;br /&gt;            set;&lt;br /&gt;        }&lt;br /&gt;        public string Content&lt;br /&gt;        {&lt;br /&gt;            get;&lt;br /&gt;            set;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        public string Url&lt;br /&gt;        {&lt;br /&gt;            get;&lt;br /&gt;            set;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;   &lt;br /&gt;    public class Blog : IObservable&amp;lt;Article&amp;gt;&lt;br /&gt;    {&lt;br /&gt;        List&amp;lt;IObserver&amp;lt;Article&amp;gt;&amp;gt; observers = new List&amp;lt;IObserver&amp;lt;Article&amp;gt;&amp;gt;();&lt;br /&gt;        Article _article;&lt;br /&gt;       &lt;br /&gt;        #region IObservable&amp;lt;user&amp;gt; Members&lt;br /&gt;        public IDisposable Subscribe(IObserver&amp;lt;Article&amp;gt; observer)&lt;br /&gt;        {&lt;br /&gt;            observers.Add(observer);&lt;br /&gt;            return observer as IDisposable;&lt;br /&gt;        }&lt;br /&gt;        #endregion&lt;br /&gt;&lt;br /&gt;        public void PostArticle()&lt;br /&gt;        {&lt;br /&gt;            _article = new Article { Content="Cleaner way to implement observer", Title="Observer pattern in .net 4.0", Url="http://observer.blog.com"};&lt;br /&gt;           &lt;br /&gt;            /*********Save article and then notify observers*****************/&lt;br /&gt;            foreach (IObserver&amp;lt;article&amp;gt; observer in observers)&lt;br /&gt;            {&lt;br /&gt;                observer.OnNext(_article);&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public class Subscriber : IObserver&amp;lt;Article&amp;gt;&lt;br /&gt;    {&lt;br /&gt;        #region IObserver&amp;lt;Article&amp;gt; Members&lt;br /&gt;        public string Name&lt;br /&gt;        {&lt;br /&gt;            get;&lt;br /&gt;            set;&lt;br /&gt;        }&lt;br /&gt;        public string Email&lt;br /&gt;        {&lt;br /&gt;            get;&lt;br /&gt;            set;&lt;br /&gt;        }&lt;br /&gt;        public void OnCompleted()&lt;br /&gt;        {&lt;br /&gt;            Console.WriteLine("Finished sending notification.");&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        public void OnError(Exception error)&lt;br /&gt;        {&lt;br /&gt;            Console.WriteLine("Error sending notification");&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        /****************This is the function which will be called to notify observer***************/&lt;br /&gt;        public void OnNext(Article value)&lt;br /&gt;        {&lt;br /&gt;            /*************Writing to console****************/&lt;br /&gt;            /************You should write code here according to your notification mechanism to the subscriber/observer ************/&lt;br /&gt;            Console.WriteLine("Name:{0} Email:{1}", this.Name, this.Email);&lt;br /&gt;            Console.WriteLine("Title:{0}\n Content:{1}", value.Title,value.Content);&lt;br /&gt;        }&lt;br /&gt;        #endregion&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt; Though the example is trivial I hope this one will help anyone to understand how to implement observer pattern in a cleaner way in framewok 4.0.&lt;br /&gt;&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;input id="gwProxy" type="hidden"&gt;&lt;!--Session data--&gt;&lt;input onclick="jsCall();" id="jsProxy" type="hidden"&gt;&lt;div id="refHTML"&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8958778003335982314-5551912894994909447?l=rkzico.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rkzico.blogspot.com/feeds/5551912894994909447/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rkzico.blogspot.com/2009/12/implement-push-based-notification-in.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8958778003335982314/posts/default/5551912894994909447'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8958778003335982314/posts/default/5551912894994909447'/><link rel='alternate' type='text/html' href='http://rkzico.blogspot.com/2009/12/implement-push-based-notification-in.html' title='IObservable (T) and IObserver(T)  in .Net 4.0: Implemt push based notification using observer pattern'/><author><name>zico</name><uri>http://www.blogger.com/profile/10859686585050923448</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8958778003335982314.post-3531037986936713769</id><published>2009-07-30T17:14:00.002+06:00</published><updated>2009-08-24T08:24:33.325+06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='c#'/><category scheme='http://www.blogger.com/atom/ns#' term='Code Contact'/><title type='text'>Code Contact Article In MSDN Magazine</title><content type='html'>&lt;strong style="font-weight: normal;"&gt;Melitta Andersen  posted a nice article on Code Contact in MSDN magazine. You can find it &lt;a href="http://msdn.microsoft.com/en-us/magazine/ee236408.aspx"&gt;here&lt;/a&gt;.&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8958778003335982314-3531037986936713769?l=rkzico.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rkzico.blogspot.com/feeds/3531037986936713769/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rkzico.blogspot.com/2009/07/code-contact-article-in-msdn-magazine.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8958778003335982314/posts/default/3531037986936713769'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8958778003335982314/posts/default/3531037986936713769'/><link rel='alternate' type='text/html' href='http://rkzico.blogspot.com/2009/07/code-contact-article-in-msdn-magazine.html' title='Code Contact Article In MSDN Magazine'/><author><name>zico</name><uri>http://www.blogger.com/profile/10859686585050923448</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8958778003335982314.post-3892063775334617926</id><published>2009-06-10T01:46:00.002+06:00</published><updated>2009-06-10T02:02:46.963+06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='dynamic'/><category scheme='http://www.blogger.com/atom/ns#' term='.net framework 4.0'/><category scheme='http://www.blogger.com/atom/ns#' term='visual studio 2010 Beta'/><category scheme='http://www.blogger.com/atom/ns#' term='c#'/><title type='text'>Dynamic Programming With .Net  Framework 4.0 and C#</title><content type='html'>Microsoft have introduced new Dynamic Language Runtime with framework 4.0 . This API supports a new type &lt;a href="http://msdn.microsoft.com/en-us/library/dd264736%28VS.100%29.aspx"&gt;dynamic&lt;/a&gt; which enables dynamic features in statically typed language like C#.&lt;br /&gt;&lt;br /&gt;Below are two important findings about dynamic type from MSDN.&lt;br /&gt;&lt;br /&gt;1. The type dynamic is a static type but an object of type dynamic bypasses compile time checking.&lt;br /&gt;&lt;br /&gt;2.At compile time dynamic variables are compiled into variables of type object.Therefore, type dynamic exists only at compile time not at runtime.&lt;br /&gt;&lt;br /&gt;As all of you will find everything detail in &lt;a href="http://msdn.microsoft.com/en-us/library/dd264736%28VS.100%29.aspx"&gt;MSDN&lt;/a&gt; I am Jumping into the code directly.&lt;br /&gt;&lt;br /&gt;For the sake of simplicity to show how the dynamic type works in C# I am declaring a naive class MyDateTime which is a skeleton of the .Net Type DateTime.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;public class MyDateTime&lt;br /&gt;{&lt;br /&gt;   public int Month&lt;br /&gt;       {&lt;br /&gt;           get { return dateTime.Month;}&lt;br /&gt;       }&lt;br /&gt;       public int Year&lt;br /&gt;       {&lt;br /&gt;           get { return dateTime.Year; }&lt;br /&gt;       }&lt;br /&gt;       public int Day&lt;br /&gt;       {&lt;br /&gt;           get { return dateTime.Day; }&lt;br /&gt;       }&lt;br /&gt;&lt;br /&gt;     &lt;br /&gt;       private DateTime dateTime;&lt;br /&gt;&lt;br /&gt;       public MyDateTime()&lt;br /&gt;       {&lt;br /&gt;           dateTime = new DateTime();&lt;br /&gt;       }&lt;br /&gt;&lt;br /&gt;       public MyDateTime(int day, int month, int year)&lt;br /&gt;       {&lt;br /&gt;           dateTime = new DateTime(year, month, day);&lt;br /&gt;       }&lt;br /&gt; &lt;br /&gt;   public override string ToString()&lt;br /&gt;       {&lt;br /&gt;           return  dateTime.ToString("MM/dd/yyyy");&lt;br /&gt;       }&lt;br /&gt;&lt;br /&gt;       public void AddDays(int numberOfDays)&lt;br /&gt;       {&lt;br /&gt;          dateTime = dateTime.AddDays(numberOfDays);&lt;br /&gt;       }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Now we can use it like&lt;br /&gt;&lt;br /&gt;dynamic dateTime = new MyDateTime(6,9,2009);&lt;br /&gt;Console.WriteLine("Date:{0} ",dateTime);&lt;br /&gt;Console.WriteLine("Month:{0}",dateTime.Month);&lt;br /&gt;Console.WriteLine("Day{0}:",dateTime.Day);&lt;br /&gt;Console.WriteLine("year:{0}",dateTime.Year);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;No compile time type checking will occur for the variable dateTime in the above WriteLine methods.&lt;br /&gt;&lt;br /&gt;We can also call AddDays function of MyDateTime object through the dynamic type variable dateTime&lt;br /&gt;&lt;br /&gt;dateTime.AddDays(7);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;But one drawback with this dynamic thing is that you can call any method or access any property which is not actually present in the statically typed object.&lt;br /&gt;&lt;br /&gt;So if we call a method SubtractDays for our early dateTime variable&lt;br /&gt;&lt;br /&gt;dateTime.SubtractDays(7)&lt;br /&gt;&lt;br /&gt;it will not signal us any error at compile time. But at runtime we will fell trap of RuntimeBinderException saying 'MyDateTime does not  contain a defination for SubtractDays'.&lt;br /&gt;&lt;br /&gt;Reference: &lt;a href="http://msdn.microsoft.com/en-us/library/dd233052%28VS.100%29.aspx"&gt;MSDN&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8958778003335982314-3892063775334617926?l=rkzico.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rkzico.blogspot.com/feeds/3892063775334617926/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rkzico.blogspot.com/2009/06/dynamic-programming-with-net-framework.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8958778003335982314/posts/default/3892063775334617926'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8958778003335982314/posts/default/3892063775334617926'/><link rel='alternate' type='text/html' href='http://rkzico.blogspot.com/2009/06/dynamic-programming-with-net-framework.html' title='Dynamic Programming With .Net  Framework 4.0 and C#'/><author><name>zico</name><uri>http://www.blogger.com/profile/10859686585050923448</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8958778003335982314.post-5506207461704048298</id><published>2009-05-19T19:46:00.000+06:00</published><updated>2009-05-24T15:22:03.875+06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Render SSRS Report'/><category scheme='http://www.blogger.com/atom/ns#' term='SSRS'/><title type='text'>Sql Server Reporting Service : Rendering Report From C# Code &amp; Save The Report</title><content type='html'>One of the requirement for our last project was  after generating the report the report link would be emailed to client. The client will follow the link and download the report in PDF format. So we decided that after generating the report we will save the report in the file system in PDF format.To achieve the goal we have gone through the following steps.&lt;br /&gt;&lt;br /&gt;   1.Add web reference to the url http://MyServer/ReportServer/ReportExecution2005.asmx&lt;br /&gt;   2.Generate a report snapshot which I described &lt;a href="http://rkzico.blogspot.com/2009/05/creating-report-snapshot-using-sql.html"&gt;here&lt;/a&gt;.&lt;br /&gt;   3.Call the following function to get  stream   in your preferred format.&lt;br /&gt;&lt;br /&gt;public byte[] GetRenderStream(string historyID, string format)&lt;br /&gt;      {&lt;br /&gt;            ReportExecutionService reportExecutionService = new ReportExecutionService();&lt;br /&gt;            CredentialCache credentials = new CredentialCache();&lt;br /&gt;             NetworkCredential serviceCredential = new      &lt;br /&gt;  NetworkCredential(Settings.Default.ReportUserName, Settings.Default.ReportPassword);&lt;br /&gt;             credentials.Add(new Uri(reportExecutionService.Url), "Basic", serviceCredential);&lt;br /&gt;&lt;br /&gt;              reportExecutionService.Credentials = serviceCredential;&lt;br /&gt;&lt;br /&gt;  byte[] resultStream = null;&lt;br /&gt;             string reportPath = Settings.Default.ReportPath;&lt;br /&gt;             string format =  format;                 // PDF,Excel etc;&lt;br /&gt;       &lt;br /&gt;             string encoding;&lt;br /&gt;             string mimeType;&lt;br /&gt;             string extension;&lt;br /&gt;  ReportExecutionService.Warning[] warnings = null;&lt;br /&gt;             string[] streamIDs = null;&lt;br /&gt;&lt;br /&gt;             ExecutionInfo execInfo = new ExecutionInfo();&lt;br /&gt;             ExecutionHeader execHeader = new ExecutionHeader();&lt;br /&gt;&lt;br /&gt;  try&lt;br /&gt;            {&lt;br /&gt;                   reportExecutionService.ExecutionHeaderValue = execHeader;&lt;br /&gt;                   execInfo = reportExecutionService.LoadReport(reportPath, historyID);&lt;br /&gt;                   String SessionId = reportExecutionService.ExecutionHeaderValue.ExecutionID;&lt;br /&gt;                   resultStream = reportExecutionService.Render(format, null, out extension, out encoding,       out    mimeType, out warnings, out streamIDs);&lt;br /&gt;                &lt;br /&gt;   return resultStream;&lt;br /&gt;            }&lt;br /&gt;             catch (Exception ex)&lt;br /&gt;            {&lt;br /&gt;                   throw ex;&lt;br /&gt;            }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;4. Save the returned stream as  a file.&lt;br /&gt;&lt;br /&gt;   string snapshotID = CreateAndGetNewSnapShotID(int year); // this method is described&lt;br /&gt;                                                                                                                //&lt;a href="http://rkzico.blogspot.com/2009/05/creating-report-snapshot-using-sql.html"&gt;here&lt;/a&gt;&lt;br /&gt;   string format = "PDF";&lt;br /&gt;   string fullFileName = @"C:\Reports\Report.pdf";&lt;br /&gt;   byte[] responseStream = _reportServiceProxy.GetRenderStream();&lt;br /&gt;&lt;br /&gt;   try{&lt;br /&gt;          FileStream stream = File.OpenWrite(fullFileName);&lt;br /&gt;          stream.Write(responseStream, 0, responseStream.Length);&lt;br /&gt;          stream.Close();&lt;br /&gt;      }&lt;br /&gt;     catch(Exception ex)&lt;br /&gt;     {&lt;br /&gt;              //catch and log exception;&lt;br /&gt;      }&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8958778003335982314-5506207461704048298?l=rkzico.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rkzico.blogspot.com/feeds/5506207461704048298/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rkzico.blogspot.com/2009/05/sql-server-reporting-service-rendering.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8958778003335982314/posts/default/5506207461704048298'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8958778003335982314/posts/default/5506207461704048298'/><link rel='alternate' type='text/html' href='http://rkzico.blogspot.com/2009/05/sql-server-reporting-service-rendering.html' title='Sql Server Reporting Service : Rendering Report From C# Code &amp; Save The Report'/><author><name>zico</name><uri>http://www.blogger.com/profile/10859686585050923448</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8958778003335982314.post-767471739717960913</id><published>2009-05-10T10:41:00.000+06:00</published><updated>2009-05-10T14:35:16.626+06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sql Server'/><category scheme='http://www.blogger.com/atom/ns#' term='Report'/><category scheme='http://www.blogger.com/atom/ns#' term='Sql Server Reporting Service'/><title type='text'>Creating Report Snapshot Using SQL Server 2005 Reporting Service In C#</title><content type='html'>While working in the project "BI Site For Car Dealers" we need to generate report from our application instead of depending on reporting server scheduler.Here i will describe the steps&lt;br /&gt;that need to be followed to generate report snapshot from c# code.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;1. Add an web reference to the url  http://MyServer/ReportServer/ReportService2005.asmx.&lt;br /&gt;2. Now call the following function to generate report snapshot.&lt;br /&gt;&lt;br /&gt;public string CreateAndGetNewSnapShotID(int year)&lt;br /&gt;      {&lt;br /&gt;          ReportingService2005 reportingService = new ReportingService2005();&lt;br /&gt;&lt;br /&gt;CredentialCache credentials = new CredentialCache();&lt;br /&gt;          NetworkCredential serviceCredential = new&lt;br /&gt;NetworkCredential(Settings.Default.ReportUserName, Settings.Default.ReportPassword);&lt;br /&gt;          credentials.Add(new Uri(reportingService.Url), "Basic", serviceCredential);&lt;br /&gt;&lt;br /&gt;reportingService.Credentials =  serviceCredential;&lt;br /&gt;       &lt;br /&gt;string report = "/myReport";&lt;br /&gt;       &lt;br /&gt;          ReportParameter[] reportParameters;&lt;br /&gt;&lt;br /&gt;// I have used only 1 parameter year. It is possible to use multiple parameter as filter.&lt;br /&gt;reportParameters = new ReportParameter[1];&lt;br /&gt;          reportParameters[0] = new ReportParameter();&lt;br /&gt;          reportParameters[0].Name = "Year";&lt;br /&gt;          reportParameters[0].DefaultValues = new string[] { year.ToString() };&lt;br /&gt;&lt;br /&gt;         try&lt;br /&gt;          {&lt;br /&gt;              reportingService.SetReportParameters(report, reportParameters);&lt;br /&gt;              Warning[] warnings;&lt;br /&gt;              return reportingService.CreateReportHistorySnapshot(report,out warnings);&lt;br /&gt;          }&lt;br /&gt;          catch (Exception ex)&lt;br /&gt;          {&lt;br /&gt;              throw new Exception(string.Format("Error:Failed To Create New Subscription  ErrorMessage:{0}", ex.Message));&lt;br /&gt;          }&lt;br /&gt;      }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Few things to note here:&lt;br /&gt;1. User name and password is the windows creadential where the reporting server is hosted.&lt;br /&gt;2. To pass the authentication process successfully it is required to configure the host which I described in an earlier&lt;a href="http://rkzico.blogspot.com/2009/04/fix-401-error-while-accessing-sql.html"&gt; post&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8958778003335982314-767471739717960913?l=rkzico.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rkzico.blogspot.com/feeds/767471739717960913/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rkzico.blogspot.com/2009/05/creating-report-snapshot-using-sql.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8958778003335982314/posts/default/767471739717960913'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8958778003335982314/posts/default/767471739717960913'/><link rel='alternate' type='text/html' href='http://rkzico.blogspot.com/2009/05/creating-report-snapshot-using-sql.html' title='Creating Report Snapshot Using SQL Server 2005 Reporting Service In C#'/><author><name>zico</name><uri>http://www.blogger.com/profile/10859686585050923448</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8958778003335982314.post-481161880455015087</id><published>2009-04-06T17:52:00.001+06:00</published><updated>2009-04-06T18:07:11.515+06:00</updated><title type='text'>Report Viewer 404 Error In Asp.Net Application  IIS-7.0 and Sql Server 2008-- File or directory not found</title><content type='html'>we had to face this problem while we were trying to show reprot in asp.net page with report viewer. Our website was hosted on windows 2008 server and we used  Sql Server 2008 reporting service.&lt;br /&gt;&lt;br /&gt;To overcome the issue we followed the steps described below.&lt;br /&gt;&lt;br /&gt;1.Open IIS Manager&lt;br /&gt;2.double-click on Handler Mappings icon.&lt;br /&gt;3.At the Action pane on your right, click on Add Managed Handler.&lt;br /&gt;4.At the Add Managed Handler dialog, enter the following: Request path: Reserved.ReportViewerWebControl.axd Type: Microsoft.Reporting.WebForms.HttpHandler&lt;br /&gt;Name: Reserved-ReportViewerWebControl-axd Click OK.&lt;br /&gt;&lt;br /&gt;Then add the following lines of code in your web config file in the &lt;handlers&gt; section.&lt;br /&gt;&lt;br /&gt;&amp;lt;add name="Reserved-ReportViewerWebControl-axd" path="Reserved.ReportViewerWebControl.axd" verb="*"&lt;br /&gt;type="Microsoft.Reporting.WebForms.HttpHandler" resourceType="Unspecified"/&amp;gt;&lt;/handlers&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8958778003335982314-481161880455015087?l=rkzico.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rkzico.blogspot.com/feeds/481161880455015087/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rkzico.blogspot.com/2009/04/report-viewer-404-error-in-aspnet.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8958778003335982314/posts/default/481161880455015087'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8958778003335982314/posts/default/481161880455015087'/><link rel='alternate' type='text/html' href='http://rkzico.blogspot.com/2009/04/report-viewer-404-error-in-aspnet.html' title='Report Viewer 404 Error In Asp.Net Application  IIS-7.0 and Sql Server 2008-- File or directory not found'/><author><name>zico</name><uri>http://www.blogger.com/profile/10859686585050923448</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8958778003335982314.post-2729700338127172655</id><published>2009-04-06T17:20:00.000+06:00</published><updated>2009-04-06T17:26:06.839+06:00</updated><title type='text'>Fix 401 error while accessing sql server reporting service with c# code</title><content type='html'>While working with reporting service in our last project we had to face 401 issue while accessing reporting service from remote computer(using .net code).After lot of digging in the net i found the following solution which worked for me on both windows server 2003 and server 2008.&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Click &lt;strong class="uiterm"&gt;Start&lt;/strong&gt;, click &lt;strong class="uiterm"&gt;Run&lt;/strong&gt;, type &lt;span class="userInput"&gt;regedit&lt;/span&gt;, and then  click &lt;strong class="uiterm"&gt;OK&lt;/strong&gt;. &lt;/li&gt;&lt;li&gt;In Registry Editor, locate and then click the following registry key:  &lt;div class="indent"&gt;&lt;strong class="uiterm"&gt;HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa&lt;/strong&gt;&lt;/div&gt; &lt;/li&gt;&lt;li&gt;Right-click &lt;strong class="uiterm"&gt;Lsa&lt;/strong&gt;, point to &lt;strong class="uiterm"&gt;New&lt;/strong&gt;, and then click &lt;strong class="uiterm"&gt;DWORD  Value&lt;/strong&gt;. &lt;/li&gt;&lt;li&gt;Type &lt;span class="userInput"&gt;DisableLoopbackCheck&lt;/span&gt;, and then press  ENTER. &lt;/li&gt;&lt;li&gt;Right-click &lt;strong class="uiterm"&gt;DisableLoopbackCheck&lt;/strong&gt;, and then  click &lt;strong class="uiterm"&gt;Modify&lt;/strong&gt;. &lt;/li&gt;&lt;li&gt;In the &lt;strong class="uiterm"&gt;Value data&lt;/strong&gt; box, type &lt;span class="userInput"&gt;1&lt;/span&gt;, and then click &lt;strong class="uiterm"&gt;OK&lt;/strong&gt;. &lt;/li&gt;&lt;li&gt;Quit Registry Editor, and then restart your computer.&lt;/li&gt;&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8958778003335982314-2729700338127172655?l=rkzico.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rkzico.blogspot.com/feeds/2729700338127172655/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rkzico.blogspot.com/2009/04/fix-401-error-while-accessing-sql.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8958778003335982314/posts/default/2729700338127172655'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8958778003335982314/posts/default/2729700338127172655'/><link rel='alternate' type='text/html' href='http://rkzico.blogspot.com/2009/04/fix-401-error-while-accessing-sql.html' title='Fix 401 error while accessing sql server reporting service with c# code'/><author><name>zico</name><uri>http://www.blogger.com/profile/10859686585050923448</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8958778003335982314.post-5083412286969945145</id><published>2009-01-28T20:18:00.000+06:00</published><updated>2009-01-28T20:24:24.141+06:00</updated><title type='text'>Enable Scheduling and Delivery Service For SSRS</title><content type='html'>While I was working in a SSRS project i had to spent two days why scheduling and delivery process is not working in the report server.Then I found the following thisng in msdn which helped be to get rid of this problem.&lt;br /&gt;&lt;br /&gt;Set the following values to TRUE in rsreportserver.config file.&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;IsSchedulingService&lt;/li&gt;&lt;li&gt;IsNotificationService&lt;/li&gt;&lt;li&gt;IsEventService&lt;/li&gt;&lt;/ol&gt;In my case these values had been set to False.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8958778003335982314-5083412286969945145?l=rkzico.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rkzico.blogspot.com/feeds/5083412286969945145/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rkzico.blogspot.com/2009/01/enable-scheduling-and-delivery-service.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8958778003335982314/posts/default/5083412286969945145'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8958778003335982314/posts/default/5083412286969945145'/><link rel='alternate' type='text/html' href='http://rkzico.blogspot.com/2009/01/enable-scheduling-and-delivery-service.html' title='Enable Scheduling and Delivery Service For SSRS'/><author><name>zico</name><uri>http://www.blogger.com/profile/10859686585050923448</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8958778003335982314.post-1379282771167926402</id><published>2008-10-20T09:57:00.000+06:00</published><updated>2008-10-20T10:36:53.669+06:00</updated><title type='text'>"Ambigious Match Found" - Works fine in develoment environment</title><content type='html'>A few days ago I ran into this problem while i was working for a project.Everything was working well in development environment.But when this was deployed in the production server things were not going as expected. After consulting with &lt;a href="http://smsohan.blogspot.com/"&gt;sohan&lt;/a&gt; and with the  help of &lt;a href="http://forums.asp.net/t/983007.aspx"&gt;asp.net forum&lt;/a&gt; we figured out that my aspx page contained TextBox control "Email" and string variable email in the codebehind file&lt;br /&gt;&lt;br /&gt;private string email;&lt;br /&gt;&lt;br /&gt;and these two variables  were raising ambiguity in the production environment though  the two variables were of different types and of different casing.&lt;br /&gt;&lt;br /&gt;After changing name of one variable the page was not raising any exception in the production environment.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8958778003335982314-1379282771167926402?l=rkzico.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rkzico.blogspot.com/feeds/1379282771167926402/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rkzico.blogspot.com/2008/10/ambigious-match-found-works-fine-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8958778003335982314/posts/default/1379282771167926402'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8958778003335982314/posts/default/1379282771167926402'/><link rel='alternate' type='text/html' href='http://rkzico.blogspot.com/2008/10/ambigious-match-found-works-fine-in.html' title='&quot;Ambigious Match Found&quot; - Works fine in develoment environment'/><author><name>zico</name><uri>http://www.blogger.com/profile/10859686585050923448</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8958778003335982314.post-3986221630933903622</id><published>2008-05-25T10:28:00.000+06:00</published><updated>2008-05-25T10:32:25.300+06:00</updated><title type='text'>Difference between Managed &amp; Unmanaged Code</title><content type='html'>This might be old topic. But anybody who is looking for what managed and unmanaged code mean can find it &lt;a href="http://www.developer.com/net/cplus/print.php/2197621"&gt;here.&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8958778003335982314-3986221630933903622?l=rkzico.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rkzico.blogspot.com/feeds/3986221630933903622/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rkzico.blogspot.com/2008/05/difference-between-managed-unmanaged.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8958778003335982314/posts/default/3986221630933903622'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8958778003335982314/posts/default/3986221630933903622'/><link rel='alternate' type='text/html' href='http://rkzico.blogspot.com/2008/05/difference-between-managed-unmanaged.html' title='Difference between Managed &amp; Unmanaged Code'/><author><name>zico</name><uri>http://www.blogger.com/profile/10859686585050923448</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8958778003335982314.post-5074016942224117731</id><published>2008-05-13T00:16:00.000+06:00</published><updated>2008-05-13T00:20:05.818+06:00</updated><title type='text'>Get value of a class property using reflection in .net</title><content type='html'>&lt;a href="http://geekswithblogs.net/shahed/archive/2006/11/19/97548.aspx"&gt;This&lt;/a&gt; site contains a simple example how to get property value of a class using reflection.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8958778003335982314-5074016942224117731?l=rkzico.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rkzico.blogspot.com/feeds/5074016942224117731/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rkzico.blogspot.com/2008/05/get-value-of-class-property-using.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8958778003335982314/posts/default/5074016942224117731'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8958778003335982314/posts/default/5074016942224117731'/><link rel='alternate' type='text/html' href='http://rkzico.blogspot.com/2008/05/get-value-of-class-property-using.html' title='Get value of a class property using reflection in .net'/><author><name>zico</name><uri>http://www.blogger.com/profile/10859686585050923448</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8958778003335982314.post-3273899629802793904</id><published>2008-05-09T00:34:00.000+06:00</published><updated>2008-05-09T00:47:28.941+06:00</updated><title type='text'>Declaring  Attribute Class In .Net</title><content type='html'>Adding a attribute class in .net is very simple.It's just a class declaration which inherits &lt;span style="font-weight: bold;"&gt;System.Attribute&lt;/span&gt;  and is marked with&lt;span style="font-weight: bold;"&gt; AttributeUsage&lt;/span&gt; attribute.&lt;br /&gt;&lt;br /&gt;[AttributeUsage(AttributeTargets.All)]&lt;br /&gt;class MyAttributeClass : System.Attribute&lt;br /&gt;{&lt;br /&gt;    //variables&lt;br /&gt;    //methods&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;once you declare this class you can use this as attribute in another class like following one&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Class MySampleClass&lt;br /&gt;{&lt;br /&gt;    [MyAttributeClass]&lt;br /&gt;    public void Dosomething()&lt;br /&gt;    {&lt;br /&gt;   &lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;More to come  later...........&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8958778003335982314-3273899629802793904?l=rkzico.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rkzico.blogspot.com/feeds/3273899629802793904/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rkzico.blogspot.com/2008/05/declaring-attribute-class-in-net.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8958778003335982314/posts/default/3273899629802793904'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8958778003335982314/posts/default/3273899629802793904'/><link rel='alternate' type='text/html' href='http://rkzico.blogspot.com/2008/05/declaring-attribute-class-in-net.html' title='Declaring  Attribute Class In .Net'/><author><name>zico</name><uri>http://www.blogger.com/profile/10859686585050923448</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
