/// <summary> /// Returns a list of all orders in the system /// </summary> /// <returns></returns> private static IEnumerable<OrderDetails> GetRecordsFromDatabaseWithFilter(string query) { Database db = new Database(); List<OrderDetails> results = new List<OrderDetails>(); db.Connect(); db.Query(query); if (db.rdr.HasRows == true) { while (db.rdr.Read()) { OrderDetails order = new OrderDetails(); order.ID = (Convert.ToString(db.rdr["ID"])); order.Email = (Convert.ToString(db.rdr["Email"])); order.OrderDate = (Convert.ToString(db.rdr["OrderDate"])); order.Details = RemoveSpecialCharacters(Convert.ToString(db.rdr["OrderDetails"]).ToString()); order.Price = (Convert.ToString(db.rdr["TotalPrice"])); order.Notes = (Convert.ToString(db.rdr["Notes"])); results.Add(order); } } return results; }
/// <summary> /// Initial load of the screen - loads the differnet component types. /// </summary> private void LoadProjectLayouts(int? layoutID, int? ideas) { bool hasDescription = false; Database obj = new Database(); try { obj.Connect(); if (layoutID != null && ideas == null) { obj.Query("SELECT * FROM Layouts " + "INNER JOIN Projects ON (Projects.ProjectType = Layouts.ProjectType) Where LayoutID = " + layoutID + " ORDER BY Layouts.LayoutID;"); } else if (layoutID != null && ideas != null) { obj.Query("SELECT * FROM Ideas " + "INNER JOIN Projects ON (Projects.ProjectType = Ideas.ProjectType) Where IdeaID = " + layoutID + " ORDER BY Ideas.IdeaID;"); } else { obj.Query("SELECT * FROM Layouts" + // Projects.Description FROM Layouts " + " INNER JOIN Projects ON (Projects.ProjectType = Layouts.ProjectType) " + " Where Layouts.ProjectType = " + Request.QueryString["Type"].ToString() + " ORDER BY LayoutID;"); hasDescription = true; } if (obj.rdr.HasRows == true) { while (obj.rdr.Read()) { if (hasDescription) { lblDescription.Text = Convert.ToString(obj.rdr["Description"].ToString()); } if (layoutID != null && ideas == null) { HtmlGenericControl li = new HtmlGenericControl("li"); layout.Controls.Add(li); HtmlGenericControl div = new HtmlGenericControl("div"); div.InnerHtml = "<p>" + Convert.ToString(obj.rdr["ProjectName"].ToString()) + " - " + Convert.ToString(obj.rdr["LayoutID"].ToString()) + "</p><img src=\"../Images/LayoutThumbs/" + Convert.ToString(obj.rdr["LayoutThumbImage"].ToString()) + "\">"; li.Controls.Add(div); this.Page.Title = Convert.ToString(obj.rdr["ProjectName"].ToString()) + " - " + Convert.ToString(obj.rdr["LayoutID"].ToString()); } else if (layoutID != null && ideas != null) { HtmlGenericControl li = new HtmlGenericControl("li"); layout.Controls.Add(li); HtmlGenericControl div = new HtmlGenericControl("div"); div.InnerHtml = "<p>" + Convert.ToString(obj.rdr["ProjectName"].ToString()) + " - " + Convert.ToString(obj.rdr["IdeaID"].ToString()) + "</p><img src=\"../Images/LayoutThumbs/" + Convert.ToString(obj.rdr["IdeaThumbImage"].ToString()) + "\">"; li.Controls.Add(div); this.Page.Title = Convert.ToString(obj.rdr["ProjectName"].ToString()) + " - " + Convert.ToString(obj.rdr["IdeaID"].ToString()); } else { layoutsDiv.Visible = true; HtmlGenericControl li = new HtmlGenericControl("li"); tiles_small.Controls.Add(li); HtmlGenericControl anchor = new HtmlGenericControl("a"); anchor.Attributes.Add("href", "Project.aspx?LayoutID=" + Convert.ToString(obj.rdr["LayoutID"].ToString())); anchor.InnerHtml = "<p>" + Convert.ToString(obj.rdr["LayoutID"].ToString()) + "</p><img src=\"../Images/LayoutThumbs/" + Convert.ToString(obj.rdr["LayoutThumbImage"].ToString()) + "\">"; li.Controls.Add(anchor); } } } else { //No Layouts - Hide div layoutsDiv.Visible = false; layoutsDivContent.Visible = false; } //Check to see if there are Ideas to Load if (layoutID == null) { LoadProjectIdeas(obj); } } catch (Exception ex) { log.LogErrorMessage("Load Project Layouts : " + ex); } finally { obj.Close(); } }
/// <summary> /// Initial load of the screen - loads the differnet component types. /// </summary> private void LoadProjectTypes() { Database obj = new Database(); try { obj.Connect(); obj.Query("SELECT * FROM Projects ORDER BY seq"); if (obj.rdr.HasRows == true) { while (obj.rdr.Read()) { HtmlGenericControl li = new HtmlGenericControl("li"); tiles.Controls.Add(li); HtmlGenericControl anchor = new HtmlGenericControl("a"); if (Convert.ToString(obj.rdr["ProjectType"].ToString()) == "12") { //Hardcode link for walking closets anchor.Attributes.Add("href", "ClosetShape.htm"); } else { anchor.Attributes.Add("href", "Project.aspx?Type=" + Convert.ToString(obj.rdr["ProjectType"].ToString()) + "&Title=" + Convert.ToString(obj.rdr["ProjectName"].ToString())); } anchor.InnerHtml = "<p>" + Convert.ToString(obj.rdr["ProjectName"].ToString()) + "</p><img src=\"../Images/ProjectTypeThumbs/" + Convert.ToString(obj.rdr["ProjectThumbImage"].ToString()) + "\">"; li.Controls.Add(anchor); } } } catch (Exception ex) { log.LogErrorMessage("Load Project Types : " + ex); } finally { obj.Close(); } }
/// <summary> /// Initial load of the screen - loads the differnet component types. /// </summary> private void LoadLayout(int? ideas) { Database obj = new Database(); try { if (ideas == null) { obj.Connect(); obj.Query("SELECT Renders.Image,Layouts.LayoutThumbImage FROM Renders " + "INNER JOIN Layouts ON (Layouts.LayoutID = Renders.Layout) " + "WHERE Layout = " + Request.QueryString["LayoutID"].ToString() + ";"); } else { obj.Connect(); obj.Query("SELECT Renders.Image,Ideas.IdeaThumbImage FROM Renders " + "INNER JOIN Ideas ON (Ideas.IdeaID = Renders.Layout) " + "WHERE Layout = " + Request.QueryString["LayoutID"].ToString() + ";"); } if (obj.rdr.HasRows == true) { int i = 1; while (obj.rdr.Read()) { //Gallery HtmlGenericControl li = new HtmlGenericControl("li"); HtmlGenericControl liLarge = new HtmlGenericControl("li"); li.Attributes.Add("class", "item"); li.Attributes.Add("id", "gallery_small" + i); //used to give unique id for jquery. i++; liLarge.Attributes.Add("class", "item--big"); gallery.Controls.Add(li); gallery_large.Controls.Add(liLarge); HtmlGenericControl anchor = new HtmlGenericControl("a"); HtmlGenericControl anchorLarge = new HtmlGenericControl("a"); anchor.InnerHtml = "<img src=\"../Images/LayoutRenders/" + Convert.ToString(obj.rdr["Image"].ToString()) + "\">"; anchorLarge.InnerHtml = anchor.InnerHtml; li.Controls.Add(anchor); liLarge.Controls.Add(anchorLarge); } } } catch (Exception ex) { log.LogErrorMessage("Load Layout : " + ex); } finally { obj.Close(); } }
/// <summary> /// Initial load of the screen - loads the differnet component types. /// </summary> private void LoadProjectIdeas(Database obj) { try { obj.Query("SELECT * FROM Ideas INNER JOIN Projects ON Projects.ProjectType = Ideas.ProjectType Where Ideas.ProjectType = " + Request.QueryString["Type"].ToString() + " ORDER BY IdeaID;"); if (obj.rdr.HasRows == true) { ideasDiv.Visible = true; while (obj.rdr.Read()) { lblDescription.Text = Convert.ToString(obj.rdr["Description"].ToString()); HtmlGenericControl li = new HtmlGenericControl("li"); tiles_ideas.Controls.Add(li); HtmlGenericControl anchor = new HtmlGenericControl("a"); anchor.Attributes.Add("href", "Project.aspx?LayoutID=" + Convert.ToString(obj.rdr["IdeaID"].ToString()) + "&Ideas=1"); anchor.InnerHtml = "<p>" + Convert.ToString(obj.rdr["IdeaID"].ToString()) + "</p><img src=\"../Images/LayoutThumbs/" + Convert.ToString(obj.rdr["IdeaThumbImage"].ToString()) + "\">"; li.Controls.Add(anchor); } } } catch (Exception ex) { log.LogErrorMessage("Load Project Layouts : " + ex); } }
/// <summary> /// Initial load of the screen - loads the differnet component types. /// </summary> private void LoadComponents(int? ideas) { double price = 0; int i = 1; Database obj = new Database(); try { obj.Connect(); obj.Query("SELECT ComponentTypes.CompTypeName, ComponentTypes.CompTypeID, ComponentTypes.CompTypeThumbImage FROM Comp_Layout" + " INNER JOIN ComponentTypes ON (ComponentTypes.CompTypeID = Comp_Layout.ComponentType) " + " Where LayoutID = " + Request.QueryString["LayoutID"].ToString() + " ORDER BY SeqInDrawing;"); if (obj.rdr.HasRows == true) { while (obj.rdr.Read()) { //Add Place Holders for additional (up to 5) //This was a late requirement to add components for (int counter = 1 + (5 * (i - 1)); counter <= 5 * i; counter++) { string detailsDiv = ""; HtmlGenericControl li = new HtmlGenericControl("li"); comp_small.Controls.Add(li); li.Attributes.Add("id", "liAddComponent" + counter); //Hide li Place Holders if (counter != 1 + (5 * (i - 1)) && Session["Comp" + counter] == null) { li.Style.Add("display", "none"); } string link = ""; if (ideas != null) { link = "Component.aspx?Type=" + Convert.ToString(obj.rdr["CompTypeID"]) + "&Comp=Comp" + counter + "&LayoutID=" + Request.QueryString["LayoutID"].ToString() + "&Title=" + Convert.ToString(obj.rdr["CompTypeName"]) + "&Ideas=1"; } else { link = "Component.aspx?Type=" + Convert.ToString(obj.rdr["CompTypeID"]) + "&Comp=Comp" + counter + "&LayoutID=" + Request.QueryString["LayoutID"].ToString() + "&Title=" + Convert.ToString(obj.rdr["CompTypeName"]); } if (Session["Comp" + counter] != null) { detailsDiv = "<div class=\"customized-values configured\" id=\"Comp" + counter + "\"><a href=\"" + link + "\"\\><b>Component Type:</b> " + Convert.ToString(obj.rdr["CompTypeID"].ToString()); orderValues.InnerHtml = orderValues.InnerHtml + "<div class=\"customized-values\" style=\"font-size:16px!important;\" id=\"Comp" + counter + "\"><b>Component Type:</b> " + Convert.ToString(obj.rdr["CompTypeID"].ToString()); price = price + Convert.ToDouble(Session["Comp" + counter + "Price"].ToString()); orderValues.InnerHtml = orderValues.InnerHtml + Session["Comp" + counter].ToString() + "</div>"; detailsDiv = detailsDiv + Session["Comp" + counter].ToString() + "</div>"; } else { //Logic to hide additional place holders if (counter != 1 + (5 * (i - 1))) { //detailsDiv = "<div class=\"customized-values\" style=\"display:none;\" id=\"Comp" // + counter + "\"><a href=\"" + link + "\"\\>";//<b>Component Type:</b> " // // + Convert.ToString(obj.rdr["CompTypeID"].ToString()); //orderValues.InnerHtml = orderValues.InnerHtml + "<div class=\"customized-values\" style=\"display:none;\" id=\"Comp" // + counter + "\"><b>Component Type:</b> " // + Convert.ToString(obj.rdr["CompTypeID"].ToString()); } else { //detailsDiv = "<div class=\"customized-values\" id=\"Comp" // + counter + "\"><a href=\"" + link + "\"\\><b>Component Type:</b> " // + Convert.ToString(obj.rdr["CompTypeID"].ToString()); //orderValues.InnerHtml = orderValues.InnerHtml + "<div class=\"customized-values\" style=\"font-size:16px!important;\" id=\"Comp" // + counter + "\"><b>Component Type:</b> " // + Convert.ToString(obj.rdr["CompTypeID"].ToString()); } //detailsDiv = detailsDiv + " <b>ID :</b> n/a <b>W:</b> n/a <b>D:</b> n/a <b>H:</b> n/a <b>Doors:</b> n/a <b>Material:</b> n/a <b>Price:</b> n/a</div>"; //orderValues.InnerHtml = orderValues.InnerHtml + " <b>Component ID :</b> n/a <b>W:</b> n/a <b>D:</b> n/a <b>H:</b> n/a <b>Doors:</b> n/a <b>Material:</b> n/a <b>Price:</b> n/a</div>"; //values.InnerHtml.Style.Add("display", "none"); } HtmlGenericControl add = new HtmlGenericControl("div"); HtmlGenericControl remove = new HtmlGenericControl("Button"); HtmlGenericControl addDetailsDiv = new HtmlGenericControl("div"); HtmlGenericControl anchor = new HtmlGenericControl("a"); anchor.Attributes.Add("href", link); if (Session["Comp" + counter] != null) { anchor.InnerHtml = "<p>" + Convert.ToString(obj.rdr["CompTypeName"].ToString()) + "</p><img src=\"" + Session["Comp" + counter + "CompImagePath"].ToString() + "\">"; Session["ComponentImagePath"] = ""; } else { anchor.InnerHtml = "<p>" + Convert.ToString(obj.rdr["CompTypeName"].ToString()) + "</p><img src=\"../Images/CompTypeThumbs/" + Convert.ToString(obj.rdr["CompTypeThumbImage"].ToString()) + "\"></a>"; } //+ Convert.ToString(obj.rdr["CompTypeThumbImage"].ToString()) + "\"></a>"; // add.InnerHtml = "<div style=\"background-color: orange;width: 100%;\"id=AddComponent" + counter + ">+</div>"; if (counter != 1 + (5 * (i - 1))) { add.InnerHtml = "<Button style=\"padding:2 2 2 2px !important; background-color: orange;width: 40%;\"id=AddComponent" + counter + " onclick=\"return false;\">+</Button>" + "<Button style=\"padding:2 2 2 2px !important; background-color: red;width: 40%;\"id=RemoveComponent" + counter + " onclick=\"return false;\">-</Button>"; } else { add.InnerHtml = "<Button style=\"padding:2 2 2 2px !important; background-color: orange;width: 40%;\"id=AddComponent" + counter + " onclick=\"return false;\">+</Button>"; } remove.InnerHtml = "<Button style=\"padding:2 2 2 2px !important; background-color: red;width: 40%%;\"id=RemoveComponent" + counter + " onclick=\"return false;\">-</Button>"; addDetailsDiv.InnerHtml = detailsDiv; li.Controls.Add(add); // li.Controls.Add(remove); li.Controls.Add(anchor); if (counter % 5 != 0) //Causing extra anchor tags - don't know why. { li.Controls.Add(addDetailsDiv); } } i++; } lblTotalPrice.Text = "$" + price.ToString(); lblOrderPrice.Text = "$" + price.ToString(); } } catch (Exception ex) { log.LogErrorMessage("Load Component : " + ex); } finally { obj.Close(); } }
/// <summary> /// Populates the drop down size selector based on database values /// </summary> private void PopulateDropDowns() { int widthMin = 0; int widthMax = 0; int depthMin = 0; int depthMax = 0; int heightMin = 0; int heightMax = 0; int index = 0; //Clear Values compWidth.Items.Clear(); compDepth.Items.Clear(); compHeight.Items.Clear(); compMaterial.Items.Clear(); compDoors.Items.Clear(); Database db = new Database(); try { db.Connect(); db.Query("SELECT * FROM Components Where CompID = " + Request.QueryString["CompId"].ToString() + ";"); if (db.rdr.HasRows == true) { while (db.rdr.Read()) { widthMin = (Convert.ToString(db.rdr["Wmin"])) != null ? Convert.ToInt32(Convert.ToString(db.rdr["Wmin"])) : 0; widthMax = (Convert.ToString(db.rdr["Wmax"])) != null ? Convert.ToInt32(Convert.ToString(db.rdr["Wmax"])) : 0; heightMin = (Convert.ToString(db.rdr["Hmin"])) != null ? Convert.ToInt32(Convert.ToString(db.rdr["Hmin"])) : 0; heightMax = (Convert.ToString(db.rdr["Hmax"])) != null ? Convert.ToInt32(Convert.ToString(db.rdr["Hmax"])) : 0; depthMin = !string.IsNullOrEmpty((Convert.ToString(db.rdr["Dmin"]))) ? Convert.ToInt32(Convert.ToString(db.rdr["Dmin"])) : 0; depthMax = !string.IsNullOrEmpty((Convert.ToString(db.rdr["Dmax"]))) ? Convert.ToInt32(Convert.ToString(db.rdr["Dmax"])) : 0; numDoors.Text = (Convert.ToString(db.rdr["Ndoors"])); formula.Text = (Convert.ToString(db.rdr["Formula"])); numShelves.Text = (Convert.ToString(db.rdr["Nshelves"])); numDrawers.Text = (Convert.ToString(db.rdr["Ndrawers"])); numHandles.Text = (Convert.ToString(db.rdr["Nhandles"])); faceDoorCoverage.Text = (Convert.ToString(db.rdr["FaceDoorCoverage"])); } for (int i = widthMin; i <= widthMax; i++) { compWidth.Items.Insert(index, new ListItem(Convert.ToString(i) + " \"", Convert.ToString(i) + " \"")); index++; } index = 0; for (int i = depthMin; i <= depthMax; i++) { compDepth.Items.Insert(index, new ListItem(Convert.ToString(i) + " \"", Convert.ToString(i) + " \"")); index++; } index = 0; for (int i = heightMin; i <= heightMax; i++) { compHeight.Items.Insert(index, new ListItem(Convert.ToString(i) + " \"", Convert.ToString(i) + " \"")); index++; } //Doors if (numDoors.Text == "0" || numDoors.Text =="") { divDoors.Visible = false; } else { divDoors.Visible = true; compDoors.Items.Insert(0, new ListItem("Left", "Left")); compDoors.Items.Insert(1, new ListItem("Right", "Right")); } //Material compMaterial.Items.Insert(0, new ListItem("Veneer Maple", "Veneer Maple")); compMaterial.Items.Insert(1, new ListItem("Veneer Oak", "Veneer Oak")); compMaterial.Items.Insert(2, new ListItem("Veneer Cherry", "Veneer Cherry")); compMaterial.Items.Insert(3, new ListItem("Painted", "Painted")); } } catch (Exception ex) { // log.LogErrorMessage("Populate Drop Downs : " + ex); } finally { db.Close(); } }
/// <summary> /// Initial load of the screen - loads the differnet component types. /// </summary> private void LoadRender() { Database obj = new Database(); try { LoadComponents(Convert.ToInt32(Request.QueryString["CompId"].ToString()), null); obj.Connect(); obj.Query("SELECT * FROM Renders Where Component = " + Request.QueryString["CompId"].ToString() + ";"); if (obj.rdr.HasRows == true) { int i = 1; while (obj.rdr.Read()) { //Gallery HtmlGenericControl li = new HtmlGenericControl("li"); HtmlGenericControl liLarge = new HtmlGenericControl("li"); li.Attributes.Add("class", "item"); li.Attributes.Add("id", "gallery_small" + i); //used to give unique id for jquery. i++; liLarge.Attributes.Add("class", "item--big"); gallery.Controls.Add(li); gallery_large.Controls.Add(liLarge); HtmlGenericControl anchor = new HtmlGenericControl("a"); HtmlGenericControl anchorLarge = new HtmlGenericControl("a"); anchor.InnerHtml = "<img src=\"../Images/CompRenders/" + Convert.ToString(obj.rdr["Image"].ToString()) + "\">"; anchorLarge.InnerHtml = anchor.InnerHtml; li.Controls.Add(anchor); liLarge.Controls.Add(anchorLarge); } } } catch (Exception ex) { //log.LogErrorMessage("Load Render : " + ex); } finally { obj.Close(); } }
/// <summary> /// Initial load of the screen - loads the differnet component types. /// </summary> private void LoadComponentTypes() { Database obj = new Database(); try { obj.Connect(); obj.Query("SELECT * FROM ComponentTypes ORDER BY Seq"); if (obj.rdr.HasRows == true) { while (obj.rdr.Read()) { HtmlGenericControl li = new HtmlGenericControl("li"); tiles.Controls.Add(li); HtmlGenericControl anchor = new HtmlGenericControl("a"); anchor.Attributes.Add("href", "Component.aspx?Type=" + Convert.ToString(obj.rdr["CompTypeID"].ToString()) + "&Title=" + Convert.ToString(obj.rdr["CompTypeName"].ToString())); anchor.InnerHtml = "<p>" + Convert.ToString(obj.rdr["CompTypeName"]) + "</p><img src=\"../Images/CompTypeThumbs/" + Convert.ToString(obj.rdr["CompTypeThumbImage"].ToString()) + "\">"; li.Controls.Add(anchor); } } } catch (Exception ex) { //log.LogErrorMessage("Load Component Types : " + ex); } finally { obj.Close(); } }
/// <summary> /// Initial load of the screen - loads the differnet component types. /// </summary> private void LoadComponents(int? compID, int? ideas) { String queryString = ""; Database obj = new Database(); int currentStyle = 0; string prevStyle = ""; try { obj.Connect(); if (compID != null) { obj.Query("SELECT Components.Description, Components.CompID,Components.CompThumbImage,ComponentTypes.CompTypeName, ComponentTypes.CompTypeName, Components.CompID FROM Components " + "INNER JOIN ComponentTypes ON (componentTypes.CompTypeID = Components.CompType)" + "WHERE CompId =" + Request.QueryString["CompId"].ToString() + " ORDER BY Components.CompStyle,Components.CompID;"); } else { obj.Query("SELECT ComponentTypes.Description, Components.CompThumbImage,Components.CompID, Components.CompStyle " + "FROM Components INNER JOIN ComponentTypes ON (ComponentTypes.CompTypeID = Components.CompType) " + "Where CompType = " + Request.QueryString["Type"].ToString() + " ORDER BY Components.CompStyle,Components.CompID;"); } if (obj.rdr.HasRows == true) { while (obj.rdr.Read()) { lblDescription.Text = Convert.ToString(obj.rdr["Description"].ToString()); HtmlGenericControl li = new HtmlGenericControl("li"); if (compID != null) { comp.Controls.Add(li); this.Page.Title = Convert.ToString(obj.rdr["CompTypeName"]) + " - " + Convert.ToString(obj.rdr["CompID"]); HtmlGenericControl div = new HtmlGenericControl("div"); componentImagePath = "../Images/CompThumbs/" + Convert.ToString(obj.rdr["CompThumbImage"].ToString()); div.InnerHtml = "<p>" + Convert.ToString(obj.rdr["CompTypeName"]) + " - " + Convert.ToString(obj.rdr["CompID"]) + "</p><img src=\""+componentImagePath + "\">"; li.Controls.Add(div); } else { queryString = "Component.aspx?CompId=" + Convert.ToString(obj.rdr["CompID"]); if (Request.QueryString["Comp"] != null) { queryString = queryString + "&Comp=" + Request.QueryString["Comp"].ToString() + "&LayoutID=" + Request.QueryString["LayoutID"].ToString(); } if (ideas != null) { queryString = queryString + "&Ideas=1"; } //Find the Style and sort it into the right div. Currently allow for 5. string style = Convert.ToString(obj.rdr["CompStyle"]); if ((currentStyle == 0 && String.IsNullOrEmpty(prevStyle)) || (currentStyle == 1 && prevStyle == style)) { styleHeader.Text = "Style " + style; tiles_small.Controls.Add(li); prevStyle = style; currentStyle = 1; } else if ((currentStyle == 1 && prevStyle != style) || (currentStyle == 2 && prevStyle == style)) { styleHeader2.Text = "Style " + style; tiles_small2.Controls.Add(li); prevStyle = style; currentStyle = 2; } else if ((currentStyle == 2 && prevStyle != style) || (currentStyle == 3 && prevStyle == style)) { styleHeader3.Text = "Style " + style; tiles_small3.Controls.Add(li); prevStyle = style; currentStyle = 3; } else if ((currentStyle == 3 && prevStyle != style) || (currentStyle == 4 && prevStyle == style)) { styleHeader4.Text = "Style " + style; tiles_small4.Controls.Add(li); prevStyle = style; currentStyle = 4; } else if ((currentStyle == 4 && prevStyle != style) || (currentStyle == 5 && prevStyle == style)) { styleHeader5.Text = "Style " + style; tiles_small5.Controls.Add(li); prevStyle = style; currentStyle = 5; } HtmlGenericControl anchor = new HtmlGenericControl("a"); anchor.Attributes.Add("href", queryString); anchor.InnerHtml = "<p>" + Convert.ToString(obj.rdr["CompID"].ToString()) + "</p><img src=\"../Images/CompThumbs/" + Convert.ToString(obj.rdr["CompThumbImage"]) + "\">"; li.Controls.Add(anchor); } } } } catch (Exception ex) { //log.LogErrorMessage("Load Components : " + ex); } finally { obj.Close(); } }