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; }
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 BindData() { SuiteModel suite = new SuiteBll().GetModel(SuiteID); DataTable dt = bll.GetList(SuiteID); decimal sumPrice = 0, sumMarketPrice = 0; foreach (DataRow row in dt.Rows) { row["mediumimage"] = ProductMainImageRule.GetMainImageUrl(row["mediumimage"].ToString()); sumPrice += Convert.ToDecimal(row["price"]); sumMarketPrice += Convert.ToDecimal(row["tradeprice"]); } Repeater_Products.DataSource = dt; Repeater_Products.DataBind(); Literal_SuiteSum.Text = suite.Price.ToString("0.00"); Literal_SaveValue.Text = (sumMarketPrice - suite.Price).ToString("0.00"); }
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(); } }
protected void btnSave_Click(object sender, EventArgs e) { SuiteBll sbll = new SuiteBll(); int suiteId = String.IsNullOrEmpty(lblSuiteId.Text) ? 0 : int.Parse(lblSuiteId.Text); SuiteModel smodel = sbll.GetModel(suiteId); if (smodel == null) { smodel = new SuiteModel(); smodel.Price = 0m; smodel.Score = 0; smodel.SuiteId = NoName.NetShop.Common.CommDataHelper.GetNewSerialNum(AppType.Product); smodel.ScenceId = ScenceId; } decimal price; if (!decimal.TryParse(lblPrice.Text, out price)) { price = 0m; } smodel.ProductFee = price; smodel.DerateFee = decimal.Parse(txtDerate.Text); smodel.Price = smodel.ProductFee - smodel.DerateFee; smodel.Remark = txtRemark.Text.Trim(); smodel.SuiteName = txtSuiteName.Text.Trim(); if (!String.IsNullOrEmpty(fulImage.FileName)) { string[] MainImages; if (ProductMainImageRule.SaveProductMainImage(smodel.SuiteId, "suite/", fulImage.PostedFile, out MainImages)) { smodel.SmallImage = MainImages[0]; smodel.MediumImage = MainImages[1]; smodel.LargeImage = MainImages[2]; } } sbll.Save(smodel); this.ShowInfo(smodel.SuiteId); }
protected void btnSave_Click(object sender, EventArgs e) { SuiteBll sbll = new SuiteBll(); int suiteId = String.IsNullOrEmpty(lblSuiteId.Text) ? 0 : int.Parse(lblSuiteId.Text); SuiteModel smodel = sbll.GetModel(suiteId); if (smodel == null) { smodel = new SuiteModel(); smodel.Price =0m; smodel.Score =0; smodel.SuiteId = NoName.NetShop.Common.CommDataHelper.GetNewSerialNum(AppType.Product); smodel.ScenceId = ScenceId; } decimal price; if (!decimal.TryParse(lblPrice.Text,out price)) { price = 0m; } smodel.ProductFee = price; smodel.DerateFee = decimal.Parse(txtDerate.Text); smodel.Price = smodel.ProductFee - smodel.DerateFee; smodel.Remark = txtRemark.Text.Trim(); smodel.SuiteName = txtSuiteName.Text.Trim(); if (!String.IsNullOrEmpty(fulImage.FileName)) { string[] MainImages; if (ProductMainImageRule.SaveProductMainImage(smodel.SuiteId,"suite/", fulImage.PostedFile, out MainImages)) { smodel.SmallImage = MainImages[0]; smodel.MediumImage = MainImages[1]; smodel.LargeImage = MainImages[2]; } } sbll.Save(smodel); this.ShowInfo(smodel.SuiteId); }