Exemple #1
0
    /// <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."));
        }
    }
    protected DataSet BindSearchData()
    {
        #region Local Variables
        string Attributes = String.Empty;
        string AttributeList = string.Empty;
        DataSet MyDatas = new DataSet();
        SKUAdmin _SkuAdmin = new SKUAdmin();
        ProductAdmin _adminAccess = new ProductAdmin();
        #endregion

        productId = Convert.ToInt16(lstProduct.SelectedValue);

        if (productId != 0)
        {
            DataSet ds = _adminAccess.GetProductDetails(productId);

            //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());
            }

            //GetAttribute for this ProductType
            DataSet MyAttributeTypeDataSet = _adminAccess.GetAttributeTypeByProductTypeID(productTypeID);

            foreach (DataRow MyDataRow in MyAttributeTypeDataSet.Tables[0].Rows)
            {
                System.Web.UI.WebControls.DropDownList lstControl = (System.Web.UI.WebControls.DropDownList)ControlPlaceHolder.FindControl("lstAttribute" + MyDataRow["AttributeTypeId"].ToString());

                if (lstControl != null)
                {
                    int selValue = int.Parse(lstControl.SelectedValue);

                    if (selValue > 0)
                    {
                        Attributes += selValue.ToString() + ",";
                    }
                }
            }

            if (Attributes != "")
            {
                // Split the string
                AttributeList = Attributes.Substring(0, Attributes.Length - 1);
            }
        }

        if (Attributes.Length == 0 && productId == 0)
        {
            MyDatas = _SkuAdmin.GetallSkuData();
        }
        else
        {
            MyDatas = _SkuAdmin.GetBySKUAttributes(productId, AttributeList);
        }

        return MyDatas;
    }
    /// <summary>
    /// Bind Attributes List.
    /// </summary>
    protected void BindSkuAttributes()
    {
        // Set ProductId
        productId = Convert.ToInt16(lstProduct.SelectedValue);

        if (productId != 0)
        {
            ProductAdmin _adminAccess = new ProductAdmin();

            DataSet ds = _adminAccess.GetProductDetails(productId);

            //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());
            }

            DataSet MyDataSet = _adminAccess.GetAttributeTypeByProductTypeID(productTypeID);

            if (MyDataSet.Tables[0].Rows.Count > 0)
            {
                //Repeats until Number of AttributeType for this Product
                foreach (DataRow dr in MyDataSet.Tables[0].Rows)
                {
                    //Bind Attributes
                    DataSet _AttributeDataSet = _adminAccess.GetAttributesByAttributeTypeIdandProductID(int.Parse(dr["attributetypeid"].ToString()), productId);

                    System.Web.UI.WebControls.DropDownList lstControl = new DropDownList();
                    lstControl.ID = "lstAttribute" + dr["AttributeTypeId"].ToString();

                    ListItem li = new ListItem(dr["Name"].ToString(), "0");
                    li.Selected = true;

                    lstControl.DataSource = _AttributeDataSet;
                    lstControl.DataTextField = "Name";
                    lstControl.DataValueField = "AttributeId";
                    lstControl.DataBind();
                    lstControl.Items.Insert(0, li);

                    //Add Dynamic Attribute DropDownlist in the Placeholder
                    ControlPlaceHolder.Controls.Add(lstControl);

                    Literal lit1 = new Literal();
                    lit1.Text = "&nbsp;&nbsp;";
                    ControlPlaceHolder.Controls.Add(lit1);
                }

                pnlAttribteslist.Visible = true;
            }
            else
            {
                pnlAttribteslist.Visible = false;
            }
        }
        else
        {
            pnlAttribteslist.Visible = false;
        }
    }
Exemple #4
0
    /// <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."));
        }
    }
Exemple #5
0
    /// <summary>
    /// Clear button click event
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnClear_Click(object sender, EventArgs e)
    {
        ProductAdmin _adminAccess = new ProductAdmin();
        DataSet ds = _adminAccess.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());
        }

        // For Attribute value.
        string Attributes = String.Empty;

        //GetAttribute for this ProductType
        DataSet MyAttributeTypeDataSet = _adminAccess.GetAttributeTypeByProductTypeID(productTypeID);

        foreach (DataRow MyDataRow in MyAttributeTypeDataSet.Tables[0].Rows)
        {
            System.Web.UI.WebControls.DropDownList lstControl = (System.Web.UI.WebControls.DropDownList)ControlPlaceHolder.FindControl("lstAttribute" + MyDataRow["AttributeTypeId"].ToString());
            lstControl.SelectedIndex = 0;
        }

        this.BindSKU();
    }
Exemple #6
0
    /// <summary>
    /// Binds the Search data
    /// </summary>
    private void BindSearchData()
    {
        ProductAdmin adminAccess = new ProductAdmin();
        DataSet ds = adminAccess.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());
        }

        // For Attribute value.
        string Attributes = String.Empty;

        //GetAttribute for this ProductType
        DataSet MyAttributeTypeDataSet = adminAccess.GetAttributeTypeByProductTypeID(productTypeID);

        foreach (DataRow MyDataRow in MyAttributeTypeDataSet.Tables[0].Rows)
        {
            System.Web.UI.WebControls.DropDownList lstControl = (System.Web.UI.WebControls.DropDownList)ControlPlaceHolder.FindControl("lstAttribute" + MyDataRow["AttributeTypeId"].ToString());

            if (lstControl != null)
            {
                int selValue = int.Parse(lstControl.SelectedValue);

                if (selValue > 0)
                {
                    Attributes += selValue.ToString() + ",";
                }
            }
        }

        //If Attributes length is more than zero.
        if (Attributes.Length > 0)
        {
            // Split the string
            string Attribute = Attributes.Substring(0, Attributes.Length - 1);

            if (Attribute.Length > 0)
            {
                SKUAdmin _SkuAdmin = new SKUAdmin();
                DataSet MyDatas = _SkuAdmin.GetBySKUAttributes(ItemId, Attribute);

                DataView Sku = new DataView(MyDatas.Tables[0]);
                Sku.Sort = "SKU";
                uxGridInventoryDisplay.DataSource = Sku;
                uxGridInventoryDisplay.DataBind();
            }
        }
        else
        {
            this.BindSKU();
        }
    }