예제 #1
0
        public static string copyProductInfo(int id)
        {
            var product = ProductController.GetByID(id);
            StringBuilder html = new StringBuilder();
            if (product != null)
            {
                html.Append("<p>" + product.ProductSKU + " - Sỉ " + (product.Regular_Price / 1000).ToString() + "k - " + product.ProductTitle + "</p>\r\n");
                html.Append("<p></p>\r\n");
                html.Append("<p>📌 Giá sỉ: " + (product.Regular_Price / 1000).ToString() + "k</p>\r\n");
                html.Append("<p></p>\r\n");
                html.Append("<p>📌 Giá lẻ: " + ((product.Retail_Price + 25000) / 1000).ToString() + "k</p>\r\n");
                html.Append("<p></p>\r\n");

                if (!string.IsNullOrEmpty(product.Materials))
                {
                    html.Append("<p>🔖 Chất liệu: " + product.Materials + "</p>\r\n");
                    html.Append("<p></p>\r\n");
                }

                if (!string.IsNullOrEmpty(product.ProductContent))
                {
                    html.Append("<p>🔖 Mô tả: " + product.ProductContent + "</p>\r\n");
                    html.Append("<p></p>\r\n");
                }

                // liệt kê thuộc tính sản phẩm

                List<ProductVariable> variableTemp = new List<ProductVariable>();

                List<tbl_ProductVariable> v = new List<tbl_ProductVariable>();

                v = ProductVariableController.SearchProductID(id, "");

                string Variable = "";
                if (v.Count > 0)
                {
                    for (int i = 0; i < v.Count; i++)
                    {
                        var item = v[i];
                        var value = ProductVariableValueController.GetByProductVariableIDSortByName(item.ID);
                        if (value != null)
                        {
                            for (int j = 0; j < value.Count; j++)
                            {
                                variableTemp.Add(new ProductVariable() { VariableName = value[j].VariableName, VariableValue = value[j].VariableValue });

                            }
                        }
                    }
                    var vari = variableTemp.GroupBy(x => new { x.VariableName, x.VariableValue }).Select(x => new { VariableName = x.Key.VariableName, VariableValue = x.Key.VariableValue }).OrderBy(x => x.VariableName).ToList();

                    string stringVariable = vari[0].VariableName;

                    Variable = "<p><strong>📚 " + vari[0].VariableName + "</strong>: ";

                    for (int y = 0; y < vari.Count; y++)
                    {
                        if (stringVariable == vari[y].VariableName)
                        {
                            Variable += vari[y].VariableValue + "; ";
                        }
                        else
                        {
                            Variable += "</p>\r\n";
                            Variable += "<p></p>\r\n";
                            Variable += "<p><strong>📐 " + vari[y].VariableName + "</strong>: " + vari[y].VariableValue + "; ";
                            stringVariable = vari[y].VariableName;
                        }
                    }

                    html.Append(Variable);
                }

                // thông tin liên hệ
                html.Append("<p></p>\r\n");
                html.Append("<p></p>\r\n");
                html.Append("<p>-----------------------------------------------------------</p>\r\n");
                html.Append("<p></p>\r\n");
                html.Append("<p>⚡⚡ Hàng có sẵn tại KHO HÀNG SỈ ANN ⚡⚡</p>\r\n");
                html.Append("<p></p>\r\n");
                html.Append("<p>🏭 68 Đường C12, P.13, Tân Bình, TP.HCM</p>\r\n");
                html.Append("<p></p>\r\n");
                html.Append("<p>⭐ Web: ANN.COM.VN</p>\r\n");
                html.Append("<p></p>\r\n");
                html.Append("<p>⭐ Zalo đặt hàng: 0936786404 - 0913268406 - 0918567409</p>\r\n");
                html.Append("<p></p>\r\n");
                html.Append("<p>⭐ Facebook: https://facebook.com/bosiquanao.net </p>\r\n");
                html.Append("<p></p>\r\n");
                html.Append("<p>⭐ Zalo xem Quần Áo Nam: 0977399405 (Zalo này không trả lời tin nhắn)</p>\r\n");
                html.Append("<p></p>\r\n");
                html.Append("<p>⭐ Zalo xem Đồ Bộ Nữ: 0975442402 (Zalo này không trả lời tin nhắn)</p>\r\n");
                html.Append("<p></p>\r\n");
                html.Append("<p>⭐ Zalo xem Váy Đầm - Áo Nữ - Quần Nữ: 0987409403 (Zalo này không trả lời tin nhắn)</p>\r\n");
                html.Append("<p></p>\r\n");

            }

            return html.ToString();
        }
