private void BindSKU() { SKUAdmin _SkuAdmin = new SKUAdmin(); DataSet MyDatas = _SkuAdmin.GetByProductID(ItemId); uxGridInventoryDisplay.DataSource = MyDatas; uxGridInventoryDisplay.DataBind(); if (MyDatas.Tables[0].Rows.Count == 0) { butAddNewSKU.Enabled = true; //override previous logic } }
/// <summary> /// Bind value for Particular Product /// </summary> public void BindEditData() { ProductAdmin productAdmin = new ProductAdmin(); Product product = new Product(); SKUAdmin skuAdmin = new SKUAdmin(); if (ItemID > 0) { product = productAdmin.GetByProductId(ItemID); // General Information - Section1 lblTitle.Text += product.Name; txtProductName.Text = product.Name; txtProductNum.Text = product.ProductNum; if (ProductTypeList.SelectedIndex != -1) { ProductTypeList.SelectedValue = product.ProductTypeID.ToString(); } if (ManufacturerList.SelectedIndex != -1) { ManufacturerList.SelectedValue = product.ManufacturerID.ToString(); } if (ddlSupplier.SelectedIndex != -1) { ddlSupplier.SelectedValue = product.SupplierID.ToString(); } // Product Description and Image - Section2 txtshortdescription.Text = product.ShortDescription; ctrlHtmlText.Html = product.Description; Image1.ImageUrl = ZNode.Libraries.Framework.Business.ZNodeConfigManager.EnvironmentConfig.MediumImagePath + product.ImageFile; // Displaying the Image file name in a textbox txtimagename.Text = product.ImageFile; txtImageAltTag.Text = product.ImageAltTag; // Product properties if(product.RetailPrice.HasValue) txtproductRetailPrice.Text = product.RetailPrice.Value.ToString("N"); if (product.SalePrice.HasValue) txtproductSalePrice.Text = product.SalePrice.Value.ToString("N"); if (product.WholesalePrice.HasValue) txtProductWholeSalePrice.Text = product.WholesalePrice.Value.ToString("N"); txtDownloadLink.Text = product.DownloadLink; // Tax Classes if(product.TaxClassID.HasValue) ddlTaxClass.SelectedValue = product.TaxClassID.Value.ToString(); // Category List this.BindEditCategoryList(); //Display Settings txtDisplayOrder.Text = product.DisplayOrder.ToString(); ddlPageTemplateList.SelectedValue = product.MasterPage; // Inventory DataSet MySKUDataSet = skuAdmin.GetByProductID(ItemID); if (MySKUDataSet.Tables[0].Rows.Count != 0) { ViewState["productSkuId"] = MySKUDataSet.Tables[0].Rows[0]["skuid"].ToString(); txtProductSKU.Text = MySKUDataSet.Tables[0].Rows[0]["sku"].ToString(); txtProductQuantity.Text = MySKUDataSet.Tables[0].Rows[0]["quantityonhand"].ToString(); this.BindAttributes(product.ProductTypeID); } else { if (product.QuantityOnHand.HasValue) { txtProductQuantity.Text = product.QuantityOnHand.Value.ToString(); } if (product.ReorderLevel.HasValue) { txtReOrder.Text = product.ReorderLevel.Value.ToString(); } txtProductSKU.Text = product.SKU; } if (product.MaxQty.HasValue) { txtMaxQuantity.Text = product.MaxQty.Value.ToString(); } // Shipping settings ShippingTypeList.SelectedValue = product.ShippingRuleTypeID.ToString(); EnableValidators(); //This method will enable or disable validators based on the shippingtype if(product.FreeShippingInd.HasValue) chkFreeShippingInd.Checked = product.FreeShippingInd.Value; chkShipSeparately.Checked = product.ShipSeparately; if (product.Weight.HasValue) txtProductWeight.Text = product.Weight.Value.ToString("N2"); if (product.Height.HasValue) txtProductHeight.Text = product.Height.Value.ToString("N2"); if (product.Width.HasValue) txtProductWidth.Text = product.Width.Value.ToString("N2"); if (product.Length.HasValue) txtProductLength.Text = product.Length.Value.ToString("N2"); // Release the Resources MySKUDataSet.Dispose(); } }
/// <summary> /// Bind Inventory Grid /// </summary> private void BindSKU() { SKUAdmin SkuAdmin = new SKUAdmin(); DataSet MyDatas = SkuAdmin.GetByProductID(ItemId); DataView Sku = new DataView(MyDatas.Tables[0]); Sku.Sort = "SKU"; uxGridInventoryDisplay.DataSource = Sku; uxGridInventoryDisplay.DataBind(); }