public static string LoadSize( string ProductColorID, string ProductID ) { var oProductColorSize = new ProductSizeColor(); var dv = oProductColorSize.ProductSizeColorSelectAll("", ProductColorID, ProductID, "True", "True", "", "True").DefaultView; string s = "<option value='0'>- Chọn -</option>"; if (dv.Count > 0) { foreach (DataRow row in dv.Table.Rows) s += "<option value='" + row["ProductLengthID"] + "'>" + row["ProductLengthName"].ToString().Trim() + "</option>"; } return s; }
protected void lstProductHot_ItemCommand(object sender, ListViewCommandEventArgs e) { var item = e.Item as ListViewDataItem; var cmd = e.CommandName; var ProductOptionCategoryID = (item.FindControl("hdnProductOptionCategoryID2") as HiddenField).Value; var ProductOptionCategoryName = (item.FindControl("hdnProductOptionCategoryName2") as HiddenField).Value; var ProductID = (item.FindControl("hdnProductID2") as HiddenField).Value; var ProductName = (item.FindControl("lblProductName2") as Label).Text; var ProductNameEn = (item.FindControl("lblProductNameEn2") as Label).Text; var ImageName = (item.FindControl("hdnImageName2") as HiddenField).Value; var ProductCode = (item.FindControl("hdnProductCode2") as HiddenField).Value; var ProductLengthID = (item.FindControl("hdnProductLengthID2") as HiddenField).Value; var ProductLengthName = (item.FindControl("hdnProductLengthName2") as HiddenField).Value; var Quantity = "1"; double Price = Convert.ToDouble((item.FindControl("hdnPrice2") as HiddenField).Value); string ProductSizeColorID1 = ""; string QuantityList = ""; int SizeColorQuantity1 = 0; var oProductSizeColor = new ProductSizeColor(); if (cmd == "AddToCart") { if (ProductID != "" && ProductLengthID != "" && ProductLengthID != "") { var dv = oProductSizeColor.ProductSizeColorSelectAll(ProductLengthID, ProductOptionCategoryID, ProductID, "True", "True", "", "True").DefaultView; ProductSizeColorID1 = dv[0]["ProductSizeColorID"].ToString(); SizeColorQuantity1 = Convert.ToInt32(dv[0]["Quantity"].ToString()) - Convert.ToInt32(dv[0]["QuantitySale"].ToString()); for (int i = 1; i <= SizeColorQuantity1; i++) { QuantityList = QuantityList + i + ","; } } var oShoppingCart = new ShoppingCart(); oShoppingCart.CreateCart(ProductID, ImageName, ProductName, ProductNameEn, ProductCode, ProductOptionCategoryID, ProductOptionCategoryName, ProductLengthID, ProductLengthName, ProductSizeColorID1, Quantity, SizeColorQuantity1.ToString(), Price, false ); ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "runtime", "myconfirmPopup('" + "<strong>" + ProductName + " - " + ProductCode + " - " + ProductOptionCategoryName + "</strong><br/> đã được thêm vào giỏ hàng" + "')", true); } else if (cmd == "AddToWishList") { if (Session["UserName"] != null) { var oWishList = new WishList(); oWishList.WishListInsert1( ProductID, User.Identity.Name, "1", Price.ToString(), ImageName, ProductName, "", ProductCode, ProductOptionCategoryID, ProductOptionCategoryName, ProductLengthID, ProductLengthName, ProductSizeColorID1, "" ); } else Response.Redirect("~/Login.aspx?returnurl=" + Request.Url.AbsolutePath.Substring(Request.Url.AbsolutePath.LastIndexOf("/") + 1)); } }
protected void btnUpdate_Click(object sender, EventArgs e) { string Priority, ProductSizeColorID, IsAvailable, Quantity, QuantitySale; var oProductSizeColor = new ProductSizeColor(); RadListBoxItemCollection choosesizes = lstChoosedSize.Items; foreach (RadListBoxItem item in choosesizes) { ProductSizeColorID = item.Value.ToString(); Priority = ((RadNumericTextBox)item.FindControl("txtPriority")).Text.Trim(); Quantity = ((RadNumericTextBox)item.FindControl("txtQuantity")).Text.Trim(); IsAvailable = ((CheckBox)item.FindControl("chkIsAvailable")).Checked.ToString(); //QuantitySale = "0"; oProductSizeColor.ProductSizeColorQuickUpdate( ProductSizeColorID, "True", IsAvailable, Priority, Quantity //QuantitySale ); } }
protected void AllSize_Transferred(object sender, RadListBoxTransferredEventArgs e) { var DestinationListBox = e.DestinationListBox; string ProductID; ProductID = Request.QueryString["pi"]; var oProductSizeColor = new ProductSizeColor(); IList<RadListBoxItem> rlbicProductColor = lstChoosedColor.SelectedItems; foreach (RadListBoxItem item in e.Items) { if (DestinationListBox.ID == "lstAllSize") { string ProSizeID; ProSizeID = item.Value.ToString(); //Update ProductFormSize Status var dv = oProductSizeColor.ProductSizeColorSelectOne(ProSizeID).DefaultView; if (dv.Table.Rows.Count > 0) { oProductSizeColor.ProductSizeColorDelete1(ProSizeID, "False"); } } else if (DestinationListBox.ID == "lstChoosedSize") { //Insert ProductFormSize var selectedItem = e.DestinationListBox.FindItemByValue(item.Value); string ProductSizeID = item.Value.ToString(); var dv = oProductSizeColor.ProductSizeColorSelectAll("", ProductSizeID, ProductID, "", "True", "", "").DefaultView; var lblName = (Label)selectedItem.FindControl("lblName"); var txtPriority = (RadNumericTextBox)selectedItem.FindControl("txtPriority"); if (dv.Table.Rows.Count > 0) { if (dv[0]["IsAvailable"].ToString() != "True") oProductSizeColor.ProductSizeColorDelete1(ProductSizeID, "True"); if (lblName != null) lblName.Text = item.Text; if (dv[0]["Priority"] != DBNull.Value) txtPriority.Value = Convert.ToInt32(dv[0]["Priority"]); } else { foreach (RadListBoxItem item1 in rlbicProductColor) { var ProductOptionCategoryID = item1.Value.ToString(); oProductSizeColor.ProductSizeColorInsert(ProductSizeID, ProductOptionCategoryID, ProductID, "True", "True", ""); } } } } DataBindListBoxSize(); }