Localization from database in Telerik Reporting - asp.net

I am currently testing Telerik Reporting to replace our current report solution which is some kind of scripting tool that pulls the localized version of a term from the database.
Example:
A label called "customer" would have a english definition (Customer) and a french one (Client).
We get the correct definition from the database by calling a function like GetLabel("customer",user_language).
Is there a way to do the same thing except for including each "label" separately in the SQL query of the datasource?
We plan to use Telerik Reporting in an ASP.NET environment.

I found a way of doing this quite easily.
I only had to use the User Functions that Telerik Reporting already support and then return the correct value.

Related

Automate parameter addition to SSRS via asp.net

I am extending an existing app to host SSRS reports with an ASP.Net WebForms ReportViewer control. There are a large number of existing reports. That would not be a problem except that we also need to pass another parameter to each report.
Someone on our team suggested that we might be able to add another parameter and SSRS would pass it along to the stored procedure associated with each report. Not knowing anything about reporting services I looked into it.
I tried the following:
private void AddNewParameter(Report report)
{
var reportParameters = new List<ReportParameter> { new ReportParameter(paramName, "foo", false) };
report.SetParameters(reportParameters);
}
The call Report.SetParameters() complains about the new parameter not existing on the report. The MSDN page for SetParameters() has a note near the bottom that says:
"The parameters specified for the SetParameters method must be defined in the original report definition."
Can anyone confirm the sinking feeling I have that all of our reports must be changed to take the new parameter?
The approach you are attempting is going to be a dead end. Sorry. Sinking feeling is confirmed. However...
If there are a ton of reports then you could probably work out an automated approach to update them all by modifying the underlying Report Definition Language. The link I just posted will take you to the TechNet article that has further links to the actual schema definitions for each version etc.
RDL is really just XML, to quote the TechNet article directly:
RDL is composed of XML elements that match an
XML grammar created for Reporting Services. You can add your own
custom functions for controlling report item values, styles, and
formatting by accessing code assemblies within report definition
files.
Only you could weigh the work of developing this type of solution vs the manual approach.
To get an idea of changes required:
Save copy of one report.
Modify the report with changes
Compare modified rdl to original (BeyondCompare, notepad++, whatever)
If your comfortable with parsing XML, then reproducing the change across remaining reports would be entirely do-able.

Entity framework, custom model, datgrid, paging, sorting not working

I am using vs 2012, .net 4.5, entity framework 5, web forms, vb (but c# help just as good for me)
I am new to using the Entity framework. I have decided to create a new project in .net 4.5 so i can use item Type for strongly typed data controls, in this case gridview.
I need to retrieve data from multiple tables 5+, which by its self is easy enough, but this means i cant use EntityDataSource as theres no option to build a query etc only select a single table. How can i achieve this plesae? I guess in the code behind i can set the gridview datasource but then do i need to implement custom paging and sorting?
I presume in this case i wont be able to use a strongly typed data control but i can live with that, does that mean its only viable for getting data from 1 table. Or do i need to populate my model with all results. The amount of data in the tables is well over 500,000 rows so obviously it has to be paged! And the page has a number of filters / search otpions
I am at a loss here, mainly i obviously am not understanding something.
I have been researching / googling this for a few hours som findings are below, but again they dont really answer or help me.
http://weblogs.asp.net/dwahlin/archive/2013/03/26/asp-net-4-5-web-forms-features-strongly-typed-data-controls.aspx
http://forums.asp.net/t/1677303.aspx/1
One option is creating a view with whatever you want in your database and then regenerating your EDMX to include the view. You will then have a strongly typed object designating the fields in the View.

How to mimic an excel spreadsheet on a website in vb.net?

I am building a website to capture data. I have many spreadsheets that are used for data entry or capture. Now I want to mimic these complex spreadsheets on the web forms but I am unsure of the correct control to use.
Data entry must be allowed and live calculations also need to be made similar to formulas on normal excel spreadsheets. Later on the data must be captured into an SQL table.
What would be the best control to use or method to mimic that functionality, albeit that the spreadsheet component is no longer available in visual studio 2010. Is it a data grid?
Thanks
for custom build you can rely on GridView and keep adding on features to it.
however my reccomendation would be to use Devexpress Grid or some other third party controls and build on it. these controls are more feature rich :)
Here is an extension that contains Excel compatible WinForms. Capturing to SQL should be pretty straightforward using the Entity Framework.
http://visualstudiogallery.msdn.microsoft.com/03A0E5A9-4768-461C-9A72-8255A291094C?SRC=Featured
Check to see if the Office Web Components at http://en.wikipedia.org/wiki/Office_Web_Components#Office_Web_Components will meet your needs.

