max kumar

max kumar

  • NA
  • 1
  • 1.5k

Simple DAL class

Mar 10 2012 12:36 PM
I faced to the follow issue. I should develop web site with many similar pages, for example: news, products, price list, etc. There is total 

20 pages. Each page must be editable so we have 80 web forms. (view, delete, insert, edit). For example 

News_view.aspx
News_edit.aspx
News_delete.aspx
News_insert.aspx


I decided to develop simle class that allow make each web form in few steps. In result I can make web form in the following way:


QueryField NewsName = new QueryField("NewsName");
QueryField NewsDate = new QueryField("NewsDate");
NewsDate.Type = "date";
QueryField NewsText = new QueryField("NewsText");
QueryField NewsImage = new QueryField("NewsImage");
NewsImage.Type = "image";

QueryData EditNews = new QueryData;
EditNews.Fields.Add("NewsName");
EditNews.Fields.Add("NewsDate");
EditNews.Fields.Add("NewsText");
EditNews.Fields.Add("NewsImage");


....

AddControlsForEdit(Panel1,QueryData);

....

buttonEditNews_click(Object sender, EventArgs e)
{
   EditNews(Panel1); //
}



Instead develop each page manually. Each field you can customize with CSS, also there is support for few field types: text, date, images etc.
I want to hear your opinions and advice about tsis way of solving given issue. Is this way normal?