protected void Page_Load(object sender, EventArgs e) { Label firstLabel = (Label)Master.FindControl("lblUpdate"); if (firstLabel != null) { firstLabel.Text = "VIEWING"; } Label secondLabel = (Label)Master.FindControl("lblPartNumTitle"); if (secondLabel != null) { secondLabel.Text = Session["partNumber"].ToString(); } if (Session["updateSelected"] != null) { btnInsert.CssClass = "removeElement"; } if (Session["user_type"].ToString() != "S") { btnUpdate.Visible = false; btnInsert.Visible = false; } //prevent backdoor if (Session["tableName"] == null) { Response.Redirect("ProductSelect.aspx"); } else { //load dropdowns if (!Page.IsPostBack) { Session.Add("UpdatePartList", "true"); //set up a dataview object to hold table names for the first drop down System.Data.DataView tableList = new System.Data.DataView(); //select table names datSelectDataSource.SelectCommand = "SELECT name FROM sys.tables WHERE name != 'tblColor' AND name != 'tblSchematicParts' AND name != 'tblParts' " + " AND name != 'tblLengthUnits' AND name != 'tblAudits' AND name != 'tblSalesOrders' AND name != 'tblSalesOrderItems' " + " AND SUBSTRING(name,1,3) = 'tbl' " + "ORDER BY name ASC"; //assign the table names to the dataview object tableList = (System.Data.DataView)datSelectDataSource.Select(System.Web.UI.DataSourceSelectArguments.Empty); //variable to determine amount of rows in the dataview object int rowCount = tableList.Count; ddlCategory.Items.Add(""); //populate first drop down for (int i = 0; i < rowCount; i++) { string textString = tableList[i][0].ToString(); string newString = textString.Substring(3); string outputString = ""; foreach (char character in newString) { if (char.IsUpper(character)) { outputString += " " + character; } else if (character.ToString() == "1" || character.ToString() == "3" || character.ToString() == "4") { outputString += " " + character; } else { outputString += character; } } ddlCategory.Items.Add(outputString.Trim()); } //select category dropdown default value ddlCategory.SelectedIndex = (int)Session["categoryIndex"]; //load part list if (ddlCategory.SelectedValue != "") { //get table name selected string tableName = "tbl" + ddlCategory.SelectedValue.Replace(" ", ""); //set up a dataview object to hold part numbers for the second drop down System.Data.DataView partsList = new System.Data.DataView(); if (tableName != "tblSchematics") { //select part numbers datSelectDataSource.SelectCommand = "SELECT partNumber, partName FROM " + tableName + " ORDER BY partNumber ASC"; } else { datSelectDataSource.SelectCommand = "SELECT schematicNumber, partName FROM " + tableName + " ORDER BY schematicNumber ASC"; } //assign the table names to the dataview object partsList = (System.Data.DataView)datSelectDataSource.Select(System.Web.UI.DataSourceSelectArguments.Empty); //clear second drop down ddlPart.Items.Clear(); //Insert empty string to first row of second drop down ddlPart.Items.Add(""); rowCount = partsList.Count; //populate second drop down for (int i = 0; i < rowCount; i++) { ddlPart.Items.Add(partsList[i][0].ToString() + " (" + partsList[i][1].ToString() + ")"); } Session.Add("displayChanged", "true"); } } //only run if the display has changed, to allow display postback changes if (Session["displayChanged"] != null) { //we're running this, so the display has been updated, and is not set for change Session.Remove("displayChanged"); //select part dropdown default value ddlPart.SelectedIndex = (int)Session["partIndex"]; //show navigation arrows imgPrevArrow.CssClass = "prevArrow"; imgNextArrow.CssClass = "nextArrow"; if (ddlPart.SelectedIndex == (ddlPart.Items.Count-1)) { //if last item, don't show 'next' arrow imgNextArrow.CssClass = "removeElement"; } else if (ddlPart.SelectedIndex == 1) { //if first item, don't show 'prev' arrow imgPrevArrow.CssClass = "removeElement"; } //load appropriate image imgPart.ImageUrl = "Images/catalogue/" + Session["partNumber"].ToString() + ".jpg"; imgPartLink.NavigateUrl = "Images/catalogue/" + Session["partNumber"].ToString() + ".jpg"; //remove all non-product panels, whichw ill be shown on switch case below pnlAccessories.CssClass = "removeElement"; pnlDecorativeColumn.CssClass = "removeElement"; pnlDoorFrameExtrusions.CssClass = "removeElement"; pnlInsulatedFloors.CssClass = "removeElement"; pnlRoofExtrusions.CssClass = "removeElement"; pnlRoofPanels.CssClass = "removeElement"; pnlScreenRoll.CssClass = "removeElement"; pnlSuncrylicRoof.CssClass = "removeElement"; pnlSunrail1000.CssClass = "removeElement"; pnlSunrail300.CssClass = "removeElement"; pnlSunrail400.CssClass = "removeElement"; pnlVinylRoll.CssClass = "removeElement"; pnlWallExtrusions.CssClass = "removeElement"; pnlWallPanel.CssClass = "removeElement"; pnlSchematicsDisplay.CssClass = "removeElement"; //Uncomment for checks with login /* if (Session["loggedCountry"] == null) { pnlPriceDisplay.CssClass = "removeElement"; } else if (Session["loggedCountry"] == "US") { rowCadPrice.CssClass = "removeElement"; } else { rowUsdPrice.CssClass = "removeElement"; } */ //if value was changed on display page, we string tableName = Session["tableName"].ToString(); switch (tableName) { #region Accessories case "tblAccessories": { pnlAccessories.CssClass = "dimensionsTableDisplay"; rowLegend.CssClass = "removeElement"; rowComposition.CssClass = "removeElement"; rowStandard.CssClass = "removeElement"; lblPartName.Text = "Part Name:"; lblPartNum.Text = "Part Number:"; Accessories anAccessory = new Accessories(); //call select all function to populate object anAccessory.Populate(anAccessory.SelectAll(datDisplayDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); txtPartNum.Text = anAccessory.AccessoryNumber; txtPartName.Text = anAccessory.AccessoryName; txtPartDesc.Text = anAccessory.AccessoryDescription; txtColor.Text = anAccessory.AccessoryColor; txtPackQuantity.Text = anAccessory.AccessoryPackQuantity.ToString(); txtAccessorySize.Text = anAccessory.AccessorySize.ToString() + " " + anAccessory.AccessorySizeUnits; txtAccessoryWidth.Text = anAccessory.AccessoryWidth.ToString() + " " + anAccessory.AccessoryWidthUnits; txtAccessoryLength.Text = anAccessory.AccessoryLength.ToString() + " " + anAccessory.AccessoryLengthUnits; if (txtPackQuantity.Text == "0" || txtPackQuantity.Text == "") { rowPackQuantity.CssClass = "removeElement"; } if (anAccessory.AccessorySize == 0)//a space is added above, so check for one space, not blank { rowAccessorySize.CssClass = "removeElement"; } if (anAccessory.AccessoryLength == 0) { rowAccessoryMaxLength.CssClass = "removeElement"; } if (anAccessory.AccessoryWidth == 0) { rowAccessoryMaxWidth.CssClass = "removeElement"; } if (txtColor.Text == "") { rowColor.CssClass = "removeElement"; } txtUsdPrice.Text = anAccessory.AccessoryUsdPrice.ToString("N2"); txtCadPrice.Text = anAccessory.AccessoryCadPrice.ToString("N2"); break; } #endregion #region DecorativeColumn case "tblDecorativeColumn": { pnlDecorativeColumn.CssClass = "dimensionsTableDisplay"; rowLegend.CssClass = "removeElement"; rowComposition.CssClass = "removeElement"; rowStandard.CssClass = "removeElement"; rowPackQuantity.CssClass = "removeElement"; DecorativeColumn aColumn = new DecorativeColumn(); //call select all function to populate object aColumn.Populate(aColumn.SelectAll(datDisplayDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); txtPartName.Text = aColumn.ColumnName; txtPartDesc.Text = aColumn.ColumnDescription; txtPartNum.Text = aColumn.PartNumber; txtColor.Text = aColumn.ColumnColor; txtDecColLength.Text = aColumn.ColumnLength.ToString() + " " + aColumn.ColumnLengthUnits; txtUsdPrice.Text = aColumn.ColumnUsdPrice.ToString("N2"); txtCadPrice.Text = aColumn.ColumnCadPrice.ToString("N2"); break; } #endregion #region Door Frame Extrusion case "tblDoorFrameExtrusion": { pnlDoorFrameExtrusions.CssClass = "dimensionsTableDisplay"; rowLegend.CssClass = "removeElement"; rowComposition.CssClass = "removeElement"; rowStandard.CssClass = "removeElement"; rowPackQuantity.CssClass = "removeElement"; DoorFrameExtrusion aFrameExtrusion = new DoorFrameExtrusion(); //call select all function to populate object aFrameExtrusion.Populate(aFrameExtrusion.SelectAll(datDisplayDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); txtPartName.Text = aFrameExtrusion.DfeName; if (aFrameExtrusion.DfeDescription != "") { txtPartDesc.Text = aFrameExtrusion.DfeDescription; } else { rowDescription.CssClass = "removeElement"; } txtPartNum.Text = aFrameExtrusion.PartNumber; txtColor.Text = aFrameExtrusion.DfeColor; txtDoorFrExtMaxLength.Text = aFrameExtrusion.DfeMaxLength.ToString() + " " + aFrameExtrusion.DfeMaxLengthUnits; txtUsdPrice.Text = aFrameExtrusion.UsdPrice.ToString("N2"); txtCadPrice.Text = aFrameExtrusion.CadPrice.ToString("N2"); break; } #endregion #region InsulatedFloors case "tblInsulatedFloors": { pnlInsulatedFloors.CssClass = "dimensionsTableDisplay"; rowLegend.CssClass = "removeElement"; rowStandard.CssClass = "removeElement"; rowPackQuantity.CssClass = "removeElement"; rowColor.CssClass = "removeElement"; InsulatedFloors aFloor = new InsulatedFloors(); //call select all function to populate object aFloor.Populate(aFloor.SelectAll(datDisplayDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); txtPartName.Text = aFloor.InsulatedFloorName; txtPartDesc.Text = aFloor.InsulatedFloorDescription; txtPartNum.Text = aFloor.PartNumber; txtInsFloorSize.Text = aFloor.InsulatedFloorSize.ToString() + " " + aFloor.InsulatedFloorSizeUnits; txtInsFloorMaxWidth.Text = aFloor.InsulatedFloorMaxWidth.ToString() + " " + aFloor.InsulatedFloorMaxWidthUnits; txtInsFloorMaxLength.Text = aFloor.InsulatedFloorMaxLength.ToString(); txtUsdPrice.Text = aFloor.InsulatedFloorUsdPrice.ToString("N2"); txtCadPrice.Text = aFloor.InsulatedFloorCadPrice.ToString("N2"); break; } #endregion #region RoofPanels case "tblRoofPanels": { pnlRoofPanels.CssClass = "dimensionsTableDisplay"; rowLegend.CssClass = "removeElement"; rowPackQuantity.CssClass = "removeElement"; RoofPanels aRoofPanel = new RoofPanels(); //call select all function to populate object aRoofPanel.Populate(aRoofPanel.SelectAll(datDisplayDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); txtPartName.Text = aRoofPanel.PanelName; txtPartDesc.Text = aRoofPanel.PanelDescription; txtPartNum.Text = aRoofPanel.PartNumber; txtComposition.Text = aRoofPanel.PanelComposition; txtStandard.Text = aRoofPanel.PanelStandard; txtColor.Text = aRoofPanel.PanelColor; txtRoofPnlSize.Text = aRoofPanel.PanelSize.ToString() + " " + aRoofPanel.PanelSizeUnits; txtRoofPnlMaxWidth.Text = aRoofPanel.PanelMaxWidth.ToString() + " " + aRoofPanel.MaxWidthUnits; txtRoofPnlMaxLength.Text = aRoofPanel.PanelMaxLength; txtUsdPrice.Text = aRoofPanel.UsdPrice.ToString("N2"); txtCadPrice.Text = aRoofPanel.CadPrice.ToString("N2"); break; } #endregion #region Schematics case "tblSchematics": { pnlSchematicsDisplay.CssClass = "schematicsTableDisplay"; rowComposition.CssClass = "removeElement"; rowStandard.CssClass = "removeElement"; rowPackQuantity.CssClass = "removeElement"; rowColor.CssClass = "removeElement"; lblLegend.Text = "Legend:"; Schematics aSchematic = new Schematics(); Part aPart = new Part(); //call select all function to populate object aSchematic.Populate(aSchematic.SelectAll(datDisplayDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); txtPartNum.Text = aSchematic.SchematicNumber; if (Session["UpdatePartList"].ToString() == "true" || !Page.IsPostBack) { UpdatePartsList(); Session.Remove("UpdatePartList"); } if (Session["part"] != null) { aPart = (Part)Session["part"]; txtSchemPartKey.Text = aPart.PartKeyNumber.ToString(); txtSchemPartName.Text = aPart.PartName; txtSchemPartNum.Text = aPart.PartNumber; } else { txtSchemPartKey.Text = ""; txtSchemPartName.Text = ""; txtSchemPartNum.Text = ""; } lblPartName.Text = "Schematic Name:"; txtPartName.Text = aSchematic.SchematicName.ToString(); txtPartDesc.Text = aSchematic.SchematicDescription.ToString(); lblPartNum.Text = "Schematic Number:"; txtPartNum.Text = aSchematic.SchematicNumber.ToString(); if (txtPartDesc.Text == "") { txtPartDesc.Text = "No Description"; } txtUsdPrice.Text = aSchematic.SchematicUsdPrice.ToString("N2"); txtCadPrice.Text = aSchematic.SchematicCadPrice.ToString("N2"); break; } #endregion #region Screen Roll case "tblScreenRoll": { pnlScreenRoll.CssClass = "dimensionsTableDisplay"; rowLegend.CssClass = "removeElement"; rowDescription.CssClass = "removeElement"; rowComposition.CssClass = "removeElement"; rowStandard.CssClass = "removeElement"; rowPackQuantity.CssClass = "removeElement"; rowColor.CssClass = "removeElement"; ScreenRoll aScreenRoll = new ScreenRoll(); //call select all function to populate object aScreenRoll.Populate(aScreenRoll.SelectAll(datDisplayDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); txtPartName.Text = aScreenRoll.ScreenRollName; txtPartNum.Text = aScreenRoll.PartNumber; txtScreenRollWidth.Text = aScreenRoll.ScreenRollWidth + " " + aScreenRoll.ScreenRollWidthUnits; txtScreenRollLength.Text = aScreenRoll.ScreenRollLength + " " + aScreenRoll.ScreenRollLengthUnits; txtUsdPrice.Text = aScreenRoll.UsdPrice.ToString("N2"); txtCadPrice.Text = aScreenRoll.CadPrice.ToString("N2"); break; } #endregion #region Suncrylic Roof case "tblSuncrylicRoof": { pnlSuncrylicRoof.CssClass = "dimensionsTableDisplay"; rowLegend.CssClass = "removeElement"; rowComposition.CssClass = "removeElement"; rowStandard.CssClass = "removeElement"; rowPackQuantity.CssClass = "removeElement"; SuncrylicRoof aSuncrylicRoof = new SuncrylicRoof(); //call select all function to populate object aSuncrylicRoof.Populate(aSuncrylicRoof.SelectAll(datDisplayDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); txtPartName.Text = aSuncrylicRoof.SuncrylicName; txtPartDesc.Text = aSuncrylicRoof.SuncrylicDescription; txtPartNum.Text = aSuncrylicRoof.PartNumber; txtColor.Text = aSuncrylicRoof.SuncrylicColor; txtSunRoofMaxLength.Text = aSuncrylicRoof.SuncrylicMaxLength + " " + aSuncrylicRoof.SuncrylicLengthUnits; txtSunRoofMaxWidthStr.Text = "Varies"; txtUsdPrice.Text = aSuncrylicRoof.UsdPrice.ToString("N2"); txtCadPrice.Text = aSuncrylicRoof.CadPrice.ToString("N2"); break; } #endregion #region Sunrail1000 case "tblSunrail1000": { pnlSunrail1000.CssClass = "dimensionsTableDisplay"; rowLegend.CssClass = "removeElement"; rowComposition.CssClass = "removeElement"; rowStandard.CssClass = "removeElement"; rowPackQuantity.CssClass = "removeElement"; Sunrail1000 aSunrail = new Sunrail1000(); //call select all function to populate object aSunrail.Populate(aSunrail.SelectAll(datDisplayDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); txtPartName.Text = aSunrail.Sunrail1000Name; txtPartDesc.Text = aSunrail.Sunrail1000Description; txtPartNum.Text = aSunrail.PartNumber; txtColor.Text = aSunrail.Sunrail1000Color; txtSun1000MaxLength.Text = aSunrail.Sunrail1000MaxLengthFeet.ToString() + " " + aSunrail.Sunrail1000MaxLengthFeetUnits + " " + aSunrail.Sunrail1000MaxLengthInches.ToString() + " " + aSunrail.Sunrail1000MaxLengthInchesUnits; txtUsdPrice.Text = aSunrail.Sunrail1000UsdPrice.ToString("N2"); txtCadPrice.Text = aSunrail.Sunrail1000CadPrice.ToString("N2"); break; } #endregion #region Sunrail300 case "tblSunrail300": { pnlSunrail300.CssClass = "dimensionsTableDisplay"; rowLegend.CssClass = "removeElement"; rowComposition.CssClass = "removeElement"; rowStandard.CssClass = "removeElement"; rowPackQuantity.CssClass = "removeElement"; Sunrail300 aSunrail300 = new Sunrail300(); //call select all function to populate object aSunrail300.Populate(aSunrail300.SelectAll(datDisplayDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); txtPartName.Text = aSunrail300.Sunrail300Name; txtPartDesc.Text = aSunrail300.Sunrail300Description; txtPartNum.Text = aSunrail300.PartNumber; txtColor.Text = aSunrail300.Sunrail300Color; txtSun300MaxLength.Text = aSunrail300.Sunrail300MaxLengthFeet.ToString() + " " + aSunrail300.Sunrail300MaxLengthFeetUnits + " " + aSunrail300.Sunrail300MaxLengthInches.ToString() + " " + aSunrail300.Sunrail300MaxLengthInchesUnits; txtUsdPrice.Text = aSunrail300.Sunrail300UsdPrice.ToString("N2"); txtCadPrice.Text = aSunrail300.Sunrail300CadPrice.ToString("N2"); break; } #endregion #region Sunrail300Accessories case "tblSunrail300Accessories": { rowLegend.CssClass = "removeElement"; rowComposition.CssClass = "removeElement"; rowStandard.CssClass = "removeElement"; rowPackQuantity.CssClass = "removeElement"; Sunrail300Accessories aSunrail300Accessory = new Sunrail300Accessories(); //call select all function to populate object aSunrail300Accessory.Populate(aSunrail300Accessory.SelectAll(datDisplayDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); txtPartName.Text = aSunrail300Accessory.Sunrail300AccessoriesName; txtPartDesc.Text = aSunrail300Accessory.Sunrail300AccessoriesDescription; txtPartNum.Text = aSunrail300Accessory.PartNumber; txtColor.Text = aSunrail300Accessory.Sunrail300AccessoriesColor; txtUsdPrice.Text = aSunrail300Accessory.Sunrail300AccessoriesUsdPrice.ToString("N2"); txtCadPrice.Text = aSunrail300Accessory.Sunrail300AccessoriesCadPrice.ToString("N2"); break; } #endregion #region Sunrail400 case "tblSunrail400": { pnlSunrail400.CssClass = "dimensionsTableDisplay"; rowLegend.CssClass = "removeElement"; rowComposition.CssClass = "removeElement"; rowStandard.CssClass = "removeElement"; rowPackQuantity.CssClass = "removeElement"; Sunrail400 aSunrail400 = new Sunrail400(); //call select all function to populate object aSunrail400.Populate(aSunrail400.SelectAll(datDisplayDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); txtPartName.Text = aSunrail400.Sunrail400Name; txtPartDesc.Text = aSunrail400.Sunrail400Description; txtPartNum.Text = aSunrail400.PartNumber; txtColor.Text = aSunrail400.Sunrail400Color; txtSun400MaxLength.Text = aSunrail400.Sunrail400MaxLengthFeet.ToString() + " " + aSunrail400.Sunrail400MaxLengthFeetUnits + " " + aSunrail400.Sunrail400MaxLengthInches.ToString() + " " + aSunrail400.Sunrail400MaxLengthInchesUnits; txtUsdPrice.Text = aSunrail400.Sunrail400UsdPrice.ToString("N2"); txtCadPrice.Text = aSunrail400.Sunrail400CadPrice.ToString("N2"); break; } #endregion #region VinylRoll case "tblVinylRoll": { pnlVinylRoll.CssClass = "dimensionsTableDisplay"; rowLegend.CssClass = "removeElement"; rowDescription.CssClass = "removeElement"; rowComposition.CssClass = "removeElement"; rowStandard.CssClass = "removeElement"; rowPackQuantity.CssClass = "removeElement"; rowVinylRollLength.CssClass = "removeElement"; VinylRoll aVinylRoll = new VinylRoll(); //call select all function to populate object aVinylRoll.Populate(aVinylRoll.SelectAll(datDisplayDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); txtPartName.Text = aVinylRoll.VinylRollName; txtPartNum.Text = aVinylRoll.PartNumber; txtColor.Text = aVinylRoll.VinylRollColor; txtVinylRollWeight.Text = aVinylRoll.VinylRollWeight.ToString() + " " + aVinylRoll.VinylRollWeightUnits; txtVinylRollWidth.Text = aVinylRoll.VinylRollWidth.ToString() + " " + aVinylRoll.VinylRollWidthUnits; txtUsdPrice.Text = aVinylRoll.UsdPrice.ToString("N2"); txtCadPrice.Text = aVinylRoll.CadPrice.ToString("N2"); break; } #endregion #region WallExtrusions case "tblWallExtrusions": { pnlWallExtrusions.CssClass = "dimensionsTableDisplay"; rowLegend.CssClass = "removeElement"; rowComposition.CssClass = "removeElement"; rowStandard.CssClass = "removeElement"; rowPackQuantity.CssClass = "removeElement"; WallExtrusions aWallExtrusion = new WallExtrusions(); //call select all function to populate object aWallExtrusion.Populate(aWallExtrusion.SelectAll(datDisplayDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); txtPartName.Text = aWallExtrusion.WallExtrusionName; txtPartDesc.Text = aWallExtrusion.WallExtrusionDescription; txtPartNum.Text = aWallExtrusion.PartNumber; txtColor.Text = aWallExtrusion.WallExtrusionColor; txtWallExtMaxLength.Text = aWallExtrusion.WallExtrusionMaxLength.ToString() + " " + aWallExtrusion.LengthUnits; txtUsdPrice.Text = aWallExtrusion.UsdPrice.ToString("N2"); txtCadPrice.Text = aWallExtrusion.CadPrice.ToString("N2"); break; } #endregion #region WallPanels case "tblWallPanels": { pnlWallPanel.CssClass = "dimensionsTableDisplay"; rowLegend.CssClass = "removeElement"; rowPackQuantity.CssClass = "removeElement"; WallPanels aWallPanel = new WallPanels(); //call select all function to populate object aWallPanel.Populate(aWallPanel.SelectAll(datDisplayDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); txtPartName.Text = aWallPanel.WallPanelName; txtPartDesc.Text = aWallPanel.WallPanelDescription; txtComposition.Text = aWallPanel.WallPanelComposition; txtStandard.Text = aWallPanel.WallPanelStandard; txtPartNum.Text = aWallPanel.WallPanelNumber; txtColor.Text = aWallPanel.WallPanelColor; txtWallPnlSize.Text = aWallPanel.WallPanelSize.ToString() + " " + aWallPanel.SizeUnits; txtWallPnlMaxWidth.Text = aWallPanel.WallPanelMaxWidth.ToString() + " " + aWallPanel.WidthUnits; txtWallPnlMaxLength.Text = aWallPanel.WallPanelMaxLength.ToString() + " " + aWallPanel.LengthUnits; txtUsdPrice.Text = aWallPanel.UsdPrice.ToString("N2"); txtCadPrice.Text = aWallPanel.CadPrice.ToString("N2"); break; } #endregion #region RoofExtrusions case "tblRoofExtrusions": { rowLegend.CssClass = "removeElement"; rowComposition.CssClass = "removeElement"; rowStandard.CssClass = "removeElement"; rowPackQuantity.CssClass = "removeElement"; pnlRoofExtrusions.CssClass = "dimensionsTableDisplay"; RoofExtrusion aRoofExtrusion = new RoofExtrusion(); //call select all function to populate object aRoofExtrusion.Populate(aRoofExtrusion.SelectAll(datDisplayDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); txtPartNum.Text = aRoofExtrusion.ExtrusionNumber; txtPartName.Text = aRoofExtrusion.ExtrusionName; txtPartDesc.Text = aRoofExtrusion.ExtrusionDescription; txtColor.Text = aRoofExtrusion.ExtrusionColor; txtRoofExtSize.Text = aRoofExtrusion.ExtrusionSize.ToString() + " " + aRoofExtrusion.SizeUnits; if (aRoofExtrusion.AngleA != 0) { txtRoofExtAngleA.Text = aRoofExtrusion.AngleA.ToString() + " " + aRoofExtrusion.AngleAUnits; } else { rowRoofExtAngleA.CssClass = "removeElement"; } if (aRoofExtrusion.AngleB != 0) { txtRoofExtAngleB.Text = aRoofExtrusion.AngleB.ToString() + " " + aRoofExtrusion.AngleBUnits; } else { rowRoofExtAngleB.CssClass = "removeElement"; } if (aRoofExtrusion.AngleC != 0) { txtRoofExtAngleC.Text = aRoofExtrusion.AngleC.ToString() + " " + aRoofExtrusion.AngleCUnits; } else { rowRoofExtAngleC.CssClass = "removeElement"; } txtRoofExtMaxLength.Text = aRoofExtrusion.ExtrusionMaxLength.ToString() + " " + aRoofExtrusion.MaxLengthUnits; txtUsdPrice.Text = aRoofExtrusion.UsdPrice.ToString("N2"); txtCadPrice.Text = aRoofExtrusion.CadPrice.ToString("N2"); break; } #endregion } } } /* if (Session["picChanged"] != null) { imgPart.ImageUrl = "Images/catalogue/temp.jpg"; Session.Remove("picChanged"); } */ }
protected void Page_Load(object sender, EventArgs e) { Label firstLabel = (Label)Master.FindControl("lblUpdate"); if (firstLabel != null) { firstLabel.Text = "VIEWING"; } Label secondLabel = (Label)Master.FindControl("lblPartNumTitle"); if (secondLabel != null) { secondLabel.Text = Session["partNumber"].ToString(); } if (Session["updateSelected"] != null) { btnInsert.CssClass = "removeElement"; } if (Session["user_type"].ToString() != "S") { btnUpdate.Visible = false; btnInsert.Visible = false; } //prevent backdoor if (Session["tableName"] == null) { Response.Redirect("ProductSelect.aspx"); } else { //load dropdowns if (!Page.IsPostBack) { Session.Add("UpdatePartList", "true"); //set up a dataview object to hold table names for the first drop down System.Data.DataView tableList = new System.Data.DataView(); //select table names datSelectDataSource.SelectCommand = "SELECT name FROM sys.tables WHERE name != 'tblColor' AND name != 'tblSchematicParts' AND name != 'tblParts' " + " AND name != 'tblLengthUnits' AND name != 'tblAudits' AND name != 'tblSalesOrders' AND name != 'tblSalesOrderItems' " + " AND SUBSTRING(name,1,3) = 'tbl' " + "ORDER BY name ASC"; //assign the table names to the dataview object tableList = (System.Data.DataView)datSelectDataSource.Select(System.Web.UI.DataSourceSelectArguments.Empty); //variable to determine amount of rows in the dataview object int rowCount = tableList.Count; ddlCategory.Items.Add(""); //populate first drop down for (int i = 0; i < rowCount; i++) { string textString = tableList[i][0].ToString(); string newString = textString.Substring(3); string outputString = ""; foreach (char character in newString) { if (char.IsUpper(character)) { outputString += " " + character; } else if (character.ToString() == "1" || character.ToString() == "3" || character.ToString() == "4") { outputString += " " + character; } else { outputString += character; } } ddlCategory.Items.Add(outputString.Trim()); } //select category dropdown default value ddlCategory.SelectedIndex = (int)Session["categoryIndex"]; //load part list if (ddlCategory.SelectedValue != "") { //get table name selected string tableName = "tbl" + ddlCategory.SelectedValue.Replace(" ", ""); //set up a dataview object to hold part numbers for the second drop down System.Data.DataView partsList = new System.Data.DataView(); if (tableName != "tblSchematics") { //select part numbers datSelectDataSource.SelectCommand = "SELECT partNumber, partName FROM " + tableName + " ORDER BY partNumber ASC"; } else { datSelectDataSource.SelectCommand = "SELECT schematicNumber, partName FROM " + tableName + " ORDER BY schematicNumber ASC"; } //assign the table names to the dataview object partsList = (System.Data.DataView)datSelectDataSource.Select(System.Web.UI.DataSourceSelectArguments.Empty); //clear second drop down ddlPart.Items.Clear(); //Insert empty string to first row of second drop down ddlPart.Items.Add(""); rowCount = partsList.Count; //populate second drop down for (int i = 0; i < rowCount; i++) { ddlPart.Items.Add(partsList[i][0].ToString() + " (" + partsList[i][1].ToString() + ")"); } Session.Add("displayChanged", "true"); } } //only run if the display has changed, to allow display postback changes if (Session["displayChanged"] != null) { //we're running this, so the display has been updated, and is not set for change Session.Remove("displayChanged"); //select part dropdown default value ddlPart.SelectedIndex = (int)Session["partIndex"]; //show navigation arrows imgPrevArrow.CssClass = "prevArrow"; imgNextArrow.CssClass = "nextArrow"; if (ddlPart.SelectedIndex == (ddlPart.Items.Count - 1)) { //if last item, don't show 'next' arrow imgNextArrow.CssClass = "removeElement"; } else if (ddlPart.SelectedIndex == 1) { //if first item, don't show 'prev' arrow imgPrevArrow.CssClass = "removeElement"; } //load appropriate image imgPart.ImageUrl = "Images/catalogue/" + Session["partNumber"].ToString() + ".jpg"; imgPartLink.NavigateUrl = "Images/catalogue/" + Session["partNumber"].ToString() + ".jpg"; //remove all non-product panels, whichw ill be shown on switch case below pnlAccessories.CssClass = "removeElement"; pnlDecorativeColumn.CssClass = "removeElement"; pnlDoorFrameExtrusions.CssClass = "removeElement"; pnlInsulatedFloors.CssClass = "removeElement"; pnlRoofExtrusions.CssClass = "removeElement"; pnlRoofPanels.CssClass = "removeElement"; pnlScreenRoll.CssClass = "removeElement"; pnlSuncrylicRoof.CssClass = "removeElement"; pnlSunrail1000.CssClass = "removeElement"; pnlSunrail300.CssClass = "removeElement"; pnlSunrail400.CssClass = "removeElement"; pnlVinylRoll.CssClass = "removeElement"; pnlWallExtrusions.CssClass = "removeElement"; pnlWallPanel.CssClass = "removeElement"; pnlSchematicsDisplay.CssClass = "removeElement"; //Uncomment for checks with login /* * if (Session["loggedCountry"] == null) * { * pnlPriceDisplay.CssClass = "removeElement"; * } * else if (Session["loggedCountry"] == "US") * { * rowCadPrice.CssClass = "removeElement"; * } * else * { * rowUsdPrice.CssClass = "removeElement"; * } */ //if value was changed on display page, we string tableName = Session["tableName"].ToString(); switch (tableName) { #region Accessories case "tblAccessories": { pnlAccessories.CssClass = "dimensionsTableDisplay"; rowLegend.CssClass = "removeElement"; rowComposition.CssClass = "removeElement"; rowStandard.CssClass = "removeElement"; lblPartName.Text = "Part Name:"; lblPartNum.Text = "Part Number:"; Accessories anAccessory = new Accessories(); //call select all function to populate object anAccessory.Populate(anAccessory.SelectAll(datDisplayDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); txtPartNum.Text = anAccessory.AccessoryNumber; txtPartName.Text = anAccessory.AccessoryName; txtPartDesc.Text = anAccessory.AccessoryDescription; txtColor.Text = anAccessory.AccessoryColor; txtPackQuantity.Text = anAccessory.AccessoryPackQuantity.ToString(); txtAccessorySize.Text = anAccessory.AccessorySize.ToString() + " " + anAccessory.AccessorySizeUnits; txtAccessoryWidth.Text = anAccessory.AccessoryWidth.ToString() + " " + anAccessory.AccessoryWidthUnits; txtAccessoryLength.Text = anAccessory.AccessoryLength.ToString() + " " + anAccessory.AccessoryLengthUnits; if (txtPackQuantity.Text == "0" || txtPackQuantity.Text == "") { rowPackQuantity.CssClass = "removeElement"; } if (anAccessory.AccessorySize == 0) //a space is added above, so check for one space, not blank { rowAccessorySize.CssClass = "removeElement"; } if (anAccessory.AccessoryLength == 0) { rowAccessoryMaxLength.CssClass = "removeElement"; } if (anAccessory.AccessoryWidth == 0) { rowAccessoryMaxWidth.CssClass = "removeElement"; } if (txtColor.Text == "") { rowColor.CssClass = "removeElement"; } txtUsdPrice.Text = anAccessory.AccessoryUsdPrice.ToString("N2"); txtCadPrice.Text = anAccessory.AccessoryCadPrice.ToString("N2"); break; } #endregion #region DecorativeColumn case "tblDecorativeColumn": { pnlDecorativeColumn.CssClass = "dimensionsTableDisplay"; rowLegend.CssClass = "removeElement"; rowComposition.CssClass = "removeElement"; rowStandard.CssClass = "removeElement"; rowPackQuantity.CssClass = "removeElement"; DecorativeColumn aColumn = new DecorativeColumn(); //call select all function to populate object aColumn.Populate(aColumn.SelectAll(datDisplayDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); txtPartName.Text = aColumn.ColumnName; txtPartDesc.Text = aColumn.ColumnDescription; txtPartNum.Text = aColumn.PartNumber; txtColor.Text = aColumn.ColumnColor; txtDecColLength.Text = aColumn.ColumnLength.ToString() + " " + aColumn.ColumnLengthUnits; txtUsdPrice.Text = aColumn.ColumnUsdPrice.ToString("N2"); txtCadPrice.Text = aColumn.ColumnCadPrice.ToString("N2"); break; } #endregion #region Door Frame Extrusion case "tblDoorFrameExtrusion": { pnlDoorFrameExtrusions.CssClass = "dimensionsTableDisplay"; rowLegend.CssClass = "removeElement"; rowComposition.CssClass = "removeElement"; rowStandard.CssClass = "removeElement"; rowPackQuantity.CssClass = "removeElement"; DoorFrameExtrusion aFrameExtrusion = new DoorFrameExtrusion(); //call select all function to populate object aFrameExtrusion.Populate(aFrameExtrusion.SelectAll(datDisplayDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); txtPartName.Text = aFrameExtrusion.DfeName; if (aFrameExtrusion.DfeDescription != "") { txtPartDesc.Text = aFrameExtrusion.DfeDescription; } else { rowDescription.CssClass = "removeElement"; } txtPartNum.Text = aFrameExtrusion.PartNumber; txtColor.Text = aFrameExtrusion.DfeColor; txtDoorFrExtMaxLength.Text = aFrameExtrusion.DfeMaxLength.ToString() + " " + aFrameExtrusion.DfeMaxLengthUnits; txtUsdPrice.Text = aFrameExtrusion.UsdPrice.ToString("N2"); txtCadPrice.Text = aFrameExtrusion.CadPrice.ToString("N2"); break; } #endregion #region InsulatedFloors case "tblInsulatedFloors": { pnlInsulatedFloors.CssClass = "dimensionsTableDisplay"; rowLegend.CssClass = "removeElement"; rowStandard.CssClass = "removeElement"; rowPackQuantity.CssClass = "removeElement"; rowColor.CssClass = "removeElement"; InsulatedFloors aFloor = new InsulatedFloors(); //call select all function to populate object aFloor.Populate(aFloor.SelectAll(datDisplayDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); txtPartName.Text = aFloor.InsulatedFloorName; txtPartDesc.Text = aFloor.InsulatedFloorDescription; txtPartNum.Text = aFloor.PartNumber; txtInsFloorSize.Text = aFloor.InsulatedFloorSize.ToString() + " " + aFloor.InsulatedFloorSizeUnits; txtInsFloorMaxWidth.Text = aFloor.InsulatedFloorMaxWidth.ToString() + " " + aFloor.InsulatedFloorMaxWidthUnits; txtInsFloorMaxLength.Text = aFloor.InsulatedFloorMaxLength.ToString(); txtUsdPrice.Text = aFloor.InsulatedFloorUsdPrice.ToString("N2"); txtCadPrice.Text = aFloor.InsulatedFloorCadPrice.ToString("N2"); break; } #endregion #region RoofPanels case "tblRoofPanels": { pnlRoofPanels.CssClass = "dimensionsTableDisplay"; rowLegend.CssClass = "removeElement"; rowPackQuantity.CssClass = "removeElement"; RoofPanels aRoofPanel = new RoofPanels(); //call select all function to populate object aRoofPanel.Populate(aRoofPanel.SelectAll(datDisplayDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); txtPartName.Text = aRoofPanel.PanelName; txtPartDesc.Text = aRoofPanel.PanelDescription; txtPartNum.Text = aRoofPanel.PartNumber; txtComposition.Text = aRoofPanel.PanelComposition; txtStandard.Text = aRoofPanel.PanelStandard; txtColor.Text = aRoofPanel.PanelColor; txtRoofPnlSize.Text = aRoofPanel.PanelSize.ToString() + " " + aRoofPanel.PanelSizeUnits; txtRoofPnlMaxWidth.Text = aRoofPanel.PanelMaxWidth.ToString() + " " + aRoofPanel.MaxWidthUnits; txtRoofPnlMaxLength.Text = aRoofPanel.PanelMaxLength; txtUsdPrice.Text = aRoofPanel.UsdPrice.ToString("N2"); txtCadPrice.Text = aRoofPanel.CadPrice.ToString("N2"); break; } #endregion #region Schematics case "tblSchematics": { pnlSchematicsDisplay.CssClass = "schematicsTableDisplay"; rowComposition.CssClass = "removeElement"; rowStandard.CssClass = "removeElement"; rowPackQuantity.CssClass = "removeElement"; rowColor.CssClass = "removeElement"; lblLegend.Text = "Legend:"; Schematics aSchematic = new Schematics(); Part aPart = new Part(); //call select all function to populate object aSchematic.Populate(aSchematic.SelectAll(datDisplayDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); txtPartNum.Text = aSchematic.SchematicNumber; if (Session["UpdatePartList"].ToString() == "true" || !Page.IsPostBack) { UpdatePartsList(); Session.Remove("UpdatePartList"); } if (Session["part"] != null) { aPart = (Part)Session["part"]; txtSchemPartKey.Text = aPart.PartKeyNumber.ToString(); txtSchemPartName.Text = aPart.PartName; txtSchemPartNum.Text = aPart.PartNumber; } else { txtSchemPartKey.Text = ""; txtSchemPartName.Text = ""; txtSchemPartNum.Text = ""; } lblPartName.Text = "Schematic Name:"; txtPartName.Text = aSchematic.SchematicName.ToString(); txtPartDesc.Text = aSchematic.SchematicDescription.ToString(); lblPartNum.Text = "Schematic Number:"; txtPartNum.Text = aSchematic.SchematicNumber.ToString(); if (txtPartDesc.Text == "") { txtPartDesc.Text = "No Description"; } txtUsdPrice.Text = aSchematic.SchematicUsdPrice.ToString("N2"); txtCadPrice.Text = aSchematic.SchematicCadPrice.ToString("N2"); break; } #endregion #region Screen Roll case "tblScreenRoll": { pnlScreenRoll.CssClass = "dimensionsTableDisplay"; rowLegend.CssClass = "removeElement"; rowDescription.CssClass = "removeElement"; rowComposition.CssClass = "removeElement"; rowStandard.CssClass = "removeElement"; rowPackQuantity.CssClass = "removeElement"; rowColor.CssClass = "removeElement"; ScreenRoll aScreenRoll = new ScreenRoll(); //call select all function to populate object aScreenRoll.Populate(aScreenRoll.SelectAll(datDisplayDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); txtPartName.Text = aScreenRoll.ScreenRollName; txtPartNum.Text = aScreenRoll.PartNumber; txtScreenRollWidth.Text = aScreenRoll.ScreenRollWidth + " " + aScreenRoll.ScreenRollWidthUnits; txtScreenRollLength.Text = aScreenRoll.ScreenRollLength + " " + aScreenRoll.ScreenRollLengthUnits; txtUsdPrice.Text = aScreenRoll.UsdPrice.ToString("N2"); txtCadPrice.Text = aScreenRoll.CadPrice.ToString("N2"); break; } #endregion #region Suncrylic Roof case "tblSuncrylicRoof": { pnlSuncrylicRoof.CssClass = "dimensionsTableDisplay"; rowLegend.CssClass = "removeElement"; rowComposition.CssClass = "removeElement"; rowStandard.CssClass = "removeElement"; rowPackQuantity.CssClass = "removeElement"; SuncrylicRoof aSuncrylicRoof = new SuncrylicRoof(); //call select all function to populate object aSuncrylicRoof.Populate(aSuncrylicRoof.SelectAll(datDisplayDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); txtPartName.Text = aSuncrylicRoof.SuncrylicName; txtPartDesc.Text = aSuncrylicRoof.SuncrylicDescription; txtPartNum.Text = aSuncrylicRoof.PartNumber; txtColor.Text = aSuncrylicRoof.SuncrylicColor; txtSunRoofMaxLength.Text = aSuncrylicRoof.SuncrylicMaxLength + " " + aSuncrylicRoof.SuncrylicLengthUnits; txtSunRoofMaxWidthStr.Text = "Varies"; txtUsdPrice.Text = aSuncrylicRoof.UsdPrice.ToString("N2"); txtCadPrice.Text = aSuncrylicRoof.CadPrice.ToString("N2"); break; } #endregion #region Sunrail1000 case "tblSunrail1000": { pnlSunrail1000.CssClass = "dimensionsTableDisplay"; rowLegend.CssClass = "removeElement"; rowComposition.CssClass = "removeElement"; rowStandard.CssClass = "removeElement"; rowPackQuantity.CssClass = "removeElement"; Sunrail1000 aSunrail = new Sunrail1000(); //call select all function to populate object aSunrail.Populate(aSunrail.SelectAll(datDisplayDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); txtPartName.Text = aSunrail.Sunrail1000Name; txtPartDesc.Text = aSunrail.Sunrail1000Description; txtPartNum.Text = aSunrail.PartNumber; txtColor.Text = aSunrail.Sunrail1000Color; txtSun1000MaxLength.Text = aSunrail.Sunrail1000MaxLengthFeet.ToString() + " " + aSunrail.Sunrail1000MaxLengthFeetUnits + " " + aSunrail.Sunrail1000MaxLengthInches.ToString() + " " + aSunrail.Sunrail1000MaxLengthInchesUnits; txtUsdPrice.Text = aSunrail.Sunrail1000UsdPrice.ToString("N2"); txtCadPrice.Text = aSunrail.Sunrail1000CadPrice.ToString("N2"); break; } #endregion #region Sunrail300 case "tblSunrail300": { pnlSunrail300.CssClass = "dimensionsTableDisplay"; rowLegend.CssClass = "removeElement"; rowComposition.CssClass = "removeElement"; rowStandard.CssClass = "removeElement"; rowPackQuantity.CssClass = "removeElement"; Sunrail300 aSunrail300 = new Sunrail300(); //call select all function to populate object aSunrail300.Populate(aSunrail300.SelectAll(datDisplayDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); txtPartName.Text = aSunrail300.Sunrail300Name; txtPartDesc.Text = aSunrail300.Sunrail300Description; txtPartNum.Text = aSunrail300.PartNumber; txtColor.Text = aSunrail300.Sunrail300Color; txtSun300MaxLength.Text = aSunrail300.Sunrail300MaxLengthFeet.ToString() + " " + aSunrail300.Sunrail300MaxLengthFeetUnits + " " + aSunrail300.Sunrail300MaxLengthInches.ToString() + " " + aSunrail300.Sunrail300MaxLengthInchesUnits; txtUsdPrice.Text = aSunrail300.Sunrail300UsdPrice.ToString("N2"); txtCadPrice.Text = aSunrail300.Sunrail300CadPrice.ToString("N2"); break; } #endregion #region Sunrail300Accessories case "tblSunrail300Accessories": { rowLegend.CssClass = "removeElement"; rowComposition.CssClass = "removeElement"; rowStandard.CssClass = "removeElement"; rowPackQuantity.CssClass = "removeElement"; Sunrail300Accessories aSunrail300Accessory = new Sunrail300Accessories(); //call select all function to populate object aSunrail300Accessory.Populate(aSunrail300Accessory.SelectAll(datDisplayDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); txtPartName.Text = aSunrail300Accessory.Sunrail300AccessoriesName; txtPartDesc.Text = aSunrail300Accessory.Sunrail300AccessoriesDescription; txtPartNum.Text = aSunrail300Accessory.PartNumber; txtColor.Text = aSunrail300Accessory.Sunrail300AccessoriesColor; txtUsdPrice.Text = aSunrail300Accessory.Sunrail300AccessoriesUsdPrice.ToString("N2"); txtCadPrice.Text = aSunrail300Accessory.Sunrail300AccessoriesCadPrice.ToString("N2"); break; } #endregion #region Sunrail400 case "tblSunrail400": { pnlSunrail400.CssClass = "dimensionsTableDisplay"; rowLegend.CssClass = "removeElement"; rowComposition.CssClass = "removeElement"; rowStandard.CssClass = "removeElement"; rowPackQuantity.CssClass = "removeElement"; Sunrail400 aSunrail400 = new Sunrail400(); //call select all function to populate object aSunrail400.Populate(aSunrail400.SelectAll(datDisplayDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); txtPartName.Text = aSunrail400.Sunrail400Name; txtPartDesc.Text = aSunrail400.Sunrail400Description; txtPartNum.Text = aSunrail400.PartNumber; txtColor.Text = aSunrail400.Sunrail400Color; txtSun400MaxLength.Text = aSunrail400.Sunrail400MaxLengthFeet.ToString() + " " + aSunrail400.Sunrail400MaxLengthFeetUnits + " " + aSunrail400.Sunrail400MaxLengthInches.ToString() + " " + aSunrail400.Sunrail400MaxLengthInchesUnits; txtUsdPrice.Text = aSunrail400.Sunrail400UsdPrice.ToString("N2"); txtCadPrice.Text = aSunrail400.Sunrail400CadPrice.ToString("N2"); break; } #endregion #region VinylRoll case "tblVinylRoll": { pnlVinylRoll.CssClass = "dimensionsTableDisplay"; rowLegend.CssClass = "removeElement"; rowDescription.CssClass = "removeElement"; rowComposition.CssClass = "removeElement"; rowStandard.CssClass = "removeElement"; rowPackQuantity.CssClass = "removeElement"; rowVinylRollLength.CssClass = "removeElement"; VinylRoll aVinylRoll = new VinylRoll(); //call select all function to populate object aVinylRoll.Populate(aVinylRoll.SelectAll(datDisplayDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); txtPartName.Text = aVinylRoll.VinylRollName; txtPartNum.Text = aVinylRoll.PartNumber; txtColor.Text = aVinylRoll.VinylRollColor; txtVinylRollWeight.Text = aVinylRoll.VinylRollWeight.ToString() + " " + aVinylRoll.VinylRollWeightUnits; txtVinylRollWidth.Text = aVinylRoll.VinylRollWidth.ToString() + " " + aVinylRoll.VinylRollWidthUnits; txtUsdPrice.Text = aVinylRoll.UsdPrice.ToString("N2"); txtCadPrice.Text = aVinylRoll.CadPrice.ToString("N2"); break; } #endregion #region WallExtrusions case "tblWallExtrusions": { pnlWallExtrusions.CssClass = "dimensionsTableDisplay"; rowLegend.CssClass = "removeElement"; rowComposition.CssClass = "removeElement"; rowStandard.CssClass = "removeElement"; rowPackQuantity.CssClass = "removeElement"; WallExtrusions aWallExtrusion = new WallExtrusions(); //call select all function to populate object aWallExtrusion.Populate(aWallExtrusion.SelectAll(datDisplayDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); txtPartName.Text = aWallExtrusion.WallExtrusionName; txtPartDesc.Text = aWallExtrusion.WallExtrusionDescription; txtPartNum.Text = aWallExtrusion.PartNumber; txtColor.Text = aWallExtrusion.WallExtrusionColor; txtWallExtMaxLength.Text = aWallExtrusion.WallExtrusionMaxLength.ToString() + " " + aWallExtrusion.LengthUnits; txtUsdPrice.Text = aWallExtrusion.UsdPrice.ToString("N2"); txtCadPrice.Text = aWallExtrusion.CadPrice.ToString("N2"); break; } #endregion #region WallPanels case "tblWallPanels": { pnlWallPanel.CssClass = "dimensionsTableDisplay"; rowLegend.CssClass = "removeElement"; rowPackQuantity.CssClass = "removeElement"; WallPanels aWallPanel = new WallPanels(); //call select all function to populate object aWallPanel.Populate(aWallPanel.SelectAll(datDisplayDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); txtPartName.Text = aWallPanel.WallPanelName; txtPartDesc.Text = aWallPanel.WallPanelDescription; txtComposition.Text = aWallPanel.WallPanelComposition; txtStandard.Text = aWallPanel.WallPanelStandard; txtPartNum.Text = aWallPanel.WallPanelNumber; txtColor.Text = aWallPanel.WallPanelColor; txtWallPnlSize.Text = aWallPanel.WallPanelSize.ToString() + " " + aWallPanel.SizeUnits; txtWallPnlMaxWidth.Text = aWallPanel.WallPanelMaxWidth.ToString() + " " + aWallPanel.WidthUnits; txtWallPnlMaxLength.Text = aWallPanel.WallPanelMaxLength.ToString() + " " + aWallPanel.LengthUnits; txtUsdPrice.Text = aWallPanel.UsdPrice.ToString("N2"); txtCadPrice.Text = aWallPanel.CadPrice.ToString("N2"); break; } #endregion #region RoofExtrusions case "tblRoofExtrusions": { rowLegend.CssClass = "removeElement"; rowComposition.CssClass = "removeElement"; rowStandard.CssClass = "removeElement"; rowPackQuantity.CssClass = "removeElement"; pnlRoofExtrusions.CssClass = "dimensionsTableDisplay"; RoofExtrusion aRoofExtrusion = new RoofExtrusion(); //call select all function to populate object aRoofExtrusion.Populate(aRoofExtrusion.SelectAll(datDisplayDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); txtPartNum.Text = aRoofExtrusion.ExtrusionNumber; txtPartName.Text = aRoofExtrusion.ExtrusionName; txtPartDesc.Text = aRoofExtrusion.ExtrusionDescription; txtColor.Text = aRoofExtrusion.ExtrusionColor; txtRoofExtSize.Text = aRoofExtrusion.ExtrusionSize.ToString() + " " + aRoofExtrusion.SizeUnits; if (aRoofExtrusion.AngleA != 0) { txtRoofExtAngleA.Text = aRoofExtrusion.AngleA.ToString() + " " + aRoofExtrusion.AngleAUnits; } else { rowRoofExtAngleA.CssClass = "removeElement"; } if (aRoofExtrusion.AngleB != 0) { txtRoofExtAngleB.Text = aRoofExtrusion.AngleB.ToString() + " " + aRoofExtrusion.AngleBUnits; } else { rowRoofExtAngleB.CssClass = "removeElement"; } if (aRoofExtrusion.AngleC != 0) { txtRoofExtAngleC.Text = aRoofExtrusion.AngleC.ToString() + " " + aRoofExtrusion.AngleCUnits; } else { rowRoofExtAngleC.CssClass = "removeElement"; } txtRoofExtMaxLength.Text = aRoofExtrusion.ExtrusionMaxLength.ToString() + " " + aRoofExtrusion.MaxLengthUnits; txtUsdPrice.Text = aRoofExtrusion.UsdPrice.ToString("N2"); txtCadPrice.Text = aRoofExtrusion.CadPrice.ToString("N2"); break; } #endregion } } } /* * if (Session["picChanged"] != null) * { * imgPart.ImageUrl = "Images/catalogue/temp.jpg"; * Session.Remove("picChanged"); * } */ }
protected void Page_Load(object sender, EventArgs e) { Label firstLabel = (Label)Master.FindControl("lblUpdate"); if (firstLabel != null) { firstLabel.Text = "UPDATE"; } Label secondLabel = (Label)Master.FindControl("lblPartNumTitle"); if (secondLabel != null) { secondLabel.Text = Session["partNumber"].ToString(); } if (!Page.IsPostBack) { //prevent backdoor if (Session["tableName"] == null) { Response.Redirect("ProductSelect.aspx"); } else { //load dropdowns if (!Page.IsPostBack) { //set up a dataview object to hold table names for the first drop down System.Data.DataView tableList = new System.Data.DataView(); //select table names datSelectDataSource.SelectCommand = "SELECT name FROM sys.tables WHERE name != 'tblColor' AND name != 'tblSchematicParts' AND name != 'tblParts' " + " AND name != 'tblLengthUnits' AND name != 'tblAudits' AND name != 'tblSalesOrders' AND name != 'tblSalesOrderItems' " + " AND SUBSTRING(name,1,3) = 'tbl' " + "ORDER BY name ASC"; tableList = (System.Data.DataView)datSelectDataSource.Select(System.Web.UI.DataSourceSelectArguments.Empty); //variable to determine amount of rows in the dataview object int rowCount = tableList.Count; ddlCategory.Items.Add(""); //populate first drop down for (int i = 0; i < rowCount; i++) { string textString = tableList[i][0].ToString(); string newString = textString.Substring(3); string outputString = ""; foreach (char character in newString) { if (char.IsUpper(character)) { outputString += " " + character; } else if (character.ToString() == "1" || character.ToString() == "3" || character.ToString() == "4") { outputString += " " + character; } else { outputString += character; } } ddlCategory.Items.Add(outputString.Trim()); } //select category dropdown default value ddlCategory.SelectedIndex = (int)Session["categoryIndex"]; //load part list if (ddlCategory.SelectedValue != "") { //get table name selected string tableName = "tbl" + ddlCategory.SelectedValue.Replace(" ", ""); //set up a dataview object to hold part numbers for the second drop down System.Data.DataView partsList = new System.Data.DataView(); if (tableName != "tblSchematics") { //select part numbers datSelectDataSource.SelectCommand = "SELECT partNumber, partName FROM " + tableName + " ORDER BY partNumber ASC"; } else { datSelectDataSource.SelectCommand = "SELECT schematicNumber, partName FROM " + tableName + " ORDER BY schematicNumber ASC"; } //assign the table names to the dataview object partsList = (System.Data.DataView)datSelectDataSource.Select(System.Web.UI.DataSourceSelectArguments.Empty); //clear second drop down ddlPart.Items.Clear(); //Insert empty string to first row of second drop down ddlPart.Items.Add(""); rowCount = partsList.Count; //populate second drop down for (int i = 0; i < rowCount; i++) { ddlPart.Items.Add(partsList[i][0].ToString() + " (" + partsList[i][1].ToString() + ")"); } Session.Add("updateChanged", "true"); } } //only run if the display has changed, to allow display postback changes if (Session["updateChanged"] != null) { //we're running this, so the display has been updated, and is not set for change Session.Remove("updateChanged"); //select part dropdown default value ddlPart.SelectedIndex = (int)Session["partIndex"]; //show navigation arrows imgPrevArrow.CssClass = "prevArrow"; imgNextArrow.CssClass = "nextArrow"; if (ddlPart.SelectedIndex == (ddlPart.Items.Count - 1)) { //if last item, don't show 'next' arrow imgNextArrow.CssClass = "removeElement"; } else if (ddlPart.SelectedIndex == 1) { //if first item, don't show 'prev' arrow imgPrevArrow.CssClass = "removeElement"; } //Clear updated object in session if (Session["updatedObject"] != null) { Session.Remove("updatedObject"); } //get table selected from session string tableName = Session["tableName"].ToString(); #region Display Pricing Only if (Session["pricingOnly"] != null) { lblPartKey.CssClass = "removeElement"; pnlPackQuantity.CssClass = "removeElement"; pnlComposition.CssClass = "removeElement"; pnlStandard.CssClass = "removeElement"; pnlDimensions.CssClass = "removeElement"; pnlStatus.CssClass = "removeElement"; btnUploadImg.CssClass = "removeElement"; txtPartDesc.CssClass = "txtInputFieldDisabled"; pnlSchematics.CssClass = "removeElement"; pnlPricingSchematics.CssClass = "removeElement"; //Switch statement for displaying according to selected product switch (tableName) { #region RoofExtrusion //When Roof Extrusions is selected case "tblRoofExtrusions": { //create RoofExtrusion object RoofExtrusion aRoofExtrusion = new RoofExtrusion(); //call select all function to populate object aRoofExtrusion.Populate(aRoofExtrusion.SelectAll(datUpdateDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); //populate fields imgPart.ImageUrl = "Images/catalogue/" + Session["partNumber"].ToString() + ".jpg"; lblPartName.Text = aRoofExtrusion.ExtrusionName; txtPartDesc.Text = aRoofExtrusion.ExtrusionDescription; lblPartNum.Text = aRoofExtrusion.ExtrusionNumber; lblColorInput.Text = aRoofExtrusion.ExtrusionColor; txtUsdPrice.Text = aRoofExtrusion.UsdPrice.ToString("N2"); txtCadPrice.Text = aRoofExtrusion.CadPrice.ToString("N2"); break; } #endregion #region Accessories //When Accessories is selected case "tblAccessories": { //create Accessories object Accessories anAccessory = new Accessories(); //call select all function to populate object anAccessory.Populate(anAccessory.SelectAll(datUpdateDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); //add Accessories Object to the session Session.Add("accessories", anAccessory); //populate fields lblPartName.Text = anAccessory.AccessoryName; txtPartDesc.Text = anAccessory.AccessoryDescription; lblPartNum.Text = anAccessory.AccessoryNumber; txtUsdPrice.Text = anAccessory.AccessoryUsdPrice.ToString("N2"); txtCadPrice.Text = anAccessory.AccessoryCadPrice.ToString("N2"); imgPart.ImageUrl = "Images/catalogue/" + Session["partNumber"].ToString() + ".jpg"; if (anAccessory.AccessoryColor != "") { lblColorInput.Text = anAccessory.AccessoryColor; } else { lblColorInput.CssClass = "removeElement"; lblColor.CssClass = "removeElement"; } break; } #endregion #region DecorativeColumn //When Decorative Column is selected case "tblDecorativeColumn": { //create DecorativeColumn object DecorativeColumn aColumn = new DecorativeColumn(); //call select all function to populate object aColumn.Populate(aColumn.SelectAll(datUpdateDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); //add DecorativeColumn Object to the session Session.Add("decorativeColumn", aColumn); //populate fields lblPartName.Text = aColumn.ColumnName; txtPartDesc.Text = aColumn.ColumnDescription; lblPartNum.Text = aColumn.PartNumber; lblColorInput.Text = aColumn.ColumnColor; txtUsdPrice.Text = aColumn.ColumnUsdPrice.ToString("N2"); txtCadPrice.Text = aColumn.ColumnCadPrice.ToString("N2"); imgPart.ImageUrl = "Images/catalogue/" + Session["partNumber"].ToString() + ".jpg"; break; } #endregion #region DoorFrameExtrusion //When Door Frame Extrusion is selected case "tblDoorFrameExtrusion": { //create DoorFrameExtrusion object DoorFrameExtrusion aFrameExtrusion = new DoorFrameExtrusion(); //call select all function to populate object aFrameExtrusion.Populate(aFrameExtrusion.SelectAll(datUpdateDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); //populate fields lblPartName.Text = aFrameExtrusion.DfeName; txtPartDesc.Text = aFrameExtrusion.DfeDescription; lblPartNum.Text = aFrameExtrusion.PartNumber; lblColorInput.Text = aFrameExtrusion.DfeColor; txtUsdPrice.Text = aFrameExtrusion.UsdPrice.ToString("N2"); txtCadPrice.Text = aFrameExtrusion.CadPrice.ToString("N2"); imgPart.ImageUrl = "Images/catalogue/" + Session["partNumber"].ToString() + ".jpg"; break; } #endregion #region InsulatedFloors //When Insulated Floors is selected case "tblInsulatedFloors": { lblColor.CssClass = "removeElement"; lblColorInput.CssClass = "removeElement"; //create InsulatedFloors object InsulatedFloors aFloor = new InsulatedFloors(); //call select all function to populate object aFloor.Populate(aFloor.SelectAll(datUpdateDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); //populate fields lblPartName.Text = aFloor.InsulatedFloorName; txtPartDesc.Text = aFloor.InsulatedFloorDescription; lblPartNum.Text = aFloor.PartNumber; txtUsdPrice.Text = aFloor.InsulatedFloorUsdPrice.ToString("N2"); txtCadPrice.Text = aFloor.InsulatedFloorCadPrice.ToString("N2"); imgPart.ImageUrl = "Images/catalogue/" + Session["partNumber"].ToString() + ".jpg"; break; } #endregion #region RoofPanels //When Roof Panels is selected case "tblRoofPanels": { //create RoofPanels object RoofPanels aPanel = new RoofPanels(); //call select all function to populate object aPanel.Populate(aPanel.SelectAll(datUpdateDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); //populate fields lblPartName.Text = aPanel.PanelName; txtPartDesc.Text = aPanel.PanelDescription; lblPartNum.Text = aPanel.PartNumber; lblColorInput.Text = aPanel.PanelColor; txtUsdPrice.Text = aPanel.UsdPrice.ToString("N2"); txtCadPrice.Text = aPanel.CadPrice.ToString("N2"); imgPart.ImageUrl = "Images/catalogue/" + Session["partNumber"].ToString() + ".jpg"; break; } #endregion #region ScreenRoll //When Screen Roll is selected case "tblScreenRoll": { lblColor.CssClass = "removeElement"; lblColorInput.CssClass = "removeElement"; //create ScreenRoll object ScreenRoll aScreenRoll = new ScreenRoll(); //call select all function to populate object aScreenRoll.Populate(aScreenRoll.SelectAll(datUpdateDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); //populate fields imgPart.ImageUrl = "Images/catalogue/" + Session["partNumber"].ToString() + ".jpg"; lblPartName.Text = aScreenRoll.ScreenRollName; lblPartNum.Text = aScreenRoll.PartNumber; txtUsdPrice.Text = aScreenRoll.UsdPrice.ToString("N2"); txtCadPrice.Text = aScreenRoll.CadPrice.ToString("N2"); break; } #endregion #region SuncrylicRoof //When Suncrylic roof is selected case "tblSuncrylicRoof": { //create ScreenRoll object SuncrylicRoof aSunRoof = new SuncrylicRoof(); //call select all function to populate object aSunRoof.Populate(aSunRoof.SelectAll(datUpdateDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); //populate fields imgPart.ImageUrl = "Images/catalogue/" + Session["partNumber"].ToString() + ".jpg"; lblPartName.Text = aSunRoof.SuncrylicName; lblPartNum.Text = aSunRoof.PartNumber; txtUsdPrice.Text = aSunRoof.UsdPrice.ToString("N2"); txtCadPrice.Text = aSunRoof.CadPrice.ToString("N2"); break; } #endregion #region VinylRoll //When Vinyl Roll is selected case "tblVinylRoll": { //create ScreenRoll object VinylRoll aVinylRoll = new VinylRoll(); //call select all function to populate object aVinylRoll.Populate(aVinylRoll.SelectAll(datUpdateDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); //populate fields imgPart.ImageUrl = "Images/catalogue/" + Session["partNumber"].ToString() + ".jpg"; lblPartName.Text = aVinylRoll.VinylRollName; lblPartNum.Text = aVinylRoll.PartNumber; lblColorInput.Text = aVinylRoll.VinylRollColor; txtUsdPrice.Text = aVinylRoll.UsdPrice.ToString("N2"); txtCadPrice.Text = aVinylRoll.CadPrice.ToString("N2"); break; } #endregion #region Sunrail300 //When Sunrail 300 is selected case "tblSunrail300": { //create Sunrail300 object Sunrail300 aSunrail300 = new Sunrail300(); //call select all function to populate object aSunrail300.Populate(aSunrail300.SelectAll(datUpdateDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); //populate fields imgPart.ImageUrl = "Images/catalogue/" + Session["partNumber"].ToString() + ".jpg"; lblPartName.Text = aSunrail300.Sunrail300Name; lblPartNum.Text = aSunrail300.PartNumber; lblColorInput.Text = aSunrail300.Sunrail300Color; txtUsdPrice.Text = aSunrail300.Sunrail300UsdPrice.ToString("N2"); txtCadPrice.Text = aSunrail300.Sunrail300CadPrice.ToString("N2"); break; } #endregion #region Sunrail300Accessories //When Sunrail 300 Accessories is selected case "tblSunrail300Accessories": { //create Sunrail300Accessories object Sunrail300Accessories aSunrail300Accessories = new Sunrail300Accessories(); //call select all function to populate object aSunrail300Accessories.Populate(aSunrail300Accessories.SelectAll(datUpdateDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); //populate fields imgPart.ImageUrl = "Images/catalogue/" + Session["partNumber"].ToString() + ".jpg"; lblPartName.Text = aSunrail300Accessories.Sunrail300AccessoriesName; lblPartNum.Text = aSunrail300Accessories.PartNumber; lblColorInput.Text = aSunrail300Accessories.Sunrail300AccessoriesColor; txtUsdPrice.Text = aSunrail300Accessories.Sunrail300AccessoriesUsdPrice.ToString("N2"); txtCadPrice.Text = aSunrail300Accessories.Sunrail300AccessoriesCadPrice.ToString("N2"); break; } #endregion #region Sunrail400 //When Sunrail 400 is selected case "tblSunrail400": { //create Sunrail400 object Sunrail400 aSunrail400 = new Sunrail400(); //call select all function to populate object aSunrail400.Populate(aSunrail400.SelectAll(datUpdateDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); //populate fields imgPart.ImageUrl = "Images/catalogue/" + Session["partNumber"].ToString() + ".jpg"; lblPartName.Text = aSunrail400.Sunrail400Name; lblPartNum.Text = aSunrail400.PartNumber; lblColorInput.Text = aSunrail400.Sunrail400Color; txtUsdPrice.Text = aSunrail400.Sunrail400UsdPrice.ToString("N2"); txtCadPrice.Text = aSunrail400.Sunrail400CadPrice.ToString("N2"); break; } #endregion #region Sunrail1000 //When Sunrail 1000 is selected case "tblSunrail1000": { //create Sunrail1000 object Sunrail1000 aSunrail1000 = new Sunrail1000(); //call select all function to populate object aSunrail1000.Populate(aSunrail1000.SelectAll(datUpdateDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); //populate fields imgPart.ImageUrl = "Images/catalogue/" + Session["partNumber"].ToString() + ".jpg"; lblPartName.Text = aSunrail1000.Sunrail1000Name; lblPartNum.Text = aSunrail1000.PartNumber; lblColorInput.Text = aSunrail1000.Sunrail1000Color; txtUsdPrice.Text = aSunrail1000.Sunrail1000UsdPrice.ToString("N2"); txtCadPrice.Text = aSunrail1000.Sunrail1000CadPrice.ToString("N2"); break; } #endregion #region WallExtrusions case "tblWallExtrusions": { //create Sunrail1000 object WallExtrusions aWallExtrusion = new WallExtrusions(); //call select all function to populate object aWallExtrusion.Populate(aWallExtrusion.SelectAll(datUpdateDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); //populate fields imgPart.ImageUrl = "Images/catalogue/" + Session["partNumber"].ToString() + ".jpg"; lblPartName.Text = aWallExtrusion.WallExtrusionName; lblPartNum.Text = aWallExtrusion.PartNumber; lblColorInput.Text = aWallExtrusion.WallExtrusionColor; txtUsdPrice.Text = aWallExtrusion.UsdPrice.ToString("N2"); txtCadPrice.Text = aWallExtrusion.CadPrice.ToString("N2"); break; } #endregion #region WallPanels case "tblWallPanels": { //create Sunrail1000 object WallPanels aWallPanel = new WallPanels(); //call select all function to populate object aWallPanel.Populate(aWallPanel.SelectAll(datUpdateDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); //populate fields imgPart.ImageUrl = "Images/catalogue/" + Session["partNumber"].ToString() + ".jpg"; lblPartName.Text = aWallPanel.WallPanelName; lblPartNum.Text = aWallPanel.WallPanelNumber; lblColorInput.Text = aWallPanel.WallPanelColor; txtUsdPrice.Text = aWallPanel.UsdPrice.ToString("N2"); txtCadPrice.Text = aWallPanel.CadPrice.ToString("N2"); break; } #endregion #region Schematics case "tblSchematics": { rowPart1.CssClass = "removeElement"; rowPart1Val.CssClass = "removeElement"; rowPart2.CssClass = "removeElement"; rowPart2Val.CssClass = "removeElement"; rowPart3.CssClass = "removeElement"; rowPart3Val.CssClass = "removeElement"; rowPart4.CssClass = "removeElement"; rowPart4Val.CssClass = "removeElement"; rowPart5.CssClass = "removeElement"; rowPart5Val.CssClass = "removeElement"; rowPart6.CssClass = "removeElement"; rowPart6Val.CssClass = "removeElement"; rowPart7.CssClass = "removeElement"; rowPart7Val.CssClass = "removeElement"; rowPart8.CssClass = "removeElement"; rowPart8Val.CssClass = "removeElement"; rowPart9.CssClass = "removeElement"; rowPart9Val.CssClass = "removeElement"; rowPart10.CssClass = "removeElement"; rowPart10Val.CssClass = "removeElement"; rowPart11.CssClass = "removeElement"; rowPart11Val.CssClass = "removeElement"; rowPart12.CssClass = "removeElement"; rowPart12Val.CssClass = "removeElement"; rowPart13.CssClass = "removeElement"; rowPart13Val.CssClass = "removeElement"; rowPart14.CssClass = "removeElement"; rowPart14Val.CssClass = "removeElement"; rowPart15.CssClass = "removeElement"; rowPart15Val.CssClass = "removeElement"; rowPart16.CssClass = "removeElement"; rowPart16Val.CssClass = "removeElement"; rowPart17.CssClass = "removeElement"; rowPart17Val.CssClass = "removeElement"; rowPart18.CssClass = "removeElement"; rowPart18Val.CssClass = "removeElement"; rowPart19.CssClass = "removeElement"; rowPart19Val.CssClass = "removeElement"; rowPart20.CssClass = "removeElement"; rowPart20Val.CssClass = "removeElement"; rowPart21.CssClass = "removeElement"; rowPart21Val.CssClass = "removeElement"; rowPart22.CssClass = "removeElement"; rowPart22Val.CssClass = "removeElement"; rowPart23.CssClass = "removeElement"; rowPart23Val.CssClass = "removeElement"; lblSchemPartNum.CssClass = "removeElement"; lblSchemPartKey.CssClass = "removeElement"; lblSchemPartKeyNum.CssClass = "removeElement"; lblSchemPartName.CssClass = "removeElement"; lblColor.CssClass = "removeElement"; lblColorInput.CssClass = "removeElement"; pnlDimensions.CssClass = "removeElement"; pnlPricing.CssClass = "removeElement"; //show pnlSchematics and pricingSchemTable pnlSchematics.CssClass = "showElementNoClass"; pnlPricingSchematics.CssClass = "pnlPricing"; imgPart.ImageUrl = "Images/catalogue/" + Session["partNumber"].ToString() + ".jpg"; //create Schematics object Schematics aSchematic = new Schematics(); //call select all function to populate object aSchematic.Populate(aSchematic.SelectAll(datUpdateDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); //add RoofPanels Object to the session Session.Add("schematic", aSchematic); //populate fields //set up a dataview object for object member data System.Data.DataView aPartsTable = new System.Data.DataView(); //select row based on table name and part number datUpdateDataSource.SelectCommand = "SELECT partNumber FROM tblSchematicParts WHERE schematicNumber='" + Session["partNumber"] + "' ORDER BY keyNumber ASC"; //assign the row to the dataview object aPartsTable = (System.Data.DataView)datUpdateDataSource.Select(System.Web.UI.DataSourceSelectArguments.Empty); ddlSchem.Items.Clear(); ddlSchem.Items.Add(""); for (int i = 0; i < aPartsTable.Count; i++) { ddlSchem.Items.Add(aPartsTable[i][0].ToString()); } lblPartName.Text = aSchematic.SchematicName.ToString(); txtPartDesc.Text = aSchematic.SchematicDescription.ToString(); lblPartNum.Text = aSchematic.SchematicNumber.ToString(); txtUsdPriceSchematic.Text = aSchematic.SchematicUsdPrice.ToString("N2"); txtCadPriceSchematic.Text = aSchematic.SchematicCadPrice.ToString("N2"); rfvSchemWholeUsd.ValidationGroup = "pricing"; cmpSchemWholeUsd.ValidationGroup = "pricing"; rfvSchemWholeCad.ValidationGroup = "pricing"; cmpSchemWholeCad.ValidationGroup = "pricing"; break; } #endregion } } #endregion else #region Display Pricing and Product Info { //Hide selected 'product' panels lblPartKey.CssClass = "removeElement"; pnlPackQuantity.CssClass = "removeElement"; pnlComposition.CssClass = "removeElement"; pnlStandard.CssClass = "removeElement"; txtPartDesc.CssClass = "txtInputFieldDesc"; //Hide all 'dimension' panels pnlAccessories.CssClass = "removeElement"; pnlDecorativeColumn.CssClass = "removeElement"; pnlDoorFrameExtrusions.CssClass = "removeElement"; pnlInsulatedFloors.CssClass = "removeElement"; pnlRoofExtrusions.CssClass = "removeElement"; pnlRoofPanels.CssClass = "removeElement"; pnlSchematics.CssClass = "removeElement"; pnlScreenRoll.CssClass = "removeElement"; pnlSuncrylicRoof.CssClass = "removeElement"; pnlSunrail1000.CssClass = "removeElement"; pnlSunrail300.CssClass = "removeElement"; pnlSunrail400.CssClass = "removeElement"; pnlVinylRoll.CssClass = "removeElement"; pnlWallExtrusions.CssClass = "removeElement"; pnlWallPanel.CssClass = "removeElement"; pnlPricingSchematics.CssClass = "removeElement"; //Switch statement for displaying according to selected product switch (tableName) { #region RoofExtrusions //when tblRoofExtrusions is selected case "tblRoofExtrusions": if (Session["roofExtrusion"] != null) { Session.Remove("roofExtrusion"); } //show pnlRoofExtrusion pnlRoofExtrusions.CssClass = "dimensionsTable"; //create RoofExtrusion object RoofExtrusion aRoofExtrusion = new RoofExtrusion(); //add RoofExtrusion Object to the session Session.Add("roofExtrusion", aRoofExtrusion); //call select all function to populate object aRoofExtrusion.Populate(aRoofExtrusion.SelectAll(datUpdateDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); //populate fields imgPart.ImageUrl = "Images/catalogue/" + Session["partNumber"].ToString() + ".jpg"; lblPartName.Text = aRoofExtrusion.ExtrusionName; txtPartDesc.Text = aRoofExtrusion.ExtrusionDescription; lblPartNum.Text = aRoofExtrusion.ExtrusionNumber; lblColorInput.Text = aRoofExtrusion.ExtrusionColor; //conditional field display, based on whether members have default values or not if (aRoofExtrusion.ExtrusionSize != 0) { lblRoofExtSizeUnits.Text = aRoofExtrusion.SizeUnits.ToString(); txtRoofExtSize.Text = aRoofExtrusion.ExtrusionSize.ToString(); rfvRoofExtSize.ValidationGroup = "roofExtrusion"; cmpRoofExtSize.ValidationGroup = "roofExtrusion"; } else { rowRoofExtSize.CssClass = "removeElement"; } if (aRoofExtrusion.AngleA != 0) { lblRoofExtAngleAUnits.Text = aRoofExtrusion.AngleAUnits.ToString(); txtRoofExtAngleA.Text = aRoofExtrusion.AngleA.ToString(); rfvRoofExtAngleA.ValidationGroup = "roofExtrusion"; cmpRoofExtAngleA.ValidationGroup = "roofExtrusion"; } else { rowRoofExtAngleA.CssClass = "removeElement"; } if (aRoofExtrusion.AngleB != 0) { lblRoofExtAngleBUnits.Text = aRoofExtrusion.AngleBUnits.ToString(); txtRoofExtAngleB.Text = aRoofExtrusion.AngleB.ToString(); rfvRoofExtAngleB.ValidationGroup = "roofExtrusion"; cmpRoofExtAngleB.ValidationGroup = "roofextrusion"; } else { rowRoofExtAngleB.CssClass = "removeElement"; } if (aRoofExtrusion.AngleC != 0) { lblRoofExtAngleCUnits.Text = aRoofExtrusion.AngleCUnits.ToString(); txtRoofExtAngleC.Text = aRoofExtrusion.AngleC.ToString(); rfvRoofExtAngleC.ValidationGroup = "roofExtrusion"; cmpRoofExtAngleC.ValidationGroup = "roofExtrusion"; } else { rowRoofExtAngleC.CssClass = "removeElement"; } txtRoofExtMaxLength.Text = aRoofExtrusion.ExtrusionMaxLength.ToString(); lblRoofExtMaxLengthUnits.Text = aRoofExtrusion.MaxLengthUnits.ToString(); rfvRoofExtMaxLength.ValidationGroup = "roofExtrusion"; cmpRoofExtMaxLength.ValidationGroup = "roofExtrusion"; txtUsdPrice.Text = aRoofExtrusion.UsdPrice.ToString("N2"); txtCadPrice.Text = aRoofExtrusion.CadPrice.ToString("N2"); if (aRoofExtrusion.Status) { radActive.Checked = true; } else { radInactive.Checked = true; } break; #endregion #region Accessories //when tblAccessories is selected case "tblAccessories": if (Session["accessories"] != null) { Session.Remove("accessories"); } //show pnlAccessories pnlPackQuantity.CssClass = "showPanelNoClass"; pnlAccessories.CssClass = "dimensionsTable"; //create Accessories object Accessories anAccessory = new Accessories(); //call select all function to populate object anAccessory.Populate(anAccessory.SelectAll(datUpdateDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); //add Accessories Object to the session Session.Add("accessories", anAccessory); //populate fields imgPart.ImageUrl = "Images/catalogue/" + Session["partNumber"].ToString() + ".jpg"; lblPartName.Text = anAccessory.AccessoryName; txtPartDesc.Text = anAccessory.AccessoryDescription; lblPartNum.Text = anAccessory.AccessoryNumber; //conditional field display, based on whether members have default values or not if (anAccessory.AccessoryColor != "") { lblColorInput.Text = anAccessory.AccessoryColor; } else { lblColorInput.CssClass = "removeElement"; lblColor.CssClass = "removeElement"; } if (anAccessory.AccessoryPackQuantity != 0) { txtPackQuantity.Text = anAccessory.AccessoryPackQuantity.ToString(); rfvPackQuantity.ValidationGroup = "accessories"; cmpPackQuantity.ValidationGroup = "accessories"; } else { pnlPackQuantity.CssClass = "removeElement"; } if (anAccessory.AccessoryWidth != 0) { lblAccessoryWidthUnits.Text = anAccessory.AccessoryWidthUnits; txtAccessoryWidth.Text = anAccessory.AccessoryWidth.ToString(); rfvAccessoryWidth.ValidationGroup = "accessories"; cmpAccessoryWidth.ValidationGroup = "accessories"; } else { rowAccessoryMaxWidth.CssClass = "removeElement"; } if (anAccessory.AccessoryLength != 0) { lblAccessoryLengthUnits.Text = anAccessory.AccessoryLengthUnits; txtAccessoryLength.Text = anAccessory.AccessoryLength.ToString(); rfvAccessoryLength.ValidationGroup = "accessories"; cmpAccessoryLength.ValidationGroup = "accessories"; } else { rowAccessoryMaxLength.CssClass = "removeElement"; } if (anAccessory.AccessorySize != 0) { lblAccessorySizeUnits.Text = anAccessory.AccessorySizeUnits; txtAccessorySize.Text = anAccessory.AccessorySize.ToString(); rfvAccessorySize.ValidationGroup = "accessories"; cmpAccessorySize.ValidationGroup = "accessories"; } else { rowAccessorySize.CssClass = "removeElement"; } txtUsdPrice.Text = anAccessory.AccessoryUsdPrice.ToString("N2"); txtCadPrice.Text = anAccessory.AccessoryCadPrice.ToString("N2"); if ((txtAccessoryLength.Text == "") && (txtAccessorySize.Text == "") && (txtAccessoryWidth.Text == "")) { pnlDimensions.CssClass = "removeElement"; } if (anAccessory.AccessoryStatus) { radActive.Checked = true; } else { radInactive.Checked = true; } break; #endregion #region DecorativeColumn //when tblDecorativeColumn is selected case "tblDecorativeColumn": if (Session["decorativeColumn"] != null) { Session.Remove("decorativeColumn"); } //show pnlDecorativeColumn pnlDecorativeColumn.CssClass = "dimensionsTable"; //create DecorativeColumn object DecorativeColumn aColumn = new DecorativeColumn(); //call select all function to populate object aColumn.Populate(aColumn.SelectAll(datUpdateDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); //add DecorativeColumn Object to the session Session.Add("decorativeColumn", aColumn); //populate fields imgPart.ImageUrl = "Images/catalogue/" + Session["partNumber"].ToString() + ".jpg"; lblPartName.Text = aColumn.ColumnName; txtPartDesc.Text = aColumn.ColumnDescription; lblPartNum.Text = aColumn.PartNumber; lblColorInput.Text = aColumn.ColumnColor; txtRoofDecColLength.Text = aColumn.ColumnLength.ToString(); lblRoofDecColLengthUnits.Text = aColumn.ColumnLengthUnits; rfvRoofDecColLength.ValidationGroup = "decorativeColumn"; cmpRoofDecColLength.ValidationGroup = "decorativeColumn"; txtUsdPrice.Text = aColumn.ColumnUsdPrice.ToString("N2"); txtCadPrice.Text = aColumn.ColumnCadPrice.ToString("N2"); if (aColumn.ColumnStatus) { radActive.Checked = true; } else { radInactive.Checked = true; } break; #endregion #region DoorFrameExtrusion //when tblDoorFrameExtrusion is selected case "tblDoorFrameExtrusion": if (Session["doorFrameExtrusion"] != null) { Session.Remove("doorFrameExtrusion"); } //show pnlDoorFrameExtrusions pnlDoorFrameExtrusions.CssClass = "dimensionsTable"; //create DoorFrameExtrusion object DoorFrameExtrusion aFrameExtrusion = new DoorFrameExtrusion(); //call select all function to populate object aFrameExtrusion.Populate(aFrameExtrusion.SelectAll(datUpdateDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); //add DoorFrameExtrusion Object to the session Session.Add("doorFrameExtrusion", aFrameExtrusion); //populate fields imgPart.ImageUrl = "Images/catalogue/" + Session["partNumber"].ToString() + ".jpg"; txtDoorFrExtMaxLength.Text = aFrameExtrusion.DfeMaxLength.ToString(); lblDoorFrExtMaxLengthUnits.Text = aFrameExtrusion.DfeMaxLengthUnits.ToString(); rfvDoorFrExtMaxLength.ValidationGroup = "doorFrameExtrusion"; cmpDoorFrExtMaxLength.ValidationGroup = "doorFrameExtrusion"; lblPartName.Text = aFrameExtrusion.DfeName; txtPartDesc.Text = aFrameExtrusion.DfeDescription; lblPartNum.Text = aFrameExtrusion.PartNumber; lblColorInput.Text = aFrameExtrusion.DfeColor; txtUsdPrice.Text = aFrameExtrusion.UsdPrice.ToString("N2"); txtCadPrice.Text = aFrameExtrusion.CadPrice.ToString("N2"); if (aFrameExtrusion.DfeStatus) { radActive.Checked = true; } else { radInactive.Checked = true; } break; #endregion #region InsulatedFloors //when tblInsulatedFloors is selected case "tblInsulatedFloors": if (Session["insulatedFloors"] != null) { Session.Remove("insulatedFloors"); } //show pnlInsulatedFloors and pnlComposition pnlInsulatedFloors.CssClass = "dimensionsTable"; pnlComposition.CssClass = "showPanelNoClass"; lblColor.CssClass = "removeElement"; lblColorInput.CssClass = "removeElement"; //create InsulatedFloors object InsulatedFloors aFloor = new InsulatedFloors(); //call select all function to populate object aFloor.Populate(aFloor.SelectAll(datUpdateDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); //add InsulatedFloors Object to the session Session.Add("insulatedFloors", aFloor); //populate fields imgPart.ImageUrl = "Images/catalogue/" + Session["partNumber"].ToString() + ".jpg"; lblPartName.Text = aFloor.InsulatedFloorName; txtPartDesc.Text = aFloor.InsulatedFloorDescription; lblPartNum.Text = aFloor.PartNumber; txtComposition.Text = aFloor.InsulatedFloorComposition; txtInsFloorSize.Text = aFloor.InsulatedFloorSize.ToString(); lblInsFloorSizeUnits.Text = aFloor.InsulatedFloorSizeUnits; txtInsFloorPnlMaxWidth.Text = aFloor.InsulatedFloorMaxWidth.ToString(); lblInsFloorPnlMaxWidthUnits.Text = aFloor.InsulatedFloorMaxWidthUnits; rfvInsFloorSize.ValidationGroup = "insulatedFloors"; cmpInsFloorSize.ValidationGroup = "insulatedFloors"; rfvInsFloorPnlMaxWidth.ValidationGroup = "insulatedFloors"; cmpInsFloorPnlMaxWidth.ValidationGroup = "insulatedFloors"; txtUsdPrice.Text = aFloor.InsulatedFloorUsdPrice.ToString("N2"); txtCadPrice.Text = aFloor.InsulatedFloorCadPrice.ToString("N2"); if (aFloor.InsulatedFloorStatus) { radActive.Checked = true; } else { radInactive.Checked = true; } break; #endregion #region RoofPanels //when tblRoofPanels is selected case "tblRoofPanels": if (Session["roofPanels"] != null) { Session.Remove("roofPanels"); } //show pnlRoofPanels and pnlStandard pnlStandard.CssClass = "showPanelNoClass"; pnlComposition.CssClass = "showPanelNoClass"; pnlRoofPanels.CssClass = "dimensionsTable"; rowRoofPanelsMaxLength.CssClass = "removeElement"; //create RoofPanels object RoofPanels aPanel = new RoofPanels(); //call select all function to populate object aPanel.Populate(aPanel.SelectAll(datUpdateDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); //add RoofPanels Object to the session Session.Add("roofPanels", aPanel); //populate fields imgPart.ImageUrl = "Images/catalogue/" + Session["partNumber"].ToString() + ".jpg"; lblPartName.Text = aPanel.PanelName; txtPartDesc.Text = aPanel.PanelDescription; txtStandard.Text = aPanel.PanelStandard; txtComposition.Text = aPanel.PanelComposition; lblPartNum.Text = aPanel.PartNumber; lblColorInput.Text = aPanel.PanelColor; txtRoofPnlMaxWidth.Text = aPanel.PanelMaxWidth.ToString(); lblRoofPnlMaxWidthUnits.Text = aPanel.MaxWidthUnits; rfvRoofPnlMaxWidth.ValidationGroup = "roofPanels"; cmpRoofPnlMaxWidth.ValidationGroup = "roofPanels"; rfvRoofPnlSize.ValidationGroup = "roofPanels"; cmpRoofPnlSize.ValidationGroup = "roofPanels"; txtRoofPnlSize.Text = aPanel.PanelSize.ToString(); lblRoofPnlSizeUnits.Text = aPanel.PanelSizeUnits; if (aPanel.PanelMaxLength != "Site Determined") { rowRoofPanelsMaxLengthStr.CssClass = "removeElement"; rowRoofPanelsMaxLength.CssClass = "showElementNoClass"; rfvRoofPnlMaxLength.ValidationGroup = "roofPanels"; cmpRoofPnlMaxLength.ValidationGroup = "roofPanels"; } txtUsdPrice.Text = aPanel.UsdPrice.ToString("N2"); txtCadPrice.Text = aPanel.CadPrice.ToString("N2"); if (aPanel.Status) { radActive.Checked = true; } else { radInactive.Checked = true; } break; #endregion #region ScreenRoll case "tblScreenRoll": { if (Session["screenRoll"] != null) { Session.Remove("screenRoll"); } pnlScreenRoll.CssClass = "dimensionsTable"; lblColor.CssClass = "removeElement"; lblColorInput.CssClass = "removeElement"; //create ScreenRoll object ScreenRoll aScreenRoll = new ScreenRoll(); //call select all function to populate object aScreenRoll.Populate(aScreenRoll.SelectAll(datUpdateDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); //add RoofPanels Object to the session Session.Add("screenRoll", aScreenRoll); //populate fields imgPart.ImageUrl = "Images/catalogue/" + Session["partNumber"].ToString() + ".jpg"; lblPartName.Text = aScreenRoll.ScreenRollName; lblPartNum.Text = aScreenRoll.PartNumber; txtScreenRollWidth.Text = aScreenRoll.ScreenRollWidth.ToString(); lblScreenRollWidthUnits.Text = aScreenRoll.ScreenRollWidthUnits.ToString(); txtScreenRollLength.Text = aScreenRoll.ScreenRollLength.ToString(); lblScreenRollLengthUnits.Text = aScreenRoll.ScreenRollLengthUnits.ToString(); rfvScreenRollWidth.ValidationGroup = "screenRoll"; cmpScreenRollWidth.ValidationGroup = "screenRoll"; rfvScreenRollLength.ValidationGroup = "screenRoll"; cmpScreenRollLength.ValidationGroup = "screenRoll"; txtUsdPrice.Text = aScreenRoll.UsdPrice.ToString("N2"); txtCadPrice.Text = aScreenRoll.CadPrice.ToString("N2"); if (aScreenRoll.Status) { radActive.Checked = true; } else { radInactive.Checked = true; } break; } #endregion #region SuncrylicRoof case "tblSuncrylicRoof": { if (Session["suncrylicRoof"] != null) { Session.Remove("suncrylicRoof"); } //show pnlRoofExtrusion pnlSuncrylicRoof.CssClass = "dimensionsTable"; //create RoofExtrusion object SuncrylicRoof aSunRoof = new SuncrylicRoof(); //add RoofExtrusion Object to the session Session.Add("suncrylicRoof", aSunRoof); //call select all function to populate object aSunRoof.Populate(aSunRoof.SelectAll(datUpdateDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); //populate fields imgPart.ImageUrl = "Images/catalogue/" + Session["partNumber"].ToString() + ".jpg"; lblPartName.Text = aSunRoof.SuncrylicName; txtPartDesc.Text = aSunRoof.SuncrylicDescription; lblPartNum.Text = aSunRoof.PartNumber; lblColorInput.Text = aSunRoof.SuncrylicColor; rowSunRoofMaxWidthStr.CssClass = "removeElement"; if (aSunRoof.SuncrylicMaxLength != 0) { rowSunRoofMaxLengthStr.CssClass = "removeElement"; rowSunRoofMaxLength.CssClass = "showElementNoClass"; txtSunRoofMaxLength.Text = aSunRoof.SuncrylicMaxLength.ToString(); lblSunRoofMaxLengthUnits.Text = aSunRoof.SuncrylicLengthUnits; rfvSunRoofMaxLength.ValidationGroup = "suncrylicRoof"; cmpSunRoofMaxLength.ValidationGroup = "suncrylicRoof"; } txtUsdPrice.Text = aSunRoof.UsdPrice.ToString("N2"); txtCadPrice.Text = aSunRoof.CadPrice.ToString("N2"); if (aSunRoof.Status) { radActive.Checked = true; } else { radInactive.Checked = true; } break; } #endregion #region VinylRoll case "tblVinylRoll": { if (Session["vinylRoll"] != null) { Session.Remove("vinylRoll"); } pnlDescription.CssClass = "removeElement"; //show pnlRoofExtrusion pnlVinylRoll.CssClass = "dimensionsTable"; //create RoofExtrusion object VinylRoll aVinylRoll = new VinylRoll(); //add RoofExtrusion Object to the session Session.Add("vinylRoll", aVinylRoll); //call select all function to populate object aVinylRoll.Populate(aVinylRoll.SelectAll(datUpdateDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); //populate fields imgPart.ImageUrl = "Images/catalogue/" + Session["partNumber"].ToString() + ".jpg"; lblPartName.Text = aVinylRoll.VinylRollName; lblPartNum.Text = aVinylRoll.PartNumber; lblColorInput.Text = aVinylRoll.VinylRollColor; rowVinylRollLength.CssClass = "removeElement"; txtVinylRollWeight.Text = aVinylRoll.VinylRollWeight.ToString(); lblVinylRollWeightUnits.Text = aVinylRoll.VinylRollWeightUnits; txtVinylRollWidth.Text = aVinylRoll.VinylRollWidth.ToString(); lblVinylRollWidthUnits.Text = aVinylRoll.VinylRollWidthUnits; rfvVinylRollWidth.ValidationGroup = "vinylRoll"; cmpVinylRollWidth.ValidationGroup = "vinylRoll"; rfvVinylRollWeight.ValidationGroup = "vinylRoll"; cmpVinylRollWeight.ValidationGroup = "vinylRoll"; txtUsdPrice.Text = aVinylRoll.UsdPrice.ToString("N2"); txtCadPrice.Text = aVinylRoll.CadPrice.ToString("N2"); if (aVinylRoll.Status) { radActive.Checked = true; } else { radInactive.Checked = true; } break; } #endregion #region Sunrail300 case "tblSunrail300": { if (Session["sunrail300"] != null) { Session.Remove("sunrail300"); } //show pnlRoofExtrusion pnlSunrail300.CssClass = "dimensionsTable"; //create RoofExtrusion object Sunrail300 aSunrail300 = new Sunrail300(); //add RoofExtrusion Object to the session Session.Add("sunrail300", aSunrail300); //call select all function to populate object aSunrail300.Populate(aSunrail300.SelectAll(datUpdateDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); //populate fields imgPart.ImageUrl = "Images/catalogue/" + Session["partNumber"].ToString() + ".jpg"; lblPartName.Text = aSunrail300.Sunrail300Name; txtPartDesc.Text = aSunrail300.Sunrail300Description; lblPartNum.Text = aSunrail300.PartNumber; lblColorInput.Text = aSunrail300.Sunrail300Color; txtSun300MaxLengthFt.Text = aSunrail300.Sunrail300MaxLengthFeet.ToString(); lblSun300MaxLengthFtUnits.Text = aSunrail300.Sunrail300MaxLengthFeetUnits; txtSun300PnlMaxLengthInch.Text = aSunrail300.Sunrail300MaxLengthInches.ToString(); lblSun300PnlMaxLengthInchUnits.Text = aSunrail300.Sunrail300MaxLengthInchesUnits; rfvSun300MaxLengthFt.ValidationGroup = "sunrail300"; cmpSun300MaxLengthFt.ValidationGroup = "sunrail300"; cmpSun300PnlMaxLengthInch.ValidationGroup = "sunrail300"; txtUsdPrice.Text = aSunrail300.Sunrail300UsdPrice.ToString("N2"); txtCadPrice.Text = aSunrail300.Sunrail300CadPrice.ToString("N2"); if (aSunrail300.Sunrail300Status) { radActive.Checked = true; } else { radInactive.Checked = true; } break; } #endregion #region Sunrail300Accessories case "tblSunrail300Accessories": { if (Session["sunrail300Acc"] != null) { Session.Remove("sunrail300Acc"); } pnlDimensions.CssClass = "removeElement"; //create RoofExtrusion object Sunrail300Accessories aSunrail300Acc = new Sunrail300Accessories(); //add RoofExtrusion Object to the session Session.Add("sunrail300Acc", aSunrail300Acc); //call select all function to populate object aSunrail300Acc.Populate(aSunrail300Acc.SelectAll(datUpdateDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); //populate fields imgPart.ImageUrl = "Images/catalogue/" + Session["partNumber"].ToString() + ".jpg"; lblPartName.Text = aSunrail300Acc.Sunrail300AccessoriesName; txtPartDesc.Text = aSunrail300Acc.Sunrail300AccessoriesDescription; lblPartNum.Text = aSunrail300Acc.PartNumber; lblColorInput.Text = aSunrail300Acc.Sunrail300AccessoriesColor; txtUsdPrice.Text = aSunrail300Acc.Sunrail300AccessoriesUsdPrice.ToString("N2"); txtCadPrice.Text = aSunrail300Acc.Sunrail300AccessoriesCadPrice.ToString("N2"); if (aSunrail300Acc.Sunrail300AccessoriesStatus) { radActive.Checked = true; } else { radInactive.Checked = true; } break; } #endregion #region Sunrail400 case "tblSunrail400": { if (Session["sunrail400"] != null) { Session.Remove("sunrail400"); } //show pnlRoofExtrusion pnlSunrail400.CssClass = "dimensionsTable"; //create RoofExtrusion object Sunrail400 aSunrail400 = new Sunrail400(); //add RoofExtrusion Object to the session Session.Add("sunrail400", aSunrail400); //call select all function to populate object aSunrail400.Populate(aSunrail400.SelectAll(datUpdateDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); //populate fields imgPart.ImageUrl = "Images/catalogue/" + Session["partNumber"].ToString() + ".jpg"; lblPartName.Text = aSunrail400.Sunrail400Name; txtPartDesc.Text = aSunrail400.Sunrail400Description; lblPartNum.Text = aSunrail400.PartNumber; lblColorInput.Text = aSunrail400.Sunrail400Color; txtSun400MaxLengthFt.Text = aSunrail400.Sunrail400MaxLengthFeet.ToString(); lblSun400MaxLengthFtUnits.Text = aSunrail400.Sunrail400MaxLengthFeetUnits; txtSun400PnlMaxLengthInch.Text = aSunrail400.Sunrail400MaxLengthInches.ToString(); lblSun400PnlMaxLengthInchUnits.Text = aSunrail400.Sunrail400MaxLengthInchesUnits; rfvSun400MaxLengthFt.ValidationGroup = "sunrail400"; cmpSun400MaxLengthFt.ValidationGroup = "sunrail400"; cmpSun400PnlMaxLengthInch.ValidationGroup = "sunrail400"; txtUsdPrice.Text = aSunrail400.Sunrail400UsdPrice.ToString("N2"); txtCadPrice.Text = aSunrail400.Sunrail400CadPrice.ToString("N2"); if (aSunrail400.Sunrail400Status) { radActive.Checked = true; } else { radInactive.Checked = true; } break; } #endregion #region Sunrail1000 case "tblSunrail1000": { if (Session["sunrail1000"] != null) { Session.Remove("sunrail1000"); } //show pnlRoofExtrusion pnlSunrail1000.CssClass = "dimensionsTable"; //create RoofExtrusion object Sunrail1000 aSunrail1000 = new Sunrail1000(); //add RoofExtrusion Object to the session Session.Add("sunrail1000", aSunrail1000); //call select all function to populate object aSunrail1000.Populate(aSunrail1000.SelectAll(datUpdateDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); //populate fields imgPart.ImageUrl = "Images/catalogue/" + Session["partNumber"].ToString() + ".jpg"; lblPartName.Text = aSunrail1000.Sunrail1000Name; txtPartDesc.Text = aSunrail1000.Sunrail1000Description; lblPartNum.Text = aSunrail1000.PartNumber; lblColorInput.Text = aSunrail1000.Sunrail1000Color; txtSun1000MaxLengthFt.Text = aSunrail1000.Sunrail1000MaxLengthFeet.ToString(); lblSun1000MaxLengthFtUnits.Text = aSunrail1000.Sunrail1000MaxLengthFeetUnits; txtSun1000PnlMaxLengthInch.Text = aSunrail1000.Sunrail1000MaxLengthInches.ToString(); lblSun1000PnlMaxLengthInchUnits.Text = aSunrail1000.Sunrail1000MaxLengthInchesUnits; rfvSun1000MaxLengthFt.ValidationGroup = "sunrail1000"; cmpSun1000MaxLengthFt.ValidationGroup = "sunrail1000"; cmpSun1000PnlMaxLengthInch.ValidationGroup = "sunrail1000"; txtUsdPrice.Text = aSunrail1000.Sunrail1000UsdPrice.ToString("N2"); txtCadPrice.Text = aSunrail1000.Sunrail1000CadPrice.ToString("N2"); if (aSunrail1000.Sunrail1000Status) { radActive.Checked = true; } else { radInactive.Checked = true; } break; } #endregion #region WallExtrusions case "tblWallExtrusions": { if (Session["wallExtrusions"] != null) { Session.Remove("wallExtrusions"); } //show pnlRoofExtrusion pnlWallExtrusions.CssClass = "dimensionsTable"; //create RoofExtrusion object WallExtrusions aWallExtrusion = new WallExtrusions(); //add RoofExtrusion Object to the session Session.Add("wallExtrusions", aWallExtrusion); //call select all function to populate object aWallExtrusion.Populate(aWallExtrusion.SelectAll(datUpdateDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); //populate fields imgPart.ImageUrl = "Images/catalogue/" + Session["partNumber"].ToString() + ".jpg"; lblPartName.Text = aWallExtrusion.WallExtrusionName; txtPartDesc.Text = aWallExtrusion.WallExtrusionDescription; lblPartNum.Text = aWallExtrusion.PartNumber; lblColorInput.Text = aWallExtrusion.WallExtrusionColor; txtWallExtMaxLength.Text = aWallExtrusion.WallExtrusionMaxLength.ToString(); lblWallExtMaxLengthUnits.Text = aWallExtrusion.LengthUnits; rfvWallExtMaxLength.ValidationGroup = "wallExtrusions"; cmpWallExtMaxLength.ValidationGroup = "wallExtrusions"; txtUsdPrice.Text = aWallExtrusion.UsdPrice.ToString("N2"); txtCadPrice.Text = aWallExtrusion.CadPrice.ToString("N2"); if (aWallExtrusion.Status) { radActive.Checked = true; } else { radInactive.Checked = true; } break; } #endregion #region WallPanels case "tblWallPanels": { if (Session["wallPanels"] != null) { Session.Remove("wallPanels"); } //show pnlRoofExtrusion pnlWallExtrusions.CssClass = "dimensionsTable"; pnlComposition.CssClass = "showPanelNoClass"; pnlStandard.CssClass = "showPanelNoClass"; //create RoofExtrusion object WallPanels aWallPanel = new WallPanels(); //add RoofExtrusion Object to the session Session.Add("wallPanels", aWallPanel); //call select all function to populate object aWallPanel.Populate(aWallPanel.SelectAll(datUpdateDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); //populate fields imgPart.ImageUrl = "Images/catalogue/" + Session["partNumber"].ToString() + ".jpg"; lblPartName.Text = aWallPanel.WallPanelName; txtPartDesc.Text = aWallPanel.WallPanelDescription; txtStandard.Text = aWallPanel.WallPanelStandard; txtComposition.Text = aWallPanel.WallPanelComposition; lblPartNum.Text = aWallPanel.WallPanelNumber; lblColorInput.Text = aWallPanel.WallPanelColor; txtWallPnlSize.Text = aWallPanel.WallPanelSize.ToString(); lblWallPnlSizeUnits.Text = aWallPanel.SizeUnits; txtWallPnlMaxLength.Text = aWallPanel.WallPanelMaxLength.ToString(); lblWallPnlMaxLengthUnits.Text = aWallPanel.LengthUnits; txtWallPnlMaxWidth.Text = aWallPanel.WallPanelMaxWidth.ToString(); lblWallPnlMaxWidthUnits.Text = aWallPanel.WidthUnits; txtUsdPrice.Text = aWallPanel.UsdPrice.ToString("N2"); txtCadPrice.Text = aWallPanel.CadPrice.ToString("N2"); if (aWallPanel.Status) { radActive.Checked = true; } else { radInactive.Checked = true; } break; } #endregion #region Schematics case "tblSchematics": { if (Session["schematic"] != null) { Session.Remove("schematic"); } if (Session["part"] != null) { Session.Remove("part"); } rowPart1.CssClass = "removeElement"; rowPart1Val.CssClass = "removeElement"; rowPart2.CssClass = "removeElement"; rowPart2Val.CssClass = "removeElement"; rowPart3.CssClass = "removeElement"; rowPart3Val.CssClass = "removeElement"; rowPart4.CssClass = "removeElement"; rowPart4Val.CssClass = "removeElement"; rowPart5.CssClass = "removeElement"; rowPart5Val.CssClass = "removeElement"; rowPart6.CssClass = "removeElement"; rowPart6Val.CssClass = "removeElement"; rowPart7.CssClass = "removeElement"; rowPart7Val.CssClass = "removeElement"; rowPart8.CssClass = "removeElement"; rowPart8Val.CssClass = "removeElement"; rowPart9.CssClass = "removeElement"; rowPart9Val.CssClass = "removeElement"; rowPart10.CssClass = "removeElement"; rowPart10Val.CssClass = "removeElement"; rowPart11.CssClass = "removeElement"; rowPart11Val.CssClass = "removeElement"; rowPart12.CssClass = "removeElement"; rowPart12Val.CssClass = "removeElement"; rowPart13.CssClass = "removeElement"; rowPart13Val.CssClass = "removeElement"; rowPart14.CssClass = "removeElement"; rowPart14Val.CssClass = "removeElement"; rowPart15.CssClass = "removeElement"; rowPart15Val.CssClass = "removeElement"; rowPart16.CssClass = "removeElement"; rowPart16Val.CssClass = "removeElement"; rowPart17.CssClass = "removeElement"; rowPart17Val.CssClass = "removeElement"; rowPart18.CssClass = "removeElement"; rowPart18Val.CssClass = "removeElement"; rowPart19.CssClass = "removeElement"; rowPart19Val.CssClass = "removeElement"; rowPart20.CssClass = "removeElement"; rowPart20Val.CssClass = "removeElement"; rowPart21.CssClass = "removeElement"; rowPart21Val.CssClass = "removeElement"; rowPart22.CssClass = "removeElement"; rowPart22Val.CssClass = "removeElement"; rowPart23.CssClass = "removeElement"; rowPart23Val.CssClass = "removeElement"; lblSchemPartNum.CssClass = "removeElement"; lblSchemPartKey.CssClass = "removeElement"; lblSchemPartKeyNum.CssClass = "removeElement"; lblSchemPartName.CssClass = "removeElement"; lblColor.CssClass = "removeElement"; lblColorInput.CssClass = "removeElement"; pnlDimensions.CssClass = "removeElement"; pnlPricing.CssClass = "removeElement"; //show pnlSchematics and pricingSchemTable pnlSchematics.CssClass = "showElementNoClass"; pnlPricingSchematics.CssClass = "pnlPricing"; imgPart.ImageUrl = "Images/catalogue/" + Session["partNumber"].ToString() + ".jpg"; //create Schematics object Schematics aSchematic = new Schematics(); //call select all function to populate object aSchematic.Populate(aSchematic.SelectAll(datUpdateDataSource, Session["tableName"].ToString(), Session["partNumber"].ToString())); //add RoofPanels Object to the session Session.Add("schematic", aSchematic); //populate fields //set up a dataview object for object member data System.Data.DataView aPartsTable = new System.Data.DataView(); //select row based on table name and part number datUpdateDataSource.SelectCommand = "SELECT partNumber FROM tblSchematicParts WHERE schematicNumber='" + Session["partNumber"] + "' ORDER BY keyNumber ASC"; //assign the row to the dataview object aPartsTable = (System.Data.DataView)datUpdateDataSource.Select(System.Web.UI.DataSourceSelectArguments.Empty); ddlSchem.Items.Clear(); ddlSchem.Items.Add(""); for (int i = 0; i < aPartsTable.Count; i++) { ddlSchem.Items.Add(aPartsTable[i][0].ToString()); } lblPartName.Text = aSchematic.SchematicName.ToString(); txtPartDesc.Text = aSchematic.SchematicDescription.ToString(); lblPartNum.Text = aSchematic.SchematicNumber.ToString(); txtUsdPriceSchematic.Text = aSchematic.SchematicUsdPrice.ToString("N2"); txtCadPriceSchematic.Text = aSchematic.SchematicCadPrice.ToString("N2"); rfvSchemWholeUsd.ValidationGroup = "pricing"; cmpSchemWholeUsd.ValidationGroup = "pricing"; rfvSchemWholeCad.ValidationGroup = "pricing"; cmpSchemWholeCad.ValidationGroup = "pricing"; if (aSchematic.SchematicStatus) { radActive.Checked = true; } else { radInactive.Checked = true; } break; #endregion } } #endregion } } } } /* if (Session["backToUpdate"] != null) { imgPart.ImageUrl = "Images/catalogue/temp.jpg"; System.IO.File.Delete(Server.MapPath("Images/catalogue/temp.jpg")); Session.Remove("backToUpdate"); } * */ }