Open source LINQ search engine for website

I want to add a search engine to my website. I want it to handler boolean searches and give me a list of results in order or best match. I need it to be able to work with LINQ, because I want to add additional where clauses to the final query that gets run. I am looking for the best open source .NET search engine that works with LINQ. I like lucene.net but the problem is the LINQ interface (LINQ to Lucene) hasn't been updated since 2008. Are there any good options out there?
You could try and use the free Search Server Express from Microsoft. It's available in beta for the 2010 version but will be released soon. The (SharePoint) Search API is very similar similar to SQL, so you could append additional where clauses.
It's not linq or open source, but it's free and might work in your case. I've looked a bit at the lucene linq api myself, and came to the same conclusion you have. It's not updated, while Lucene is still being worked on.
The other option is to create your own Lucene Linq provider, but it will require some work.
Documentation for the FullTextSqlQuery class. (old version docs with sample here)
Here's a code snippet to show what it looks like:
FullTextSqlQuery fullTextSqlQuery = new FullTextSqlQuery(site)
fullTextSqlQuery.QueryText = String.Format("SELECT Title, SiteName, Path FROM Scope() WHERE \"scope\"='All Sites' AND CONTAINS('\"{0}\"')", searchPhrase),
and you could append more to the WHERE part of the query.
I decided to use full-text indexing feature of sql server. It's not as full featured as lucene.net but for my requirements it gets the job done pretty well.

Entity Framework multi-language website with multi-database

As the question is a bit self explanatory, I want to achieve the goal of a multi-language website. I am using an Entity Data Model with MS SQL 2005. I came up with an idea of making a seperate database for each language with exactly the same model and relations. So I can use the Entities constructor that takes a connectionString and switch the site to the selected language.
I am using an ascx as the language control that fires an event, and the parent aspx gets the selected language as an integer (from event args) and call the method containing the same linq queries but Entity context will be created with the connection string of that db (of language)
I could only came up with this solution, because I think adding a new language will require a replication of the english one, imported to Access and sent to the translator. Then will be exported back, and the model will fit (HOPEFULLY).
My question is if this is really a good approach or am I missing anything that will create greater hassle to me. Thanks in advance
multi-database is not a good solution as soon as entities within the different databases have relations to each other. Generally a good approach is to work with labels in one default language. These labels can either be in a well defined format (e.g. 'LABEL.TEXT_HELLO') or just in the base language (e.g. 'Hello World').
So all you have to do is building a table for translations where the base language is the key and hopefully there is for each key a value containing the translation. As soon as you have the translations, you can write a method ont he frontend which writes the labels in the language used by the user.
In Zend Framework for example, you have to write <h1><?= $this->translate('Hello World'); ?></h1> instead of just <h1>Hello World</h1>
The good thing about that is, that if ya translation is missing, you can still use the fallback (in this case english) to show the user at least something.
That way, you can manage your app in one database and users who speak several languages do not have to switch between applications and content.
cheers
My approach: create a table Language that lists all the available languages. Relate each table that should be localized to Language. Now, you can easily access the localized content e.g.
Content[content_ID].HeadLine.Where(hl => hl.Language.id == "en-US")
I look forward to see what other people as I myself is still learning DB design and EDM.
OK, if you want to be able to easily implement a new language, then reinventing the internationalization features already built in to ASP.NET is not the way to go, because it isn't "easy".
At least, not as easy as using a satellite resource DLL. Your translators will use off-the-shelf tooling to translate your resources, and ASP.NET will automatically select the correct DLL based on the user's current culture.
Read up on ASP.NET internationalization/globalization features; there's no need to invent your own.

Resources