public override OrderProduct AddToCart(OrderType opType, int productId, int quantity, NameValueCollection paras) { SuitId = productId; int typecode; if (int.TryParse(paras["typecode"],out typecode)) { typecode =0; } NoName.NetShop.Solution.BLL.SuiteBll sbll = new SuiteBll(); SolutionProductBll spbll = new SolutionProductBll(); SuiteModel smodel = sbll.GetModel(SuitId); List<SolutionProductModel> list = spbll.GetModelList(SuitId); this.OrderProducts.Clear(); foreach (SolutionProductModel model in list) { OrderProduct op = OrderProductFactory.Instance().CreateOrderProduct(model.ProductId, model.Quantity, opType, paras); op.Key = this.Key + "_op" + this.GetSerial(); op.Container = this; if (op != null) { OrderProducts.Add(op); } } this.DerateFee = this.ProductSum - smodel.Price; _score = smodel.Score; return null; }
protected void btnAddProduct_Click(object sender, EventArgs e) { int productId = int.Parse(txtProductId.Text); int quantity = int.Parse(txtQuantity.Text); int suiteId = int.Parse(lblSuiteId.Text); NoName.NetShop.Product.BLL.ProductModelBll pbll = new NoName.NetShop.Product.BLL.ProductModelBll(); SolutionProductBll spbll = new SolutionProductBll(); NoName.NetShop.Product.Model.ProductModel pmodel = pbll.GetModel(productId); SuiteBll sbll = new SuiteBll(); if (pmodel != null) { NoName.NetShop.Solution.Model.SolutionProductModel spmodel = new SolutionProductModel(); spmodel.Price = pmodel.MerchantPrice; spmodel.ProductId = pmodel.ProductId; spmodel.Quantity = quantity; spmodel.SuiteId = suiteId; spbll.Save(spmodel); sbll.SetPriceFromRefrence(suiteId); } ShowInfo(suiteId); }
protected void gvItems_RowDeleting(object sender, GridViewDeleteEventArgs e) { SolutionProductBll spbll = new SolutionProductBll(); int productId = Convert.ToInt32(gvItems.DataKeys[e.RowIndex].Values["ProductId"]); int suitId = int.Parse(lblSuiteId.Text); spbll.Delete(suitId, productId); SuiteBll sbll = new SuiteBll(); sbll.SetPriceFromRefrence(suitId); ShowInfo(suitId); }
private void ShowInfo(int suiteId) { SuiteBll sbll = new SuiteBll(); SolutionProductBll spbll = new SolutionProductBll(); SuiteModel smodel = sbll.GetModel(suiteId); if (smodel == null) { panAddProduct.Visible = false; txtScore.Text = "0"; lblPrice.Text = "0"; txtDerate.Text = "0"; lblScenceId.Text = ScenceId.ToString(); } else { panAddProduct.Visible = true; lblSuiteId.Text = smodel.SuiteId.ToString(); txtRemark.Text = smodel.Remark; txtScore.Text = smodel.Score.ToString(); txtScore.ReadOnly = true; txtSuiteName.Text = smodel.SuiteName; lblScenceId.Text = smodel.ScenceId.ToString(); lblPrice.Text = smodel.ProductFee.ToString("F2"); txtDerate.Text = smodel.DerateFee.ToString("F2"); if (!String.IsNullOrEmpty(smodel.SmallImage)) { this.imgSuite.Visible = true; this.imgSuite.ImageUrl = Common.CommonImageUpload.GetCommonImageFullUrl(smodel.SmallImage); } else { this.imgSuite.Visible = false; } gvItems.DataSource = spbll.GetModelList(suiteId); gvItems.DataBind(); } }