- this is my first post
- i'm a self taught ASP guy trying to learn ASP.NET using Visual Studio 2005
- C#
My first .NET project - and I ended up with one giant class in one file. It works fine. But it seems like bad design. Should I have more than one class? I have 4 main parts and I'm thinking each part could go in it's own class for organizational purposes if nothing else. Please go easy on me - I'm self taught and I may be way out in left field - so I'd appreciate some help.
It's a Search engine of sorts. Users enter search criteria, and the database returns records which contain matching items.
Logically the code breaks down into the following actions:
1. Fire off a search on button click
2. Search the database for a match and return dataset
3. Process data returned to determine correct display
4. Assign HTML to a stringbuilder variable, assign that to a panel in the web form for display
I had all this happening in a class:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using System.Text.RegularExpressions;
public partial class Search : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//code
}
// FIRE ///////////////////////////////////////////////////////////////////////
protected void ExhibitSearch_Fire(object sender, EventArgs e)
{
//code
}
// FIND ///////////////////////////////////////////////////////////////////////
protected void ExhibitSearch_Search(string SearchKey, string search_value)
{
//code
}
// PROC ///////////////////////////////////////////////////////////////////////
public void ExhibitSearch_ProcGeo(DataSet dsInstances, DataSet dsAffiliates, string SearchKey, string search_value)
{
//code
}
// DISPLAY ///////////////////////////////////////////////////////////////////////////
public void DisplayEvents(DataSet dsInstances, string search_value)
{
//code
}
Each method is quite long and there are more methods than listed here...
I thought I would try and make each method its own class. But maybe that's stupid - because it sure didn't work. I got a lot of errors about things "do not exist in current context."
Am I like totally lost in the wilderness here? Or is there a good way to break this one big class into logical pieces.
My appreciation for anyone who has the patience to try and help me through the wilderness. ha ha.
This post has been edited by rgalpin: 05 November 2008 - 04:25 PM

New Topic/Question
Reply



MultiQuote





|