/// <summary> /// Binding Product Values into label Boxes /// </summary> public void BindViewData() { //Create Instance for Product Admin and Product entity ZNode.Libraries.Admin.ProductAdmin ProdAdmin = new ProductAdmin(); Product _Product = ProdAdmin.GetByProductId(ItemId); DataSet ds = ProdAdmin.GetProductDetails(ItemId); //Check for Number of Rows if (ds.Tables[0].Rows.Count != 0) { //Check For Product Type productTypeID = int.Parse(ds.Tables[0].Rows[0]["ProductTypeId"].ToString()); int Count = ProdAdmin.GetAttributeCount(int.Parse(ds.Tables[0].Rows[0]["ProductTypeId"].ToString()), ZNodeConfigManager.SiteConfig.PortalID); if (Count > 0) { //DivAddSKU.Visible = true; butAddNewSKU.Enabled = true; } else { lblmessage.Text = "Note: You can add multiple SKUs or Part Numbers to a product only if the product has attributes."; butAddNewSKU.Enabled = false; } } if (_Product != null) { //General Informations lblProdName.Text = _Product.Name; //Binding product Category DataSet dsCategory = ProdAdmin.Get_CategoryByProductID(ItemId); StringBuilder Builder = new StringBuilder(); foreach (System.Data.DataRow dr in dsCategory.Tables[0].Rows) { Builder.Append(ProdAdmin.GetCategorypath(dr["Name"].ToString(), dr["Parent1CategoryName"].ToString(), dr["Parent2CategoryName"].ToString())); Builder.Append("<br>"); } //Bind Grid - SKU this.BindSKU(); } else { throw (new ApplicationException("Product Requested could not be found.")); } }
/// <summary> /// Binding Product Values into label Boxes /// </summary> public void BindViewData() { //Create Instance for Product Admin and Product entity ZNode.Libraries.Admin.ProductAdmin prodAdmin = new ProductAdmin(); Product product=prodAdmin.GetByProductId(ItemId); DataSet ds = prodAdmin.GetProductDetails(ItemId); int Count = 0; //Check for Number of Rows if (ds.Tables[0].Rows.Count != 0) { //Bind ProductType,Manufacturer,Supplier lblProdType.Text = ds.Tables[0].Rows[0]["producttype name"].ToString(); lblManufacturerName.Text = ds.Tables[0].Rows[0]["MANUFACTURER NAME"].ToString(); //Check For Product Type productTypeID = int.Parse(ds.Tables[0].Rows[0]["ProductTypeId"].ToString()); Count = prodAdmin.GetAttributeCount(int.Parse(ds.Tables[0].Rows[0]["ProductTypeId"].ToString()), ZNodeConfigManager.SiteConfig.PortalID); //Check product atributes count if (Count > 0) { tabProductDetails.Tabs[2].Enabled = true; // Enable Manage inventory tab } else { tabProductDetails.Tabs[2].Enabled = false;// Disable Manage inventory tab } } if (product != null) { //General Information lblProdName.Text = product.Name; lblProdNum.Text = product.ProductNum.ToString(); if (Count > 0) { lblProductSKU.Text = "See Manage SKUs tab"; lblQuantity.Text = "See Manage SKUs tab"; lblReOrder.Text = "See Manage SKUs tab"; lblSupplierName.Text = "See Manage SKUs tab"; } else { lblProductSKU.Text = product.SKU; if(product.QuantityOnHand.HasValue) lblQuantity.Text = product.QuantityOnHand.Value.ToString(); if(product.ReorderLevel.HasValue) lblReOrder.Text = product.ReorderLevel.Value.ToString(); lblSupplierName.Text = ds.Tables[0].Rows[0]["Supplier Name"].ToString(); } if (product.MaxQty.HasValue) lblMaxQuantity.Text = product.MaxQty.Value.ToString(); //image if (product.ImageFile.Trim().Length > 0) { string ImageFilePath = ZNodeConfigManager.EnvironmentConfig.MediumImagePath + product.ImageFile; ItemImage.ImageUrl = ImageFilePath; } else { ItemImage.ImageUrl = ZNodeConfigManager.SiteConfig.ImageNotAvailablePath; } //Product Description and Features lblShortDescription.Text = product.ShortDescription; lblProductDescription.Text = product.Description; lblProductFeatures.Text = product.FeaturesDesc; lblproductspecification.Text = product.Specifications; lbladditionalinfo.Text = product.AdditionalInformation; lblDownloadLink.Text = product.DownloadLink; //Product Attributes if (product.RetailPrice.HasValue) lblRetailPrice.Text = product.RetailPrice.Value.ToString("c"); if (product.WholesalePrice.HasValue) lblWholeSalePrice.Text = product.WholesalePrice.Value.ToString("c"); lblSalePrice.Text = FormatPrice(product.SalePrice); lblWeight.Text = this.FormatProductWeight(product.Weight); if (product.Height.HasValue) lblHeight.Text = product.Height.Value.ToString("N2") + " " + ZNodeConfigManager.SiteConfig.DimensionUnit; if (product.Width.HasValue) lblWidth.Text = product.Width.Value.ToString("N2") + " " + ZNodeConfigManager.SiteConfig.DimensionUnit; if (product.Length.HasValue) lblLength.Text = product.Length.Value.ToString("N2") + " " + ZNodeConfigManager.SiteConfig.DimensionUnit; //Display Settings chkProductEnabled.Src = ZNode.Libraries.Framework.Business.ZNodeHelper.GetCheckMark(bool.Parse(product.ActiveInd.ToString())); lblProdDisplayOrder.Text = product.DisplayOrder.ToString(); chkIsSpecialProduct.Src = ZNode.Libraries.Framework.Business.ZNodeHelper.GetCheckMark(this.DisplayVisible(product.HomepageSpecial)); chkIsNewItem.Src = ZNode.Libraries.Framework.Business.ZNodeHelper.GetCheckMark(this.DisplayVisible(product.NewProductInd)); chkProductPricing.Src = ZNode.Libraries.Framework.Business.ZNodeHelper.GetCheckMark(this.DisplayVisible(product.CallForPricing)); chkproductInventory.Src = ZNode.Libraries.Framework.Business.ZNodeHelper.GetCheckMark(this.DisplayVisible(product.InventoryDisplay)); // Display Tax Class Name if (product.TaxClassID.HasValue) { TaxRuleAdmin taxRuleAdmin = new TaxRuleAdmin(); TaxClass taxClass = taxRuleAdmin.GetByTaxClassID(product.TaxClassID.Value); if(taxClass != null) lblTaxClass.Text = taxClass.Name; } // Recurring Billing imgRecurringBillingInd.Src = ZNode.Libraries.Framework.Business.ZNodeHelper.GetCheckMark(this.DisplayVisible(product.RecurringBillingInd)); lblBillingPeriod.Text = product.RecurringBillingPeriod; lblFrequency.Text = product.RecurringBillingFrequency; lblTotalCycles.Text = product.RecurringBillingTotalCycles.GetValueOrDefault(0).ToString(); shipSeparatelyInd.Src = ZNode.Libraries.Framework.Business.ZNodeHelper.GetCheckMark(product.ShipSeparately); lblMastePageName.Text = product.MasterPage; //seo lblSEODescription.Text = product.SEODescription; lblSEOKeywords.Text = product.SEOKeywords; lblSEOTitle.Text = product.SEOTitle; lblSEOURL.Text = product.SEOURL; //checking whether the image is active or not //ZNode.Libraries.Admin.ProductViewAdmin pp = new ProductViewAdmin(); //Inventory Setting - Out of Stock Options if (product.TrackInventoryInd.HasValue && product.AllowBackOrder.HasValue) { if ((product.TrackInventoryInd.Value) && (product.AllowBackOrder.Value == false)) { chkCartInventoryEnabled.Src = ZNode.Libraries.Framework.Business.ZNodeHelper.GetCheckMark(bool.Parse("true")); chkIsBackOrderEnabled.Src = SetCheckMarkImage(); chkIstrackInvEnabled.Src = SetCheckMarkImage(); } else if (product.TrackInventoryInd.Value && product.AllowBackOrder.Value) { chkCartInventoryEnabled.Src = SetCheckMarkImage(); chkIsBackOrderEnabled.Src = ZNode.Libraries.Framework.Business.ZNodeHelper.GetCheckMark(bool.Parse("true")); chkIstrackInvEnabled.Src = SetCheckMarkImage(); } else if ((product.TrackInventoryInd.Value == false) && (product.AllowBackOrder.Value == false)) { chkCartInventoryEnabled.Src = SetCheckMarkImage(); chkIsBackOrderEnabled.Src = SetCheckMarkImage(); chkIstrackInvEnabled.Src = ZNode.Libraries.Framework.Business.ZNodeHelper.GetCheckMark(bool.Parse("true")); } } else { chkCartInventoryEnabled.Src = SetCheckMarkImage(); chkIsBackOrderEnabled.Src = SetCheckMarkImage(); chkIstrackInvEnabled.Src = ZNode.Libraries.Framework.Business.ZNodeHelper.GetCheckMark(bool.Parse("true")); } //Inventory Setting - Stock Messages lblInStockMsg.Text = product.InStockMsg; lblOutofStock.Text = product.OutOfStockMsg; lblBackOrderMsg.Text = product.BackOrderMsg; if (product.DropShipInd.HasValue) { IsDropShipEnabled.Src = ZNode.Libraries.Framework.Business.ZNodeHelper.GetCheckMark(product.DropShipInd.Value); } else { IsDropShipEnabled.Src = ZNode.Libraries.Framework.Business.ZNodeHelper.GetCheckMark(bool.Parse("false")); } //Binding product Category DataSet dsCategory = prodAdmin.Get_CategoryByProductID(ItemId); StringBuilder Builder = new StringBuilder(); foreach (System.Data.DataRow dr in dsCategory.Tables[0].Rows) { Builder.Append(prodAdmin.GetCategorypath(dr["Name"].ToString(),dr["Parent1CategoryName"].ToString(), dr["Parent2CategoryName"].ToString())); Builder.Append("<br>"); } if (product.FeaturedInd) { FeaturedProduct.Src = ZNode.Libraries.Framework.Business.ZNodeHelper.GetCheckMark(true); } else { FeaturedProduct.Src = ZNode.Libraries.Framework.Business.ZNodeHelper.GetCheckMark(false); } lblProductCategories.Text = Builder.ToString(); //Bind ShippingRule type if(product.ShippingRuleTypeID.HasValue) lblShippingRuleTypeName.Text = GetShippingRuleTypeName(product.ShippingRuleTypeID.Value); if (product.FreeShippingInd.HasValue) freeShippingInd.Src = ZNode.Libraries.Framework.Business.ZNodeHelper.GetCheckMark(product.FreeShippingInd.Value); else freeShippingInd.Src = ZNode.Libraries.Framework.Business.ZNodeHelper.GetCheckMark(false); //Bind Grid - Product Related Items this.BindRelatedItems(); //this.BindImage(); this.BindImageDatas(); //Bind Grid - Product Addons BindProductAddons(); //Bind Grid - Inventory BindSKU(); //Tiered Pricing BindTieredPricing(); //Digital Asset BindDigitalAssets(); //Bind product highlights BindProductHighlights(); } else { throw (new ApplicationException("Product Requested could not be found.")); } }