protected void txtProductSKU_Changed(object sender, EventArgs e) { var productSKU = txtProductSKU.Text.Trim().ToUpper(); if (!String.IsNullOrEmpty(productSKU)) { if (productSKU != _productSKU) { var product = ProductController.GetBySKU(txtProductSKU.Text.Trim().ToLower()); if (product != null) { txtProductSKU.Text = ViewState["SKU"].ToString(); PJUtils.ShowMessageBoxSwAlert(String.Format("Mã #SKU - {0} đã tồn tại", productSKU), "e", false, Page); return; } } var stocks = StockManagerController.warehousing1ByParentSKU(_productSKU); if (stocks.Count > 0) { txtProductSKU.Text = ViewState["SKU"].ToString(); PJUtils.ShowMessageBoxSwAlert(String.Format("Sản phẩm #{0} đã tạo mã vạch nhập kho rồi nên không thể sửa", ViewState["SKU"]), "i", false, Page); return; } var skuOld = ViewState["SKU"].ToString().Trim().ToUpper(); var skuNew = productSKU; ViewState["SKU"] = productSKU; JavaScript.AfterPageLoad(Page).ExecuteCustomScript("updateVariationSKUA('{0}', '{1}');", new object[] { skuOld, skuNew }); } else { txtProductSKU.Text = ViewState["SKU"].ToString(); PJUtils.ShowMessageBoxSwAlert("Bạn đã quên nhập mã sản phẩm. Tôi đã lấy mã sản phẩm củ cho bạn", "i", false, Page); } }