protected void Page_Load(object sender, EventArgs e) { //check for any url encoded parameters string foundIDData = ""; if (Request.QueryString.HasKeys()) { try { CustomCode x = new CustomCode(); string targetID = Request.QueryString["ID"]; //The following is a bogus division that will go at the end of the displayed page so that the client can't obtain the ID string htmlForID = "<div " + DynControls.encodeProperty("id", "x_" + targetID) + DynControls.encodeProperty("class", "getID") + " ></div>"; //Get the PN associated with the targetID clsDB myDB = new clsDB(); SqlCommand cmd = new SqlCommand(); List <SqlParameter> ps = new List <SqlParameter>(); ps.Add(new SqlParameter("@pnID", Int64.Parse(targetID))); string pageHeader = ""; using (myDB.OpenConnection()) { using (SqlDataReader dR = (SqlDataReader)myDB.ExecuteSP(DBK.SP.spOTSGETPNINFO, ps, clsDB.SPExMode.READER, ref cmd)) { if (dR != null && dR.HasRows) { dR.Read(); pageHeader = myDB.Fld2Str(dR[DBK.strPARTNUMBER]); } } } if (Request.QueryString["INV"] != null) { pageHeader = DynControls.html_header_string(pageHeader + " Inventory", 1); foundIDData = pageHeader + x.InvForPN(targetID) + htmlForID; } else if (Request.QueryString["INVH"] != null) { pageHeader = DynControls.html_header_string(pageHeader + " Inventory History", 1); foundIDData = pageHeader + x.MakePartNumberInventoryHistoryTable(Int64.Parse(targetID)) + htmlForID; } else { foundIDData = x.getHTMLForPartNumberID(targetID); } otsdivs.Controls.Add(new LiteralControl(foundIDData)); foreach (Control c in divMenuButtons.Controls) { divMenuButtons.Controls.Remove(c); } return; } catch (Exception ex) { string x = ex.Message + ex.StackTrace; } } //Create three panels and add them to the existing div Panel divOTSNew = new Panel(); divOTSNew.ID = "divOTSNew"; divOTSNew.Style.Add(HtmlTextWriterStyle.Display, "none"); otsdivs.Controls.Add(divOTSNew); //There are two panels in divOTSNew: divOTSNewIn and divOTSNewOut Panel divOTSNewIn = new Panel(); divOTSNewIn.ID = "divOTSNewIn"; //Get the input controls from the database for divOTSNewIn... DynControls.GenerateControlsFromDatabase(DBK.AppKeys.GET_NEWOTSPN, divOTSNewIn); //Add a Submit button divOTSNewIn.Controls.Add(DynControls.html_button("btnOTSNewIn", "SUBMIT", "inputButton", true, AAAK.DISPLAYTYPES.BLOCK, "Create an OTS Part Number", "frmNewOTS")); //...and add a div for the ajax output Panel divOTSNewOut = new Panel(); divOTSNewOut.ID = "divOTSNewOut"; divOTSNewOut.Controls.Add(new LiteralControl("<p>Enter the information on the left, then press Submit to get your new OTS Part Number.</p>")); //Add these two sub panels divOTSNew.Controls.Add(divOTSNewIn); divOTSNew.Controls.Add(divOTSNewOut); //***** End divOTSNew //***** Start divOTSFind Panel divOTSFind = new Panel(); divOTSFind.ID = "divOTSFind"; divOTSFind.Style.Add(HtmlTextWriterStyle.Display, "none"); //divOTSFind.Style.Add(HtmlTextWriterStyle.OverflowX, "auto"); otsdivs.Controls.Add(divOTSFind); //Now: The html in this div is simple, but as the user make selections, the AJAX calls increase the //complexity of the children's html. //This div has 3 divs. ///divOTSFind Child Div 1: Panel divSearch = new Panel(); divSearch.ID = "divSearch"; DynControls.GenerateControlsFromDatabase(DBK.AppKeys.SEARCH_OTS, divSearch, null, "", -1, true); //Create the search button string btnSearchHtmlString = DynControls.html_button_string("btnLook", "SEARCH", "searchButton", true, AAAK.DISPLAYTYPES.BLOCK, form: "frmSearchOTS"); divSearch.Controls.Add(new LiteralControl(btnSearchHtmlString)); ///divOTSFind Child Div 2: ///The message div Panel divSearchMsg = new Panel(); divSearchMsg.Style.Add(HtmlTextWriterStyle.Display, "block"); divSearchMsg.ID = "divMessage"; divSearchMsg.Controls.Add(new LiteralControl("<p " + DynControls.encodeProperty("id", "searchmsg") + ">" + "Enter search criteria above to find Part Number Information.</p>")); ///divOTSFind Child Div 3: /// Panel divLook = new Panel(); divLook.Style.Add(HtmlTextWriterStyle.Display, "block"); divLook.Style.Add(HtmlTextWriterStyle.OverflowX, "auto"); divLook.ID = "divLook"; /// divLook's html will be determine when user presses SEARCH ///Add the three divs to divOTSFind divOTSFind.Controls.Add(divSearch); divOTSFind.Controls.Add(new LiteralControl("<div></div>")); divOTSFind.Controls.Add(divSearchMsg); divOTSFind.Controls.Add(divLook); Panel divOTSAdmin = new Panel(); divOTSAdmin.ID = "divOTSAdmin"; divOTSAdmin.Controls.Add(new LiteralControl("<p>Admin</p>")); divOTSAdmin.Style.Add(HtmlTextWriterStyle.Display, "none"); otsdivs.Controls.Add(divOTSAdmin); }
public static string getHTMLForPartNumberIDInventory(string input) { CustomCode x = new CustomCode(); return(x.InvForPN(input)); }