Friday, October 19, 2012

Check value exists in entity frame work.


Let’s say you want to check the existence of a particular value in the database table. For example I have a view named RoomTypeEntityView in edmx file as follows. I want to check a given RoomTypeName is exists or not. There are so many approaches to do this in entity framework.



One way to check the exsistence is get the result as ToList() and get the Count. This approach is little bit low performance. This need to check every row and to get the count.
Another easiest way is using Any() method. This will not check every row in the table. This will return true once it finds a match.

Example code:

public bool IsRoomTypeAlreadyExists(int accomodationId, string roomTypeName)
        {
            bool status = false;

            using (TripBagEntities entities = DataObjectFactory.CreateContext())
            {
               
                status = entities.RoomTypeEntityViews.Where(c => c.AccommodationId == accomodationId && c.RoomTypeName == roomTypeName).Any();

                return status;
            }
        }

Friday, August 24, 2012

Display multiline type column in SSRS


Recently I created a report using SharePoint list as the Datasource and the datasets are created by querying a SharePoint custom list. The report is displaying fine. But ‘multiple lines of text’ data types in the list are displaying like html text in the report.

Ex:
 <div class="ExternalClassD226A5A96C0C47E4A3D28396435DC63B"><p>Lost 47hrs due to engineering issue​</p></div>  

Providing a report as above to the end users is not meaning full. But SSRS provides the facility to format the text as human readable. The steps are very easy to follow .Follow the steps. 

1.       Right click on the particular cell and select Placeholder properties. 
2.       At the general tab select ‘HTML - Interpret HTML tags as styles’ option. 
3.       Click ok.

That’s it!.

Friday, July 27, 2012

Search Pdf files in SharePoint 2010


I created a document search application couple of days ago. This application contains large number of pdf files. When I type a search term it not results pdf files as search results. After some search on google I found that there are some installation and configuration should be done in SharePoint server. I thought to share this information.

To enable pdf search it is required to install PDF iFilter to the SharePoint server. You can download PDF iFilter at the following link. http://www.adobe.com/support/downloads/detail.jsp?ftpID=4025
Just double click and run the wizard to install PDF iFilter. Next you need to do some configurations in the registry. Follow the steps. 

1.       Click start, Run and type regedit to open the Registry Editor. 
2.       Go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office Server\14.0\Search\Setup\Filters 
3.       Right click on the Filters and click New > Key 
4.       Type the key name as ‘.pdf’ 
5.       You need to add the following values to the key .pdf 


6.       To add values right click at the right side of the window and select New> string value. 
7.       Next go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office Server\14.0\Search\Setup\ContentIndexCommon\Filters\Extension in the registry. 
8.       Right click on the Extension and click New > Key. 
9.       Add the key as .pdf 
10.   For the Default value add the following value. 


The configurations of the registry is complete. Next we have to add the file type in Central Administration. To add the file type follow the steps.
  
1.       Go to Manage service applications under Application Management 
2.       Select Search service application 
3.       At the left side click on File Types under Crawling section. 
4.       Click New File Type and add pdf as a file type.

The installation and configuration is complete to search pdf files in SharePoint. At the end you have to do IISReset on the SharePoint server and restart the SharePoint Server Search 14 and SharePoint Foundation Search V4 services.

Now you will be able to search pdf files in SharePoint 2010.
:)

Thursday, July 12, 2012

Oracle Database SQL Expert

Successfully completed Oracle Database SQL Expert (1Z-047) exam  on 12th July 2012.
:)

Tuesday, July 10, 2012

SharePoint 2010 custom logo in the Web part pages


You know how to change the site logo in SharePoint 2010. You can add a custom logo to the site that will display every page in the site. The default logo is as follows.


 To change the logo, follow the steps 

1.       Go to Site Settings from Site Actions menu 
2.       Select Title, description, and icon under Look and Feel 
3.       Insert the image URL in Logo URL and Description section. 
4.       Click OK

Once you are done the custom logo will appear in every page in the site. But in Web part pages the custom logo will not appear. The default logo overwrites the custom logo. The users will see the default logo, not the custom logo.

To set the custom logo to a Web part page follow the steps. 

1.       Go the Web part page and select Page from the ribbon. 
2.       Select Title Bar Properties in Page Actions section.

 

3.       In the Web Part Page Title Bar properties window, insert the Image URL under Image Link section. 


4.       Click OK

Now the custom logo will appear in the Web part page.