MVC :: How And Where To Store Search Parameters In Application
Oct 14, 2010
I am working on a railway web application and I have following layers:
[Code]....
I pass Domain Entity Objects from Repository to Service layer and thinking of passing View Models from Service to Presentation layer. Website would require a login and after successful login I have to present a search screen with basic search (as default option) and option for advance search. Once user fills the
search criteria I have to gather data from DB & Web Services and present the results to user. User would select a particular Rail option and would move on to other additional options page BUT they should be allowed to change their previously selected Rail option by going back to Rail search results. I have to
always hold and present user's initial search criteria (basic and advance search options selected by user on the search wizard) on every screen and need these criteria in Service and Repository layers.
What is the best way to hold these search criteria and pass them from page to page within presentation layer and across layers? Should I create a View Model class for Search Options? Or a Domain Entity Object (I don't think so)? and best way to pass it across layers and from page to page with in presentation layer.
I need to be able to provide a page for the end user where thay can search in the following :
Search work Category Price AdType Location
and so on.
Its important that the user can copy the url and then use it later(and get the same settings). Its also important to be able to save these settings on the user in the database.
So far I have created a ModelView class that contains the parameters but I am not sure that this is the right way to go? Maby I should pass all inte the URL.
What I need is to provide a search page where the user can set parameters and see a list of data(depending on parameters. It should be using QueryString to be able to get to a specific setup with the URL. I supose that I could set the "<form method=get.." this would generate a QueryString on submit but Im not sure that this would work in the current setup? Maby I have to place the seartch stuf in a partialView?
I am creating an ASP.NET Wiki for myself to track the knowlege I gain in C# and other language.
I have created a Stored Procedure to insert a category into a DB, the DB has two fields C_ID(int) and Category(varchar 25). In my ASP page, there is no field for C_ID, it increments automatically by IsIdentiy = true;
When I try to excute it, it fails. What is the best approach to handle this?
Code:
ALTER PROCEDURE dbo.InsertCategory @ID int, @CATEGORY varchar(25) AS INSERT INTO Wiki (C_ID, C_Category) Values (@ID, @CATEGORY) /* SET NOCOUNT ON */ RETURN
Did I miss something to insert from the .aspx page? try { //create a command object identifying the Stored Procedure SqlCommand cmd = new SqlCommand("InsertCategory", conn); //Set the command type cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("Category", txtAddCatagory)); cmd.ExecuteNonQuery();
I'm trying to implement a search function on an incident logging page that is working fine. Currently I am only able to search against one criteria at a time, using the following route:
I have recently started using SQL Server Reporting services. I currently have a problem. I am trying to achieve a search by dates in a report. I have a table with the fields RequestDate in e.g. 22-Jan-2010 or 23-Sep-2010. I have created a report in Query Designer with two parameters in it RequestDate & RequestDate2.
The Operators are for RequestDate is: Is more than or equal to The value is: 1-Jan-2010 And the Operator for RequestDate2 is: Is less than or equal to. The value is 30-Dec-2010 When i go to the SQL Statement this is produced:
SELECT MHRA.ImportRequestID ,MHRA.UniqueID ,MHRA.CreatedBy ,MHRA.RequestDate FROM MHRA WHERE MHRA.RequestDate >= @RequestDate AND MHRA.RequestDate <= @RequestDate2
When i go to view report i want to be able to search for dates between the dates 1 Jan 2010 and 30-Aug-2010 My query seems to pick up all or most of the results between these dates. How can i build this query so i can get specific results. For example...in the Request Date Parameter box i would put 2-feb-2010 and in Request Date 2 i would put in 5-Jun-2010 and this would return all the results between these dates.
i have implemented custom MembershipProvider and now i would like to use CreateUserWizard to create new users.. the problem is that i want to store in the db more information that normally (e.g. first and last name). There is function:
public override MembershipUser CreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out MembershipCreateStatus status) { throw new NotImplementedException(); }
which i can implement but it won't store first name etc. i found here: [URL] solution that i can overload this function and call it manually but the default CreateUser function will still be called in this case...
I've got a gridview that I need to perform filters on. All works great until I try and add a date range..
Below is the code. Basically I have 5 dropdown lists which all filter as expected giving them the option to use each one or just the ones they need.
The problem is they want to also have the option of filtering by date i.e date range or greater than or less than or equal to etc..
As soon as I add the date parameter it stops the other filters working. I'm guessing because I have a null value in the date field (textbox) if they dont use the option??
Does anyone have a sample on how to filter by dropdown lists and dates keeping in mind they wont use all the filter options?
How can i call db2 store procedure with parameters from asp.net ( C# ) using Microsoft OLE DB Provider for DB2. I am able to connect to database. What is the syntax to call a store procedure?
I have three parameters to search data and populate to gridview. The parameters are textboxes and dropdowns. These are independent.
If the parameters are not matching and not fectching data from table then the gridview count is 0 therefore I am displaying a message to the user that the "data is not available".
The message I displayed to the user using the EmptyTemplate of Gridview.
I want some enhancement that if the parameters are not matched and there is not data fetch from the table then message should be more specifice like:
I'm new with all stored procs - but I have a very basic Full Text Search going on...I created a stored proc, and linked it up to my application using Linq to SQL. If I use Linq to SQL to call the stored proc without any parameters (hard coded search string) i get results back, as soon as I add a parameter - the result set is 0 for some reason.
The funny thing is that I run Profiler and execute both queries its trying to do - and it looks identical
Here is the working parameterless query:
[Code]....
and according to Profile this is what it looks like when its called as a stored proc
[Code]....
I get 2 results as expected. Here is the NON-working stored proc that takes in 1 string parameter
[Code]....
and here is the query that gets called when profiling
I have many locations stored with addresses and longitude/latitude information in my database.I need a function or store procedure which returns only locations near by 10kms of given longitude/latitude parameters.It is not neccesary to be a sql query but I am fine with any other solution.
We have lot of application parameters for each module in a C# .NET 4 ASP website. parameter examples: timeouts, formulae constants, thread limits per module, $ charges per usage etc. What is best out of following approaches we know: Use DB config table Use an xml. load that xml into local cache on start (and on xml change) simple constants.cs file with public const int XYZ = 123; type of key-value pairs. web.config (though i think its mostly for deployment type of config)
I need to use routing with parameters in my ASP.NET application.
public class Global : System.Web.HttpApplication { void Application_Start(object sender, EventArgs e)
Then, by navigating to "/Profile" I want to get on Page_Load method Request.Params["Id"] as null and by navigating to "/Profile/1", Request.Params["Id"] as "1".
I'm creating a web application using asp.net & WCF as 3 tier architecture, which is mostly looks like a social website. Users can register with the system and they can upload their profile images, documents, video clips etc. So, what i want to know is what is the best way to store those files? In the wcf side or web application side ?
Also I want to know that, if i choose web application side to store those files as set of folders, how it makes those folders shared and allow access to another different project (such as a desktop client need to upload files into that shared folder) ?
We are developing a custom .NET directory listing style application for a client and we require a powerful search solution. The application will be built in ASP .NET C# on SQL Server 08. The application is based around data which users to the organisation can enter in a profile management style area. Fields can be textboxes, textareas, selection boxes, multiselects etc. A user from the main website needs to be able to use the search function to find a result, but this result should search the entire database and not only base the results on one or two fields. It could be anything within any of the fields the user can fill out or select etc.
Can anyone help me find a possible solution for a .NET powered search engine we can use for this application? It must be preferably C#, running on .NET 3.5 and SQL Server 08. The database is a completely custom built schema and so there is no schema example to show or that can be shown. If you need more information to provide a satisfactory answer let me know and I'll try to provide some more information specific to what you ask.
I am implementing an eCommerce application using ASP.Net. I would like to know if custom Google search is sufficient enough or if we plan to go implement our search functionality.. how do we go about doing it?
My question relates to the performance implications of reading application configuration data from an XML file.I am building an application that lists information from a database and needs to know how to display the lists, depending on the types of data returned.This is difficult to explain, but basically I would like to have an XML config file that lists the types and describes how to display them. This will allow me to change the display methods without re-compiling the application.
My question is really around performance. Given that my application will need to use this data many times during each page load...Should I be reading directly from the XML file and parse it each time I need it? Or should I cache the XML object and parse it each time I need it?Or should I parse the XML once, generate some sort of object and cache that object?My guess is option 3, but I'm basically fishing for best practice around this.
I am working on a Railway Portal and would require maintaining a shopping cart of components user has selected, there could be multiple components of different type in the cart. I don't see a value in storing the cart in database, would like to store the final order in DB. Where can I store/hold (temporary) the cart data per user session in MVC? All MVC samples I saw online save the cart data in DB - not sure why.
MVC presentation layer will be communicating with external web services for pricing and availability of these components, so I can't store only the product IDs to do a lookup for actual product descriptions/prices during the shopping process... I have to store everything in the cart (Product IDs, Descriptions, Prices etc) some place in memory. My application will be running in WEB FARM environment and cannot use in-process session storage.
Options come to my mind are:
SESSION STATE in SQL SERVER Using some kind of Distributed Caching Mechanism to store Session data such as "Windows Server AppFabric"