コード例 #1
0
        public static string getProduct(string textsearch)
        {
            List <ProductGetOut> result = new List <ProductGetOut>();
            string username             = HttpContext.Current.Request.Cookies["usernameLoginSystem"].Value;
            var    acc = AccountController.GetByUsername(username);

            if (acc != null)
            {
                int AgentID = Convert.ToInt32(acc.AgentID);
                var product = ProductController.GetBySKU(textsearch.Trim().ToUpper());

                if (product != null)
                {
                    if (product.ProductStyle == 1)
                    {
                        result.Add(_getProduct(product));
                    }
                    else
                    {
                        var productvariable = ProductVariableController.GetByParentSKU(product.ProductSKU);
                        result.AddRange(_getProductVariation(productvariable, product));
                    }
                }
                else
                {
                    var productvariable = ProductVariableController.GetAllBySKU(textsearch.Trim().ToUpper());
                    result.AddRange(_getProductVariation(productvariable));
                }
            }

            return(JsonConvert.SerializeObject(result));
        }
コード例 #2
0
        public static string getProduct(string textsearch)
        {
            List <ProductGetOut> ps = new List <ProductGetOut>();
            string username         = HttpContext.Current.Request.Cookies["userLoginSystem"].Value;
            var    acc = AccountController.GetByUsername(username);

            if (acc != null)
            {
                int AgentID  = Convert.ToInt32(acc.AgentID);
                var products = ProductController.GetBySKU(textsearch.Trim().ToUpper());

                if (products != null)
                {
                    var productvariable = ProductVariableController.GetByParentSKU(products.ProductSKU);

                    if (productvariable.Count > 0)
                    {
                        foreach (var pv in productvariable)
                        {
                            string SKU = pv.SKU.Trim().ToUpper();

                            var check = StockManagerController.GetBySKU(AgentID, SKU);

                            if (check.Count > 0)
                            {
                                double total = PJUtils.TotalProductQuantityInstock(AgentID, SKU);

                                if (total > 0)
                                {
                                    var variables = ProductVariableValueController.GetByProductVariableSKU(pv.SKU);

                                    if (variables.Count > 0)
                                    {
                                        string variablename  = "";
                                        string variablevalue = "";
                                        string variable      = "";

                                        foreach (var v in variables)
                                        {
                                            variable      += v.VariableName.Trim() + ": " + v.VariableValue.Trim() + "|";
                                            variablename  += v.VariableName.Trim() + "|";
                                            variablevalue += v.VariableValue.Trim() + "|";
                                        }

                                        ProductGetOut p = new ProductGetOut();
                                        p.ID                   = pv.ID;
                                        p.ProductName          = products.ProductTitle;
                                        p.ProductVariable      = variable;
                                        p.ProductVariableName  = variablename;
                                        p.ProductVariableValue = variablevalue;
                                        p.ProductType          = 2;

                                        var product = ProductController.GetBySKU(pv.ParentSKU);

                                        if (!string.IsNullOrEmpty(pv.Image))
                                        {
                                            p.ProductImage       = "<img src=\"" + pv.Image + "\" />";
                                            p.ProductImageOrigin = pv.Image;
                                        }
                                        else if (!string.IsNullOrEmpty(product.ProductImage))
                                        {
                                            p.ProductImage       = "<img src=\"" + product.ProductImage + "\" />";
                                            p.ProductImageOrigin = product.ProductImage;
                                        }
                                        else
                                        {
                                            p.ProductImage       = "<img src=\"/App_Themes/Ann/image/placeholder.png\" />";
                                            p.ProductImageOrigin = "";
                                        }

                                        p.QuantityInstock       = total;
                                        p.QuantityInstockString = string.Format("{0:N0}", total);
                                        p.SKU = SKU;
                                        int supplierID = 0;
                                        if (pv.SupplierID != null)
                                        {
                                            supplierID = pv.SupplierID.ToString().ToInt(0);
                                        }
                                        p.SupplierID = supplierID;
                                        string supplierName = "";
                                        if (!string.IsNullOrEmpty(pv.SupplierName))
                                        {
                                            supplierName = pv.SupplierName;
                                        }
                                        p.SupplierName = supplierName;
                                        ps.Add(p);
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        string SKU   = products.ProductSKU.Trim().ToUpper();
                        var    check = StockManagerController.GetBySKU(AgentID, SKU);
                        if (check.Count > 0)
                        {
                            double total = PJUtils.TotalProductQuantityInstock(AgentID, SKU);
                            if (total > 0)
                            {
                                string variablename  = "";
                                string variablevalue = "";
                                string variable      = "";

                                ProductGetOut p = new ProductGetOut();
                                p.ID                   = products.ID;
                                p.ProductName          = products.ProductTitle;
                                p.ProductVariable      = variable;
                                p.ProductVariableName  = variablename;
                                p.ProductVariableValue = variablevalue;
                                p.ProductType          = 1;
                                var img = ProductImageController.GetFirstByProductID(products.ID);

                                if (!string.IsNullOrEmpty(products.ProductImage))
                                {
                                    p.ProductImage       = "<img src=\"" + products.ProductImage + "\" />";
                                    p.ProductImageOrigin = products.ProductImage;
                                }
                                else if (img != null)
                                {
                                    p.ProductImage       = "<img src=\"" + img.ProductImage + "\" />";
                                    p.ProductImageOrigin = img.ProductImage;
                                }
                                else
                                {
                                    p.ProductImage       = "<img src=\"/App_Themes/Ann/image/placeholder.png\" />";
                                    p.ProductImageOrigin = "";
                                }

                                p.SKU                   = SKU;
                                p.QuantityInstock       = total;
                                p.QuantityInstockString = string.Format("{0:N0}", total);
                                int supplierID = 0;
                                if (products.SupplierID != null)
                                {
                                    supplierID = products.SupplierID.ToString().ToInt(0);
                                }
                                p.SupplierID = supplierID;
                                string supplierName = "";
                                if (!string.IsNullOrEmpty(products.SupplierName))
                                {
                                    supplierName = products.SupplierName;
                                }
                                p.SupplierName = supplierName;
                                ps.Add(p);
                            }
                        }
                    }
                }
                else
                {
                    var productvariable = ProductVariableController.GetAllBySKU(textsearch.Trim().ToUpper());

                    if (productvariable != null)
                    {
                        foreach (var value in productvariable)
                        {
                            string SKU = value.SKU.Trim().ToUpper();

                            var check = StockManagerController.GetBySKU(AgentID, SKU);
                            if (check.Count > 0)
                            {
                                double total = PJUtils.TotalProductQuantityInstock(AgentID, SKU);
                                if (total > 0)
                                {
                                    var variables = ProductVariableValueController.GetByProductVariableSKU(value.SKU);

                                    if (variables.Count > 0)
                                    {
                                        string variablename  = "";
                                        string variablevalue = "";
                                        string variable      = "";

                                        foreach (var v in variables)
                                        {
                                            variable      += v.VariableName + ": " + v.VariableValue + "|";
                                            variablename  += v.VariableName + "|";
                                            variablevalue += v.VariableValue + "|";
                                        }

                                        ProductGetOut p = new ProductGetOut();
                                        p.ID = value.ID;

                                        var product = ProductController.GetBySKU(value.ParentSKU);

                                        if (product != null)
                                        {
                                            p.ProductName = product.ProductTitle;
                                        }
                                        p.ProductVariable      = variable;
                                        p.ProductVariableName  = variablename;
                                        p.ProductVariableValue = variablevalue;
                                        p.ProductType          = 2;

                                        if (!string.IsNullOrEmpty(value.Image))
                                        {
                                            p.ProductImage       = "<img src=\"" + value.Image + "\" />";
                                            p.ProductImageOrigin = value.Image;
                                        }
                                        else if (!string.IsNullOrEmpty(product.ProductImage))
                                        {
                                            p.ProductImage       = "<img src=\"" + product.ProductImage + "\" />";
                                            p.ProductImageOrigin = product.ProductImage;
                                        }
                                        else
                                        {
                                            p.ProductImage       = "<img src=\"/App_Themes/Ann/image/placeholder.png\" />";
                                            p.ProductImageOrigin = "";
                                        }

                                        p.SKU                   = value.SKU.Trim().ToUpper();
                                        p.QuantityInstock       = total;
                                        p.QuantityInstockString = string.Format("{0:N0}", total);
                                        int supplierID = 0;
                                        if (value.SupplierID != null)
                                        {
                                            supplierID = value.SupplierID.ToString().ToInt(0);
                                        }
                                        p.SupplierID = supplierID;
                                        string supplierName = "";
                                        if (!string.IsNullOrEmpty(value.SupplierName))
                                        {
                                            supplierName = value.SupplierName;
                                        }
                                        p.SupplierName = supplierName;
                                        ps.Add(p);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            JavaScriptSerializer serializer = new JavaScriptSerializer();

            return(serializer.Serialize(ps));
        }
コード例 #3
0
        public static string getProduct(string textsearch, int typeinout)
        {
            List <ProductGetOut> ps = new List <ProductGetOut>();
            string username         = HttpContext.Current.Request.Cookies["usernameLoginSystem"].Value;
            var    acc = AccountController.GetByUsername(username);

            if (acc != null)
            {
                int AgentID = Convert.ToInt32(acc.AgentID);
                if (typeinout == 1)
                {
                    var products = ProductController.GetByTextSearchIsHidden(textsearch.Trim(), false);
                    if (products.Count > 0)
                    {
                        foreach (var item in products)
                        {
                            var productvariable = ProductVariableController.GetProductID(item.ID);
                            if (productvariable.Count > 0)
                            {
                                foreach (var pv in productvariable)
                                {
                                    string SKU   = pv.SKU.Trim().ToUpper();
                                    var    check = StockManagerController.GetBySKU(AgentID, SKU);
                                    if (check.Count > 0)
                                    {
                                        double total = PJUtils.TotalProductQuantityInstock(AgentID, SKU);
                                        if (total > 0)
                                        {
                                            var variables = ProductVariableValueController.GetByProductVariableID(pv.ID);
                                            if (variables.Count > 0)
                                            {
                                                string variablename  = "";
                                                string variablevalue = "";
                                                string variable      = "";

                                                foreach (var v in variables)
                                                {
                                                    variable      += v.VariableName.Trim() + ":" + v.VariableValue.Trim() + "|";
                                                    variablename  += v.VariableName.Trim() + "|";
                                                    variablevalue += v.VariableValue.Trim() + "|";
                                                }

                                                ProductGetOut p = new ProductGetOut();
                                                p.ID                    = pv.ID;
                                                p.ProductName           = item.ProductTitle;
                                                p.ProductVariable       = variable;
                                                p.ProductVariableName   = variablename;
                                                p.ProductVariableValue  = variablevalue;
                                                p.ProductType           = 2;
                                                p.ProductImage          = "<img src=\"" + Thumbnail.getURL(pv.Image, Thumbnail.Size.Small) + "\" style=\"width: 50px\" />";
                                                p.ProductImageOrigin    = Thumbnail.getURL(pv.Image, Thumbnail.Size.Source);
                                                p.QuantityInstock       = total;
                                                p.QuantityInstockString = string.Format("{0:N0}", total);
                                                p.SKU                   = SKU;
                                                int supplierID = 0;
                                                if (pv.SupplierID != null)
                                                {
                                                    supplierID = pv.SupplierID.ToString().ToInt(0);
                                                }
                                                p.SupplierID = supplierID;
                                                string supplierName = "";
                                                if (!string.IsNullOrEmpty(pv.SupplierName))
                                                {
                                                    supplierName = pv.SupplierName;
                                                }
                                                p.SupplierName = supplierName;
                                                ps.Add(p);
                                            }
                                        }
                                    }
                                }
                            }
                            else
                            {
                                string SKU   = item.ProductSKU.Trim().ToUpper();
                                var    check = StockManagerController.GetBySKU(AgentID, SKU);
                                if (check.Count > 0)
                                {
                                    double total = PJUtils.TotalProductQuantityInstock(AgentID, SKU);
                                    if (total > 0)
                                    {
                                        string variablename  = "";
                                        string variablevalue = "";
                                        string variable      = "";

                                        ProductGetOut p = new ProductGetOut();
                                        p.ID                   = item.ID;
                                        p.ProductName          = item.ProductTitle;
                                        p.ProductVariable      = variable;
                                        p.ProductVariableName  = variablename;
                                        p.ProductVariableValue = variablevalue;
                                        p.ProductType          = 1;
                                        var img = ProductImageController.GetFirstByProductID(item.ID);
                                        p.ProductImage          = "<img src=\"" + Thumbnail.getURL(img.ProductImage, Thumbnail.Size.Small) + "\" style=\"width: 50px\"  />";
                                        p.ProductImageOrigin    = Thumbnail.getURL(img.ProductImage, Thumbnail.Size.Source);
                                        p.QuantityInstock       = total;
                                        p.QuantityInstockString = string.Format("{0:N0}", total);
                                        p.SKU = SKU;
                                        int supplierID = 0;
                                        if (item.SupplierID != null)
                                        {
                                            supplierID = item.SupplierID.ToString().ToInt(0);
                                        }
                                        p.SupplierID = supplierID;
                                        string supplierName = "";
                                        if (!string.IsNullOrEmpty(item.SupplierName))
                                        {
                                            supplierName = item.SupplierName;
                                        }
                                        p.SupplierName = supplierName;
                                        ps.Add(p);
                                    }
                                }
                            }
                        }
                    }
                }
                else
                {
                    var products = ProductController.GetBySKU(textsearch);
                    if (products != null)
                    {
                        var productvariable = ProductVariableController.GetProductID(products.ID);
                        if (productvariable.Count > 0)
                        {
                            foreach (var pv in productvariable)
                            {
                                string SKU   = pv.SKU.Trim().ToUpper();
                                var    check = StockManagerController.GetBySKU(AgentID, SKU);
                                if (check.Count > 0)
                                {
                                    double total = PJUtils.TotalProductQuantityInstock(AgentID, SKU);

                                    if (total > 0)
                                    {
                                        var variables = ProductVariableValueController.GetByProductVariableID(pv.ID);
                                        if (variables.Count > 0)
                                        {
                                            string variablename  = "";
                                            string variablevalue = "";
                                            string variable      = "";

                                            foreach (var v in variables)
                                            {
                                                variable      += v.VariableName.Trim() + ":" + v.VariableValue.Trim() + "|";
                                                variablename  += v.VariableName.Trim() + "|";
                                                variablevalue += v.VariableValue.Trim() + "|";
                                            }

                                            ProductGetOut p = new ProductGetOut();
                                            p.ID                    = pv.ID;
                                            p.ProductName           = products.ProductTitle;
                                            p.ProductVariable       = variable;
                                            p.ProductVariableName   = variablename;
                                            p.ProductVariableValue  = variablevalue;
                                            p.ProductType           = 2;
                                            p.ProductImage          = "<img src=\"" + Thumbnail.getURL(pv.Image, Thumbnail.Size.Small) + "\" style=\"width: 50px\"  />";
                                            p.ProductImageOrigin    = Thumbnail.getURL(pv.Image, Thumbnail.Size.Source);
                                            p.QuantityInstock       = total;
                                            p.QuantityInstockString = string.Format("{0:N0}", total);
                                            p.SKU                   = SKU;
                                            int supplierID = 0;
                                            if (pv.SupplierID != null)
                                            {
                                                supplierID = pv.SupplierID.ToString().ToInt(0);
                                            }
                                            p.SupplierID = supplierID;
                                            string supplierName = "";
                                            if (!string.IsNullOrEmpty(pv.SupplierName))
                                            {
                                                supplierName = pv.SupplierName;
                                            }
                                            p.SupplierName = supplierName;
                                            ps.Add(p);
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            string SKU   = products.ProductSKU.Trim().ToUpper();
                            var    check = StockManagerController.GetBySKU(AgentID, SKU);
                            if (check.Count > 0)
                            {
                                double total = PJUtils.TotalProductQuantityInstock(AgentID, SKU);
                                if (total > 0)
                                {
                                    string variablename  = "";
                                    string variablevalue = "";
                                    string variable      = "";

                                    ProductGetOut p = new ProductGetOut();
                                    p.ID                   = products.ID;
                                    p.ProductName          = products.ProductTitle;
                                    p.ProductVariable      = variable;
                                    p.ProductVariableName  = variablename;
                                    p.ProductVariableValue = variablevalue;
                                    p.ProductType          = 1;
                                    var img = ProductImageController.GetFirstByProductID(products.ID);
                                    p.ProductImage       = "<img src=\"" + Thumbnail.getURL(img.ProductImage, Thumbnail.Size.Small) + "\" style=\"width: 50px\" />";
                                    p.ProductImageOrigin = Thumbnail.getURL(img.ProductImage, Thumbnail.Size.Source);
                                    p.SKU                   = SKU;
                                    p.QuantityInstock       = total;
                                    p.QuantityInstockString = string.Format("{0:N0}", total);
                                    int supplierID = 0;
                                    if (products.SupplierID != null)
                                    {
                                        supplierID = products.SupplierID.ToString().ToInt(0);
                                    }
                                    p.SupplierID = supplierID;
                                    string supplierName = "";
                                    if (!string.IsNullOrEmpty(products.SupplierName))
                                    {
                                        supplierName = products.SupplierName;
                                    }
                                    p.SupplierName = supplierName;
                                    ps.Add(p);
                                }
                            }
                        }
                    }
                    else
                    {
                        var productvariable = ProductVariableController.GetAllBySKU(textsearch);
                        if (productvariable != null)
                        {
                            foreach (var value in productvariable)
                            {
                                string SKU   = value.SKU.Trim().ToUpper();
                                var    check = StockManagerController.GetBySKU(AgentID, SKU);
                                if (check.Count > 0)
                                {
                                    double total = PJUtils.TotalProductQuantityInstock(AgentID, SKU);
                                    if (total > 0)
                                    {
                                        var variables = ProductVariableValueController.GetByProductVariableID(value.ID);

                                        if (variables.Count > 0)
                                        {
                                            string variablename  = "";
                                            string variablevalue = "";
                                            string variable      = "";

                                            foreach (var v in variables)
                                            {
                                                variable      += v.VariableName + ":" + v.VariableValue + "|";
                                                variablename  += v.VariableName + "|";
                                                variablevalue += v.VariableValue + "|";
                                            }

                                            ProductGetOut p = new ProductGetOut();
                                            p.ID = value.ID;
                                            var product = ProductController.GetByID(Convert.ToInt32(value.ProductID));
                                            if (product != null)
                                            {
                                                p.ProductName = product.ProductTitle;
                                            }
                                            p.ProductVariable      = variable;
                                            p.ProductVariableName  = variablename;
                                            p.ProductVariableValue = variablevalue;
                                            p.ProductType          = 2;
                                            p.ProductImage         = "<img src=\"" + Thumbnail.getURL(value.Image, Thumbnail.Size.Small) + "\" style=\"width:50px;\" />";
                                            p.ProductImageOrigin   = Thumbnail.getURL(value.Image, Thumbnail.Size.Small);
                                            p.SKU                   = value.SKU.Trim().ToUpper();
                                            p.QuantityInstock       = total;
                                            p.QuantityInstockString = string.Format("{0:N0}", total);
                                            int supplierID = 0;
                                            if (value.SupplierID != null)
                                            {
                                                supplierID = value.SupplierID.ToString().ToInt(0);
                                            }
                                            p.SupplierID = supplierID;
                                            string supplierName = "";
                                            if (!string.IsNullOrEmpty(value.SupplierName))
                                            {
                                                supplierName = value.SupplierName;
                                            }
                                            p.SupplierName = supplierName;
                                            ps.Add(p);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            JavaScriptSerializer serializer = new JavaScriptSerializer();

            return(serializer.Serialize(ps));
        }
コード例 #4
0
        public static string getProduct(string textsearch)
        {
            List <ProductGetOut> ps = new List <ProductGetOut>();
            string username         = HttpContext.Current.Request.Cookies["usernameLoginSystem"].Value;
            var    acc = AccountController.GetByUsername(username);

            if (acc != null)
            {
                int AgentID  = Convert.ToInt32(acc.AgentID);
                var products = ProductController.GetBySKU(textsearch.Trim().ToUpper());

                if (products != null)
                {
                    var productvariable = ProductVariableController.GetByParentSKU(products.ProductSKU);

                    if (productvariable.Count > 0)
                    {
                        foreach (var pv in productvariable)
                        {
                            var variables = ProductVariableValueController.GetByProductVariableSKU(pv.SKU);

                            if (variables.Count > 0)
                            {
                                string variablename  = "";
                                string variablevalue = "";
                                string variable      = "";

                                foreach (var v in variables)
                                {
                                    variable      += v.VariableName.Trim() + ": " + v.VariableValue.Trim() + "|";
                                    variablename  += v.VariableName.Trim() + "|";
                                    variablevalue += v.VariableValue.Trim() + "|";
                                }

                                ProductGetOut p = new ProductGetOut();
                                p.ID                   = pv.ID;
                                p.ProductName          = products.ProductTitle;
                                p.ProductVariable      = variable;
                                p.ProductVariableName  = variablename;
                                p.ProductVariableValue = variablevalue;
                                p.ProductType          = 2;

                                p.ProductImage       = "<img onclick='openImage($(this))' src='" + Thumbnail.getURL(pv.Image, Thumbnail.Size.Normal) + "'>";
                                p.ProductImageOrigin = Thumbnail.getURL(pv.Image, Thumbnail.Size.Source);

                                p.SKU = pv.SKU.Trim().ToUpper();

                                int supplierID = 0;
                                if (pv.SupplierID != null)
                                {
                                    supplierID = pv.SupplierID.ToString().ToInt(0);
                                }
                                p.SupplierID = supplierID;

                                string supplierName = "";

                                if (!string.IsNullOrEmpty(pv.SupplierName))
                                {
                                    supplierName = pv.SupplierName;
                                }
                                p.SupplierName = supplierName;

                                double total = PJUtils.TotalProductQuantityInstock(AgentID, pv.SKU);
                                p.WarehouseQuantity = string.Format("{0:N0}", total);
                                ps.Add(p);
                            }
                        }
                    }
                    else
                    {
                        string variablename  = "";
                        string variablevalue = "";
                        string variable      = "";

                        ProductGetOut p = new ProductGetOut();
                        p.ID                   = products.ID;
                        p.ProductName          = products.ProductTitle;
                        p.ProductVariable      = variable;
                        p.ProductVariableName  = variablename;
                        p.ProductVariableValue = variablevalue;
                        p.ProductType          = 1;

                        p.ProductImage       = "<img onclick='openImage($(this))' src='" + Thumbnail.getURL(products.ProductImage, Thumbnail.Size.Normal) + "'>";
                        p.ProductImageOrigin = Thumbnail.getURL(products.ProductImage, Thumbnail.Size.Source);

                        p.SKU = products.ProductSKU.Trim().ToUpper();
                        int supplierID = 0;
                        if (products.SupplierID != null)
                        {
                            supplierID = products.SupplierID.ToString().ToInt(0);
                        }
                        p.SupplierID = supplierID;
                        string supplierName = "";
                        if (!string.IsNullOrEmpty(products.SupplierName))
                        {
                            supplierName = products.SupplierName;
                        }
                        p.SupplierName = supplierName;

                        double total = PJUtils.TotalProductQuantityInstock(AgentID, products.ProductSKU);

                        p.WarehouseQuantity = string.Format("{0:N0}", total);
                        ps.Add(p);
                    }
                }
                else
                {
                    var productvariable = ProductVariableController.GetAllBySKU(textsearch.Trim().ToUpper());

                    if (productvariable != null)
                    {
                        foreach (var value in productvariable)
                        {
                            var variables = ProductVariableValueController.GetByProductVariableSKU(value.SKU);

                            if (variables.Count > 0)
                            {
                                string variablename  = "";
                                string variablevalue = "";
                                string variable      = "";

                                foreach (var v in variables)
                                {
                                    variable      += v.VariableName + ": " + v.VariableValue + "|";
                                    variablename  += v.VariableName + "|";
                                    variablevalue += v.VariableValue + "|";
                                }

                                ProductGetOut p = new ProductGetOut();
                                p.ID = value.ID;

                                var product = ProductController.GetBySKU(value.ParentSKU);
                                if (product != null)
                                {
                                    p.ProductName = product.ProductTitle;
                                }

                                p.ProductVariable      = variable;
                                p.ProductVariableName  = variablename;
                                p.ProductVariableValue = variablevalue;
                                p.ProductType          = 2;

                                p.ProductImage       = "<img onclick='openImage($(this))' src='" + Thumbnail.getURL(value.Image, Thumbnail.Size.Normal) + "'>";
                                p.ProductImageOrigin = Thumbnail.getURL(value.Image, Thumbnail.Size.Source);

                                p.SKU = value.SKU.Trim().ToUpper();
                                int supplierID = 0;
                                if (value.SupplierID != null)
                                {
                                    supplierID = value.SupplierID.ToString().ToInt(0);
                                }
                                p.SupplierID = supplierID;
                                string supplierName = "";
                                if (!string.IsNullOrEmpty(value.SupplierName))
                                {
                                    supplierName = value.SupplierName;
                                }
                                p.SupplierName = supplierName;

                                double total = PJUtils.TotalProductQuantityInstock(AgentID, value.SKU);

                                p.WarehouseQuantity = string.Format("{0:N0}", total);
                                ps.Add(p);
                            }
                        }
                    }
                }
            }
            JavaScriptSerializer serializer = new JavaScriptSerializer();

            return(serializer.Serialize(ps));
        }