예제 #1
0
    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;
    }
예제 #2
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();
        }
    }