public void LoadData() { string s = ""; if (Request.QueryString["s"] != null) { s = Request.QueryString["s"]; } List <tbl_ProductVariable> a = new List <tbl_ProductVariable>(); int productID = Request.QueryString["id"].ToInt(0); if (productID > 0) { ViewState["ID"] = productID; var product = ProductController.GetByID(productID); if (product != null) { ViewState["ProductName"] = product.ProductTitle; var cate = CategoryController.GetByID(Convert.ToInt32(product.CategoryID)); lblCategoryName.Text = product.ProductTitle; ltrAddnew.Text = "<a href=\"/them-thuoc-tinh-san-pham?productid=" + productID + "\" class=\"h45-btn primary-btn btn\">Thêm mới</a>"; } a = ProductVariableController.SearchProductID(productID, s); pagingall(a); } }
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(); }
public void LoadData() { int id = Request.QueryString["id"].ToInt(0); if (id > 0) { var p = ProductController.GetByID(id); if (p == null) { PJUtils.ShowMessageBoxSwAlertError("Không tìm thấy sản phẩm " + id, "e", true, "/sp", Page); } else { this.Title = String.Format("{0} - {1}", p.ProductTitle.ToTitleCase(), p.ProductSKU); ViewState["ID"] = id; ViewState["cateID"] = p.CategoryID; ViewState["SKU"] = p.ProductSKU; ltrProductName.Text = p.ProductSKU + " - " + p.ProductTitle; // Create order fileter var filter = new ProductFilterModel() { search = p.ProductSKU }; // Create pagination var page = new PaginationMetadataModel(); var a = ProductController.GetAllSql(filter, ref page); if (page.totalCount > 0) { foreach (var item in a) { string StockStatus = ""; if (item.StockStatus == 1) { StockStatus = "Còn hàng"; } else { StockStatus = "Hết hàng"; } ltrProductStock.Text = "<p><strong>✱ Kho</strong>: " + StockStatus + " (" + item.TotalProductInstockQuantityLeft.ToString() + " cái)</p>"; } } else { ltrProductStock.Text = "<p><strong>✱ Kho</strong>: Đang nhập hàng</p>"; } ltrRegularPrice.Text = "<p><strong>📌 Giá sỉ</strong>: " + (p.Regular_Price / 1000).ToString() + "k</p>"; ltrRetailPrice.Text = "<p><strong>📌 Giá lẻ</strong>: " + ((p.Retail_Price + 20000) / 1000).ToString() + "k</p>"; if (!string.IsNullOrEmpty(p.Materials)) { ltrMaterials.Text = "<p><strong>🔖 Chất liệu</strong>: " + p.Materials + "</p>"; } if (!string.IsNullOrEmpty(p.ProductContent)) { string content = Regex.Replace(p.ProductContent, @"<img\s[^>]*>(?:\s*?</img>)?", "").ToString(); ltrContent.Text = "<p><strong>🔖 Mô tả</strong>: " + content + "</p>"; } if (p.ProductImage != null) { ProductThumbnail.Text = "<p><img src='" + Thumbnail.getURL(p.ProductImage, Thumbnail.Size.Large) + "'><a href='" + Thumbnail.getURL(p.ProductImage, Thumbnail.Size.Source) + "' download class='btn download-btn download-image h45-btn'><i class='fa fa-cloud-download'></i> Tải hình này</a></p>"; } var image = ProductImageController.GetByProductID(id); if (image != null) { foreach (var img in image) { if (img.ProductImage != p.ProductImage) { imageGallery.Text += "<p><img src='" + Thumbnail.getURL(img.ProductImage, Thumbnail.Size.Large) + "'><a href='" + Thumbnail.getURL(img.ProductImage, Thumbnail.Size.Source) + "' download class='btn download-btn download-image h45-btn'><i class='fa fa-cloud-download'></i> Tải hình này</a></p>"; } } } var v = ProductVariableController.SearchProductID(id, ""); string css = "col-xs-6"; if (v.Count > 0) { css = "col-xs-4"; } StringBuilder htmlButton = new StringBuilder(); htmlButton.Append("<div class='" + css + "'>"); htmlButton.Append(" <div class='row'>"); htmlButton.Append(" <p><a href='javascript:;' class='btn primary-btn copy-btn h45-btn' onclick='copyProduct(`" + p.ID + "`);'><i class='fa fa-files-o' aria-hidden='true'></i> Copy</a></p>"); htmlButton.Append(" </div>"); htmlButton.Append("</div>"); if (v.Count > 0) { htmlButton.Append("<div class='" + css + "'>"); htmlButton.Append(" <div class='row'>"); htmlButton.Append(" <p><a href='#variableTable' class='btn download-btn h45-btn'><i class='fa fa-list-ul' aria-hidden='true'></i> Biến thể</a></p>"); htmlButton.Append(" </div>"); htmlButton.Append("</div>"); ltrVariableList.Text = "<h3><i class='fa fa-list-ul' aria-hidden='true'></i> Danh sách biến thể</h3>"; pagingall(v); } htmlButton.Append("<div class='" + css + "'>"); htmlButton.Append(" <div class='row'>"); htmlButton.Append(" <a href='javascript:;' class='btn primary-btn h45-btn' onclick='getAllProductImage(`" + p.ProductSKU + "`);'><i class='fa fa-cloud-download' aria-hidden='true'></i> Tải hình</a>"); htmlButton.Append(" </div>"); htmlButton.Append("</div>"); ltrButton.Text = htmlButton.ToString(); } } }
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()); }
public void LoadData() { string username = HttpContext.Current.Request.Cookies["usernameLoginSystem"].Value; var acc = AccountController.GetByUsername(username); int id = Request.QueryString["id"].ToInt(0); string sku = Request.QueryString["sku"]; var p = new tbl_Product(); if (id > 0) { p = ProductController.GetByID(id); } else if (id == 0) { int variableid = Request.QueryString["variableid"].ToInt(0); if (variableid != 0) { p = ProductController.GetByVariableID(variableid); } else { if (sku != "") { p = ProductController.GetBySKU(sku); if (p == null) { p = ProductController.GetByVariableSKU(sku); } } } } if (p == null) { PJUtils.ShowMessageBoxSwAlertError("Không tìm thấy sản phẩm " + id, "e", true, "/tat-ca-san-pham", Page); } else { this.Title = String.Format("{0} - Sản phẩm", p.ProductSKU.ToTitleCase()); ViewState["ID"] = id; ViewState["cateID"] = p.CategoryID; ViewState["SKU"] = p.ProductSKU; ltrEdit1.Text = ""; if (acc.RoleID == 0 || acc.RoleID == 1 || acc.Username == "nhom_zalo502") { ltrEdit1.Text += "<a href='/thong-tin-san-pham?id=" + p.ID + "' class='btn primary-btn fw-btn not-fullwidth'><i class='fa fa-pencil-square-o' aria-hidden='true'></i> Chỉnh sửa</a>"; ltrEdit1.Text += "<a href='/tao-san-pham' class='btn primary-btn fw-btn not-fullwidth print-invoice-merged'><i class='fa fa-file-text-o' aria-hidden='true'></i> Thêm mới</a>"; if (p.ShowHomePage == 1) { ltrEdit1.Text += "<a href='javascript:;' onclick='showProductSyncModal(`" + p.ProductSKU + "`, " + p.ID + ", " + p.CategoryID + ");' class='btn primary-btn not-fullwidth print-invoice-merged'><i class='fa fa-upload' aria-hidden='true'></i> Đồng bộ</a>"; } } ltrEdit1.Text += "<a href='javascript:;' onclick='copyProductInfo(" + p.ID + ")' class='btn primary-btn not-fullwidth print-invoice-merged'><i class='fa fa-files-o'></i> Copy thông tin</a>"; ltrEdit1.Text += "<a href='javascript:;' onclick='getAllProductImage(`" + p.ProductSKU + "`);' class='btn primary-btn not-fullwidth print-invoice-merged'><i class='fa fa-cloud-download'></i> Tải tất cả hình ảnh</a>"; if (acc.RoleID == 0 || acc.Username == "nhom_zalo502") { ltrEdit1.Text += "<a href='javascript:;' onclick='deleteProduct(" + p.ID + ");' class='btn primary-btn not-fullwidth print-invoice-merged btn-red'><i class='fa fa-times'></i> Xóa sản phẩm</a>"; ltrEdit1.Text += "<a href='javascript:;' data-toggle='modal' data-target='#modalUpdateProductSKU' data-backdrop='static' data-keyboard='false' class='btn primary-btn not-fullwidth print-invoice-merged btn-blue'><i class='fa fa-times'></i> Sửa mã sản phẩm</a>"; } ltrEdit2.Text = ltrEdit1.Text; lbProductTitle.Text = p.ProductTitle; pContent.Text = p.ProductContent; lblSKU.Text = p.ProductSKU; txtOldSKU.Text = p.ProductSKU; // Create order fileter var filter = new ProductFilterModel() { search = p.ProductSKU }; // Create pagination var page = new PaginationMetadataModel(); var a = ProductController.GetAllSql(filter, ref page); if (page.totalCount > 0) { foreach (var item in a) { lbProductStock.Text = item.TotalProductInstockQuantityLeft.ToString(); ddlStockStatus.SelectedValue = item.StockStatus.ToString(); } } else { lbProductStock.Text = "0"; } lbOldPrice.Text = string.Format("{0:N0}", p.Old_Price); lbRegularPrice.Text = string.Format("{0:N0}", p.Regular_Price); ltrCostOfGood.Text = ""; if (acc.RoleID == 0) { ltrCostOfGood.Text += "<div class='form-row'>"; ltrCostOfGood.Text += " <div class='row-left'>"; ltrCostOfGood.Text += " Giá vốn"; ltrCostOfGood.Text += " </div>"; ltrCostOfGood.Text += " <div class='row-right'>"; ltrCostOfGood.Text += " <span class='form-control'>" + string.Format("{0:N0}", p.CostOfGood) + "</span>"; ltrCostOfGood.Text += " </div>"; ltrCostOfGood.Text += "</div>"; } lbRetailPrice.Text = string.Format("{0:N0}", p.Retail_Price); ddlSupplier.SelectedValue = p.SupplierID.ToString(); ddlCategory.SelectedValue = p.CategoryID.ToString(); lbMaterials.Text = p.Materials; lbColor.Text = p.Color; // Hàng order ddlPreOrder.SelectedValue = p.PreOrder ? "1" : "0"; // thư viện ảnh var image = ProductImageController.GetByProductID(id); imageGallery.Text = "<ul class='image-gallery'>"; imageGallery.Text += "<li><img src='" + Thumbnail.getURL(p.ProductImage, Thumbnail.Size.Normal) + "'><a href='" + Thumbnail.getURL(p.ProductImage, Thumbnail.Size.Source) + "' download class='btn download-btn download-image h45-btn'><i class='fa fa-cloud-download'></i> Tải hình này</a></li>"; if (image != null) { foreach (var img in image) { if (img.ProductImage != p.ProductImage) { imageGallery.Text += "<li><img src='" + Thumbnail.getURL(img.ProductImage, Thumbnail.Size.Normal) + "'><a href='" + Thumbnail.getURL(img.ProductImage, Thumbnail.Size.Source) + "' download class='btn download-btn download-image h45-btn'><i class='fa fa-cloud-download'></i> Tải hình này</a></li>"; } } } imageGallery.Text += "</ul>"; hdfTable.Value = p.ProductStyle.ToString(); // Init Tag var tagIDList = ProductTagController.get(p.ID, 0) .Select(x => x.name) .ToList(); hdfTags.Value = String.Join(",", tagIDList); List <tbl_ProductVariable> b = new List <tbl_ProductVariable>(); b = ProductVariableController.SearchProductID(p.ID, ""); if (b != null) { pagingall(b, Convert.ToInt32(acc.RoleID)); } } }
public void LoadData(int userRole) { int id = Request.QueryString["id"].ToInt(0); var p = new tbl_Product(); if (id > 0) { p = ProductController.GetByID(id); } else if (id == 0) { int variableid = Request.QueryString["variableid"].ToInt(0); p = ProductController.GetByVariableID(variableid); } if (p == null) { PJUtils.ShowMessageBoxSwAlertError("Không tìm thấy sản phẩm " + id, "e", true, "/tat-ca-san-pham", Page); } else { ViewState["ID"] = id; ViewState["cateID"] = p.CategoryID; ViewState["SKU"] = p.ProductSKU; ltrEdit1.Text = ""; if (Convert.ToInt32(ViewState["role"]) == 0 || Convert.ToInt32(ViewState["role"]) == 1) { ltrEdit1.Text += "<a href=\"/thong-tin-san-pham?id=" + p.ID + "\" class=\"btn primary-btn fw-btn not-fullwidth\"><i class=\"fa fa-pencil-square-o\" aria-hidden=\"true\"></i> Chỉnh sửa</a>"; ltrEdit1.Text += "<a href=\"/tao-san-pham\" class=\"btn primary-btn fw-btn not-fullwidth print-invoice-merged\"><i class=\"fa fa-file-text-o\" aria-hidden=\"true\"></i> Thêm mới</a>"; ltrEdit1.Text += "<a href=\"javascript:;\" onclick=\"ShowUpProductToWeb('" + p.ProductSKU + "', '" + p.ID + "', 'false', 'false');\" class=\"up-product-" + p.ID + " btn primary-btn not-fullwidth print-invoice-merged " + (p.ShowHomePage == 1 ? "" : "hide") + "\"><i class=\"fa fa-upload\" aria-hidden=\"true\"></i> Đồng bộ</a>"; } ltrEdit1.Text += "<a href=\"javascript:;\" onclick=\"copyProductInfo(" + p.ID + ")\" class=\"btn primary-btn not-fullwidth print-invoice-merged\"><i class=\"fa fa-files-o\"></i> Copy thông tin</a>"; ltrEdit1.Text += "<a href=\"javascript:;\" onclick=\"getAllProductImage('" + p.ProductSKU + "');\" class=\"btn primary-btn not-fullwidth print-invoice-merged\"><i class=\"fa fa-cloud-download\"></i> Tải tất cả hình ảnh</a>"; ltrEdit2.Text = ltrEdit1.Text; lbProductTitle.Text = p.ProductTitle; pContent.Text = p.ProductContent; lblSKU.Text = p.ProductSKU; var a = ProductController.GetAllSql(0, p.ProductSKU); if (a.Count() > 0) { foreach (var item in a) { lbProductStock.Text = item.TotalProductInstockQuantityLeft.ToString(); ddlStockStatus.SelectedValue = item.StockStatus.ToString(); } } else { lbProductStock.Text = "0"; } lbRegularPrice.Text = string.Format("{0:N0}", p.Regular_Price); ltrCostOfGood.Text = ""; if (userRole == 0) { ltrCostOfGood.Text += "<div class='form-row'>"; ltrCostOfGood.Text += " <div class='row-left'>"; ltrCostOfGood.Text += " Giá vốn"; ltrCostOfGood.Text += " </div>"; ltrCostOfGood.Text += " <div class='row-right'>"; ltrCostOfGood.Text += " <span class='form-control'>" + string.Format("{0:N0}", p.CostOfGood) + "</span>"; ltrCostOfGood.Text += " </div>"; ltrCostOfGood.Text += "</div>"; } lbRetailPrice.Text = string.Format("{0:N0}", p.Retail_Price); ddlSupplier.SelectedValue = p.SupplierID.ToString(); ddlCategory.SelectedValue = p.CategoryID.ToString(); lbMaterials.Text = p.Materials; // thư viện ảnh var image = ProductImageController.GetByProductID(id); imageGallery.Text = "<ul class=\"image-gallery\">"; imageGallery.Text += "<li><img src=\"" + p.ProductImage + "\" /><a href='" + p.ProductImage + "' download class='btn download-btn download-image h45-btn'><i class='fa fa-cloud-download'></i> Tải hình này</a></li>"; if (image != null) { foreach (var img in image) { if (img.ProductImage != p.ProductImage) { imageGallery.Text += "<li><img src=\"" + img.ProductImage + "\" /><a href='" + img.ProductImage + "' download class='btn download-btn download-image h45-btn'><i class='fa fa-cloud-download'></i> Tải hình này</a></li>"; } } } imageGallery.Text += "</ul>"; hdfTable.Value = p.ProductStyle.ToString(); } List <tbl_ProductVariable> b = new List <tbl_ProductVariable>(); b = ProductVariableController.SearchProductID(p.ID, ""); pagingall(b, userRole); }
public void LoadData() { int id = Request.QueryString["id"].ToInt(0); if (id > 0) { var p = ProductController.GetByID(id); if (p == null) { PJUtils.ShowMessageBoxSwAlertError("Không tìm thấy sản phẩm " + id, "e", true, "/sp", Page); } else { ViewState["ID"] = id; ViewState["cateID"] = p.CategoryID; ViewState["SKU"] = p.ProductSKU; ltrProductName.Text = p.ProductSKU + " - " + p.ProductTitle; var a = ProductController.GetAllSql(0, p.ProductSKU); if (a.Count() > 0) { foreach (var item in a) { string StockStatus = ""; if (item.StockStatus == 1) { StockStatus = "Còn hàng"; } else { StockStatus = "Hết hàng"; } ltrProductStock.Text = "<p><strong>✱ Kho</strong>: " + StockStatus + " (" + item.TotalProductInstockQuantityLeft.ToString() + " cái)</p>"; } } else { ltrProductStock.Text = "<p><strong>✱ Kho</strong>: Đang nhập hàng</p>"; } ltrRegularPrice.Text = "<p><strong>📌 Giá sỉ</strong>: " + (p.Regular_Price / 1000).ToString() + "k</p>"; ltrRetailPrice.Text = "<p><strong>📌 Giá lẻ</strong>: " + ((p.Retail_Price + 20000) / 1000).ToString() + "k</p>"; if (!string.IsNullOrEmpty(p.Materials)) { ltrMaterials.Text = "<p><strong>🔖 Chất liệu</strong>: " + p.Materials + "</p>"; } if (!string.IsNullOrEmpty(p.ProductContent)) { ltrContent.Text = "<p><strong>🔖 Mô tả</strong>: " + p.ProductContent + "</p>"; } if (p.ProductImage != null) { ProductThumbnail.Text = "<p><img src=\"" + p.ProductImage + "\" /><a href='" + p.ProductImage + "' download class='btn download-btn download-image h45-btn'><i class='fa fa-cloud-download'></i> Tải hình này</a></p>"; } var image = ProductImageController.GetByProductID(id); if (image != null) { foreach (var img in image) { if (img.ProductImage != p.ProductImage) { imageGallery.Text += "<p><img src=\"" + img.ProductImage + "\" /><a href='" + img.ProductImage + "' download class='btn download-btn download-image h45-btn'><i class='fa fa-cloud-download'></i> Tải hình này</a></p>"; } } } ltrCopyProductInfoButton.Text = "<p><a href=\"javascript:;\" class=\"btn primary-btn copy-btn h45-btn\" onclick=\"copyProduct(" + p.ID + ")\"><i class=\"fa fa-files-o\" aria-hidden=\"true\"></i> Copy</a></p>"; ltrDownloadProductImageButton.Text = "<a href =\"javascript:;\" class=\"btn primary-btn h45-btn\" onclick=\"getAllProductImage('" + p.ProductSKU + "');\"><i class=\"fa fa-cloud-download\" aria-hidden=\"true\"></i> Tải hình</a>"; var v = ProductVariableController.SearchProductID(id, ""); if (v.Count > 0) { ltrViewVariableListButton.Text = "<p><a href='#variableTable' class='btn download-btn h45-btn'><i class='fa fa-list-ul' aria-hidden='true'></i> Biến thể</a></p>"; ltrVariableList.Text = "<h3><i class='fa fa-list-ul' aria-hidden='true'></i> Danh sách biến thể</h3>"; pagingall(v); } } } }
public void LoadData() { int id = Request.QueryString["id"].ToInt(0); if (id > 0) { var p = ProductController.GetByID(id); if (p == null) { PJUtils.ShowMessageBoxSwAlertError("Không tìm thấy sản phẩm", "e", true, "/", Page); } else { if (p.CategoryID != 44) { PJUtils.ShowMessageBoxSwAlertError("Không tìm thấy sản phẩm", "e", true, "/", Page); } this.Title = String.Format("{0} - {1}", p.ProductTitle.ToTitleCase(), p.ProductSKU); ViewState["ID"] = id; ViewState["cateID"] = p.CategoryID; ViewState["SKU"] = p.ProductSKU; ltrProductName.Text = p.ProductSKU + " - " + p.ProductTitle; ltrRegularPrice.Text = "<p><strong>📌 Giá sỉ</strong>: " + (p.Regular_Price / 1000).ToString() + "k</p>"; ltrRetailPrice.Text = "<p><strong>📌 Giá lẻ</strong>: " + (p.Retail_Price / 1000).ToString() + "k</p>"; if (!string.IsNullOrEmpty(p.Materials)) { ltrContent.Text += "<p>" + p.Materials + "</p>"; } if (!string.IsNullOrEmpty(p.ProductContent)) { string content = Regex.Replace(p.ProductContent, @"<img\s[^>]*>(?:\s*?</img>)?", "").ToString(); ltrContent.Text += "<p>" + content + "</p>"; } if (p.ProductImage != null) { ProductThumbnail.Text = "<p><img src='" + Thumbnail.getURL(p.ProductImage, Thumbnail.Size.Source) + "'><a href='" + Thumbnail.getURL(p.ProductImage, Thumbnail.Size.Source) + "' download class='btn download-btn download-image h45-btn'><i class='fa fa-cloud-download'></i> Tải hình này</a></p>"; } var image = ProductImageController.GetByProductID(id); if (image != null) { foreach (var img in image) { if (img.ProductImage != p.ProductImage) { imageGallery.Text += "<p><img src='" + Thumbnail.getURL(img.ProductImage, Thumbnail.Size.Source) + "'><a href='" + Thumbnail.getURL(img.ProductImage, Thumbnail.Size.Source) + "' download class='btn download-btn download-image h45-btn'><i class='fa fa-cloud-download'></i> Tải hình này</a></p>"; } } } var v = ProductVariableController.SearchProductID(id, ""); string css = "col-xs-6"; if (v.Count > 0) { css = "col-xs-4"; } StringBuilder htmlButton = new StringBuilder(); htmlButton.Append("<div class='" + css + "'>"); htmlButton.Append(" <div class='row'>"); htmlButton.Append(" <p><a href='javascript:;' class='btn primary-btn copy-btn h45-btn' onclick='copyProduct(`" + p.ID + "`);'><i class='fa fa-files-o' aria-hidden='true'></i> Copy mô tả</a></p>"); htmlButton.Append(" </div>"); htmlButton.Append("</div>"); if (v.Count > 0) { htmlButton.Append("<div class='" + css + "'>"); htmlButton.Append(" <div class='row'>"); htmlButton.Append(" <p><a href='#variableTable' class='btn download-btn h45-btn'><i class='fa fa-list-ul' aria-hidden='true'></i> Biến thể</a></p>"); htmlButton.Append(" </div>"); htmlButton.Append("</div>"); ltrVariableList.Text = "<h3><i class='fa fa-list-ul' aria-hidden='true'></i> Danh sách biến thể</h3>"; pagingall(v); } htmlButton.Append("<div class='" + css + "'>"); htmlButton.Append(" <div class='row'>"); htmlButton.Append(" <a href='javascript:;' class='btn primary-btn h45-btn' onclick='getAllProductImage(`" + p.ProductSKU + "`);'><i class='fa fa-cloud-download' aria-hidden='true'></i> Tải hình</a>"); htmlButton.Append(" </div>"); htmlButton.Append("</div>"); ltrButton.Text = htmlButton.ToString(); } } }
public void LoadData(int userRole) { int id = Request.QueryString["id"].ToInt(0); if (id > 0) { var p = ProductController.GetByID(id); if (p == null) { PJUtils.ShowMessageBoxSwAlertError("Không tìm thấy sản phẩm " + id, "e", true, "/tat-ca-san-pham", Page); } else { ViewState["ID"] = id; ViewState["cateID"] = p.CategoryID; ViewState["SKU"] = p.ProductSKU; if (Convert.ToInt32(ViewState["role"]) == 0 || Convert.ToInt32(ViewState["role"]) == 1) { ltrEdit1.Text = "<a href=\"/thong-tin-san-pham.aspx?id=" + p.ID + "\" class=\"btn primary-btn fw-btn not-fullwidth\">Chỉnh sửa</a>"; ltrEdit2.Text = "<a href=\"/thong-tin-san-pham.aspx?id=" + p.ID + "\" class=\"btn primary-btn fw-btn not-fullwidth\">Chỉnh sửa</a>"; } lbProductTitle.Text = p.ProductTitle; pContent.Text = p.ProductContent; lblSKU.Text = p.ProductSKU; var a = ProductController.GetAllSql(0, p.ProductSKU); if (a.Count() > 0) { foreach (var item in a) { lbProductStock.Text = item.TotalProductInstockQuantityLeft.ToString(); ddlStockStatus.SelectedValue = item.StockStatus.ToString(); } } else { lbProductStock.Text = "0"; } lbRegularPrice.Text = string.Format("{0:N0}", p.Regular_Price); ltrCostOfGood.Text = ""; if (userRole == 0) { ltrCostOfGood.Text += "<div class='form-row'>"; ltrCostOfGood.Text += " <div class='row-left'>"; ltrCostOfGood.Text += " Giá vốn"; ltrCostOfGood.Text += " </div>"; ltrCostOfGood.Text += " <div class='row-right'>"; ltrCostOfGood.Text += " <span class='form-control'>" + string.Format("{0:N0}", p.CostOfGood) + "</span>"; ltrCostOfGood.Text += " </div>"; ltrCostOfGood.Text += "</div>"; } lbRetailPrice.Text = string.Format("{0:N0}", p.Retail_Price); ddlSupplier.SelectedValue = p.SupplierID.ToString(); ddlCategory.SelectedValue = p.CategoryID.ToString(); lbMaterials.Text = p.Materials; lbpMinimumInventoryLevel.Text = p.MinimumInventoryLevel.ToString(); lbpMaximumInventoryLevel.Text = p.MaximumInventoryLevel.ToString(); var image = ProductImageController.GetByProductID(id); imageGallery.Text = "<ul class=\"image-gallery\">"; if (image != null) { foreach (var img in image) { imageGallery.Text += "<li><img src=\"" + img.ProductImage + "\" /></li>"; } } imageGallery.Text += "</ul>"; if (p.ProductImage != null) { ProductThumbnail.ImageUrl = p.ProductImage; } hdfTable.Value = p.ProductStyle.ToString(); var ka = ProductVariableController.SearchProductID(p.ID, ""); if (ka != null) { //var value = ProductVariableValueController.GetByProductVariableID(a.ID); } } List <tbl_ProductVariable> b = new List <tbl_ProductVariable>(); b = ProductVariableController.SearchProductID(id, ""); pagingall(b, userRole); } }
public void LoadData() { int id = Request.QueryString["id"].ToInt(0); string sku = Request.QueryString["sku"]; var p = new tbl_Product(); if (id > 0) { p = ProductController.GetByID(id); } else if (id == 0) { int variableid = Request.QueryString["variableid"].ToInt(0); if (variableid != 0) { p = ProductController.GetByVariableID(variableid); } else { if (sku != "") { p = ProductController.GetBySKU(sku); if (p == null) { p = ProductController.GetByVariableSKU(sku); } } } } if (p == null) { PJUtils.ShowMessageBoxSwAlertError("Không tìm thấy sản phẩm " + id, "e", true, "/san-pham", Page); } else { this.Title = String.Format("{0} - Sản phẩm", p.ProductSKU); ltrEdit1.Text = ""; ltrEdit1.Text += "<a href='javascript:;' onclick='copyProductInfo(" + p.ID + ")' class='btn primary-btn margin-right-15px'><i class='fa fa-files-o'></i> Copy</a>"; ltrEdit1.Text += "<a href='javascript:;' onclick='getAllProductImage(`" + p.ProductSKU + "`)' class='btn primary-btn margin-right-15px'><i class='fa fa-download'></i> Tải hình</a>"; ltrEdit1.Text += "<a href='javascript:;' onclick='postProductKiotViet(`" + p.ProductSKU + "`)' class='btn primary-btn margin-right-15px'><i class='fa fa-arrow-up'></i> Đăng Kiot</a>"; ltrEdit1.Text += "<a href='javascript:;' onclick='postProductZaloShop(`" + p.ProductSKU + "`)' class='btn primary-btn margin-right-15px'><i class='fa fa-arrow-up'></i> Đăng Zalo</a>"; ltrEdit1.Text += "<a href='javascript:;' onclick='downloadProductZaloShop(`" + p.ProductSKU + "`)' class='btn primary-btn btn-blue margin-right-15px'><i class='fa fa-download'></i> Tải Zalo</a>"; ltrEdit1.Text += "<a href='javascript:;' onclick='deleteProductZaloShop(`" + p.ProductSKU + "`)' class='btn primary-btn btn-red margin-right-15px'><i class='fa fa-times' aria-hidden='true'></i> Xóa Zalo</a>"; if (p.ProductType == 2) { ltrEdit1.Text += "<a href='#variantList' class='btn primary-btn margin-right-15px'><i class='fa fa-th-list'></i> Thuộc tính</a>"; } ltrProductName.Text = p.ProductSKU + " - " + p.ProductTitle; var categoryName = CategoryController.GetByID(p.CategoryID.Value); ltrCategory.Text = categoryName.CategoryName; ltrMaterials.Text = p.Materials; pContent.Text = p.ProductContent; ltrSKU.Text = p.ProductSKU; ltrRegularPrice.Text = string.Format("{0:N0}", p.Regular_Price); ltrRetailPrice.Text = string.Format("{0:N0}", p.Retail_Price); // Create order fileter var filter = new ProductFilterModel() { search = p.ProductSKU }; // Create pagination var page = new PaginationMetadataModel(); var a = ProductController.GetAllSql(filter, ref page); if (page.totalCount > 0) { foreach (var item in a) { ltrStock.Text = item.TotalProductInstockQuantityLeft.ToString(); if (item.StockStatus == 1) { ltrStockStatus.Text = "còn hàng"; } else if (item.StockStatus == 2) { ltrStockStatus.Text = "hết hàng"; } else { ltrStockStatus.Text = "đang nhập hàng"; } } } else { ltrStock.Text = "0"; } // thư viện ảnh var image = ProductImageController.GetByProductID(id); imageGallery.Text = "<ul class='image-gallery'>"; imageGallery.Text += "<li><a href='" + Thumbnail.getURL(p.ProductImage, Thumbnail.Size.Source) + "' target='_blank'><img src='" + Thumbnail.getURL(p.ProductImage, Thumbnail.Size.Source) + "'></a><a href='" + Thumbnail.getURL(p.ProductImage, Thumbnail.Size.Source) + "' download class='btn download-btn download-image h45-btn'><i class='fa fa-cloud-download'></i> Tải hình</a></li>"; if (image != null) { foreach (var img in image) { if (img.ProductImage != p.ProductImage) { imageGallery.Text += "<li><a href='" + Thumbnail.getURL(img.ProductImage, Thumbnail.Size.Source) + "' target='_blank'><img src='" + Thumbnail.getURL(img.ProductImage, Thumbnail.Size.Source) + "'></a><a href='" + Thumbnail.getURL(img.ProductImage, Thumbnail.Size.Source) + "' download class='btn download-btn download-image h45-btn'><i class='fa fa-cloud-download'></i> Tải hình</a></li>"; } } } imageGallery.Text += "</ul>"; hdfTable.Value = p.ProductStyle.ToString(); List <tbl_ProductVariable> b = new List <tbl_ProductVariable>(); b = ProductVariableController.SearchProductID(p.ID, ""); if (b != null) { pagingall(b); } } }