New Posts New Posts RSS Feed: Adding custom search page. Step-by-step guide.
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Adding custom search page. Step-by-step guide.

 Post Reply Post Reply
Author
vecs View Drop Down
Newbie
Newbie


Joined: 05-Dec-2007
Location: Russian Federation
Posts: 22
Post Options Post Options   Quote vecs Quote  Post ReplyReply Direct Link To This Post Topic: Adding custom search page. Step-by-step guide.
    Posted: 06-Dec-2007 at 4:09am
I`d like to add a new search page in my project. This page should be similar to SearchResultsPage but with custom search area (with multiple controls to provide complex search conditions).
What is the best way to add such custom SearchResultsPage?

For Example there may be the Employee Search view with two conditions:
Employee LastName = <TextBox>
Employee Territory = <ComboBox|TextBox with territiory name[s]>

It would be great to have a step-by-step guide.
Thanks!
Back to Top
vecs View Drop Down
Newbie
Newbie


Joined: 05-Dec-2007
Location: Russian Federation
Posts: 22
Post Options Post Options   Quote vecs Quote  Post ReplyReply Direct Link To This Post Posted: 11-Dec-2007 at 7:06am
We have over 300 entities in our project and it is very common task to produce search pages similar to Search and Results Page but with with custom SearcherView smartpart for each entity.
Is it possible to add special base layout for such pages and extend Wizards so they generate the following (I used Employee entity as example):
  * public interface IEmployeeSearcher : ISearcher, INotifyPropertyChanged
  * public abstract class EmployeeSearcher<TEntity>    : EntitySearcher<TEntity>, IEmployeeSearcher where TEntity : Entity
  * Empty smart part for "search conditions" area (SearchView)
  * Add "Show search page Handler" into ModuleControlled
  * public const string EmployeeSearchView = "EmployeeSearchView";
e.t.c.?

As alternative can you provide the shortest way to make such search pages (what classes to add and where to register views, handlers e.t.c.) with maximum use of IdeaBlade/CAB tasty things and wizards?

Back to Top
vecs View Drop Down
Newbie
Newbie


Joined: 05-Dec-2007
Location: Russian Federation
Posts: 22
Post Options Post Options   Quote vecs Quote  Post ReplyReply Direct Link To This Post Posted: 18-Dec-2007 at 7:16am
.. I still havn't got answer from you guys ..Broken%20Heart
So I was obliged to dig into your code and look for some solution.
I found 7-steps solution for adding mentioned search page for single entity type.
See details on my blog.
It is require manual adding for 3 new files, wizarded adding for 2 new files and manual changing of this 5 files + 2 previously existed files.
And all this work for the single entity type! Then I should repeat this to 300 remaining entity types..

Please criticize my solution.
If there is better way to do this?

Back to Top
Bill Jensen View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 31-Jul-2007
Location: United States
Posts: 229
Post Options Post Options   Quote Bill Jensen Quote  Post ReplyReply Direct Link To This Post Posted: 18-Dec-2007 at 3:13pm

Excellent solution.

Why do you need to create a custom searcher rather than just modifying the one created by the SearchAndResultsPage wizard in the UIModel folder?
 
The rest is pretty much standard CAB and Cabana.
 
Of course you are free to use Visual Studio's template export wizard
 
(File->Export Template...)
 
to create a template for your searcher views.  You simply won't be able to use the Cabana wizards to set entity-specific values, so you may have more manual fixup work to be done.
 
300 is a lot of separate pages to create and maintain.  Plus, depending on your application architecture, it can take a while just to construct them all, even if they're never shown.  Have you considered other options that allow re-use of a common page for different entities?
 
Thanks for your contribution.
 
Bill Jensen
IdeaBlade
Back to Top
vecs View Drop Down
Newbie
Newbie


Joined: 05-Dec-2007
Location: Russian Federation
Posts: 22
Post Options Post Options   Quote vecs Quote  Post ReplyReply Direct Link To This Post Posted: 18-Dec-2007 at 11:33pm
Thank you!

> Why do you need to create a custom searcher rather than just modifying the one created by the SearchAndResultsPage wizard in the UIModel folder?
Actually there is no big reason to not use generated EmployeeSearchResultsPageSearcher.cs instead of hand-maided EmployeeSearcher.cs. This is a "by-product" of my research.

> Of course you are free to use Visual Studio's template export wizard
 (File->Export Template...)
Oh! Excellent idea! To my shame I was unfamiliar with this Visual Studio feature.

> 300 is a lot of separate pages to create and maintain.  Plus, depending on your application architecture, it can take a while just to construct them all, even if they're never shown.  Have you considered other options that allow re-use of a common page for different entities?

I was too greedy! I was slightly hastened to said that all our 300+ entities should have such search page. Actually there about 50 entities should have custom "Search Results" or "Search Summary/Detail" pages. But it is much work anyway.
And I found no place here for reusable pages except I will add special SearchViewBuilder - kind of non-visual class similar to GridBuilder.

Thanks a lot again!

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down