예제 #2
0
        public static string copyProductInfo(int id)
        {
            var           product = ProductController.GetByID(id);
            StringBuilder html    = new StringBuilder();

            if (product != null)
            {
                html.AppendLine("<p>" + product.ProductSKU + " - " + product.ProductTitle + "</p>\r\n");
                html.AppendLine("<p>📌 Sỉ: " + (product.Regular_Price / 1000).ToString() + "k</p>\r\n");
                html.AppendLine("<p>📌 Lẻ: " + (product.Retail_Price / 1000).ToString() + "k</p>\r\n");

                if (!string.IsNullOrEmpty(product.Materials))
                {
                    html.AppendLine("<p>🔖 " + (product.CategoryID == 44 ? "" : "Chất liệu: ") + product.Materials + "</p>\r\n");
                }

                if (!string.IsNullOrEmpty(product.ProductContent))
                {
                    string content = Regex.Replace(product.ProductContent, @"<img\s[^>]*>(?:\s*?</img>)?", "").ToString();
                    html.AppendLine("<p>🔖 " + content + "</p>\r\n");
                }

                // liệt kê thuộc tính sản phẩm

                List <ProductVariable> variableTemp = new List <ProductVariable>();

                List <tbl_ProductVariable> v = new List <tbl_ProductVariable>();

                v = ProductVariableController.SearchProductID(id, "");

                string Variable = "";
                if (v.Count > 0)
                {
                    for (int i = 0; i < v.Count; i++)
                    {
                        var item  = v[i];
                        var value = ProductVariableValueController.GetByProductVariableIDSortByName(item.ID);
                        if (value != null)
                        {
                            for (int j = 0; j < value.Count; j++)
                            {
                                variableTemp.Add(new ProductVariable()
                                {
                                    VariableName = value[j].VariableName, VariableValue = value[j].VariableValue
                                });
                            }
                        }
                    }
                    var vari = variableTemp
                               .GroupBy(x => new { x.VariableName, x.VariableValue })
                               .Select(x => new { VariableName = x.Key.VariableName, VariableValue = x.Key.VariableValue })
                               .OrderBy(x => x.VariableName)
                               .ToList();

                    string stringVariable = vari[0].VariableName;

                    Variable = "<p><strong>📚 " + vari[0].VariableName + "</strong>: ";

                    int count = 0;

                    for (int y = 0; y < vari.Count; y++)
                    {
                        if (stringVariable == vari[y].VariableName)
                        {
                            if (vari[y].VariableValue.IndexOf("Mẫu") >= 0)
                            {
                                count = count + 1;

                                if (y == (vari.Count - 1))
                                {
                                    Variable += count.ToString() + " mẫu khác nhau";
                                }
                            }
                            else
                            {
                                Variable += vari[y].VariableValue + "; ";
                            }
                        }
                        else
                        {
                            if (count > 0)
                            {
                                Variable += count.ToString() + " mẫu khác nhau";
                            }
                            Variable      += "</p>\r\n";
                            Variable      += "<p><strong>📐 " + vari[y].VariableName + "</strong>: " + vari[y].VariableValue + "; ";
                            stringVariable = vari[y].VariableName;
                        }
                    }

                    html.AppendLine(Variable);
                }

                html.AppendLine("<p></p>\r\n");
            }

            return(html.ToString());
        }