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 static Suite ToNewDbObject(this SuiteModel suiteModel) { return(new Suite { IsActive = suiteModel.IsActive, PrivateKey = suiteModel.PrivateKey, PublicKey = suiteModel.PublicKey, SuiteName = suiteModel.SuiteName, UsesSysEncryption = suiteModel.UsesSysEncryption, SuiteType = EnumConverter.ConvertToInt(suiteModel.SuiteType), CreatedDate = DateTime.Now.ToUniversalTime() }); }
/// <summary> /// 得到一个对象实体 /// </summary> public SuiteModel GetModel(int SuiteId) { DbCommand dbCommand = dbr.GetStoredProcCommand("UP_slSuite_GetModel"); dbr.AddInParameter(dbCommand, "SuiteId", DbType.Int32, SuiteId); SuiteModel model = null; using (IDataReader dataReader = dbr.ExecuteReader(dbCommand)) { if (dataReader.Read()) { model = ReaderBind(dataReader); } } return(model); }
public CommandOutput OnExecute(CommandInput arguments) { var output = new CommandOutput { PostAction = CommandOutput.PostCommandAction.None }; bool completed = false; SuiteModel model = default(SuiteModel); long userId = arguments.GetUserId(); if (arguments["name"] != null) { model = CurrentHostContext.Default.Provider.ConfigurationStore.GetSuite(userId, arguments["name"]); completed = true; } else if (arguments["id"] != null) { long suiteId = -1; long.TryParse(arguments["id"], out suiteId); if (suiteId != -1) { model = CurrentHostContext.Default.Provider.ConfigurationStore.GetSuite(userId, suiteId); completed = true; } } if (!completed) { output.DisplayMessage = "Invalid data in command received"; output.PostAction = CommandOutput.PostCommandAction.ShowCommandHelp; output.MessageType = CommandOutput.DisplayMessageType.Error; } else if (model != null) { output.Data = model; output.DisplayMessage = "Success"; } else { output.DisplayMessage = DoesNotExist; output.MessageType = CommandOutput.DisplayMessageType.Error; } return(output); }
/// <summary> /// 对象实体绑定数据 /// </summary> public SuiteModel ReaderBind(IDataReader dataReader) { SuiteModel model = new SuiteModel(); object ojb; ojb = dataReader["SuiteId"]; if (ojb != null && ojb != DBNull.Value) { model.SuiteId = Convert.ToInt32(ojb); } ojb = dataReader["ScenceId"]; if (ojb != null && ojb != DBNull.Value) { model.ScenceId = Convert.ToInt32(ojb); } model.SuiteName = dataReader["SuiteName"].ToString(); model.SmallImage = dataReader["SmallImage"].ToString(); model.MediumImage = dataReader["MediumImage"].ToString(); model.LargeImage = dataReader["LargeImage"].ToString(); ojb = dataReader["Price"]; if (ojb != null && ojb != DBNull.Value) { model.Price = Convert.ToDecimal(ojb); } model.Remark = dataReader["Remark"].ToString(); ojb = dataReader["Score"]; if (ojb != null && ojb != DBNull.Value) { model.Score = Convert.ToInt32(ojb); } ojb = dataReader["deratefee"]; if (ojb != null && ojb != DBNull.Value) { model.DerateFee = Convert.ToDecimal(ojb); } ojb = dataReader["ProductFee"]; if (ojb != null && ojb != DBNull.Value) { model.ProductFee = Convert.ToDecimal(ojb); } return(model); }
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(); } }
/// <summary> /// 增加一条数据 /// </summary> public void Save(SuiteModel model) { if (model.SuiteId == 0) { model.SuiteId = CommDataHelper.GetNewSerialNum(AppType.Product); // 因为图片部分与商品类似,因此这里的id也采用了商品一致的id序列 } DbCommand dbCommand = dbw.GetStoredProcCommand("UP_slSuite_Save"); dbw.AddInParameter(dbCommand, "SuiteId", DbType.Int32, model.SuiteId); dbw.AddInParameter(dbCommand, "ScenceId", DbType.Int32, model.ScenceId); dbw.AddInParameter(dbCommand, "SuiteName", DbType.AnsiString, model.SuiteName); dbw.AddInParameter(dbCommand, "LargeImage", DbType.AnsiString, model.LargeImage); dbw.AddInParameter(dbCommand, "SmallImage", DbType.AnsiString, model.SmallImage); dbw.AddInParameter(dbCommand, "MediumImage", DbType.AnsiString, model.MediumImage); dbw.AddInParameter(dbCommand, "Price", DbType.Decimal, model.Price); dbw.AddInParameter(dbCommand, "Remark", DbType.AnsiString, model.Remark); dbw.AddInParameter(dbCommand, "Score", DbType.Int32, model.Score); dbw.AddInParameter(dbCommand, "DerateFee", DbType.Decimal, model.DerateFee); dbw.AddInParameter(dbCommand, "ProductFee", DbType.Decimal, model.ProductFee); dbw.ExecuteNonQuery(dbCommand); }
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); }
/// <summary> /// 增加一条数据 /// </summary> public void Save(SuiteModel model) { dal.Save(model); }
internal void Rodar(SuiteModel suiteModel) { _FTCappCrl = controller; _FTCappCrl.RunTeste(suiteModel.suite); Suites = new ObservableCollection <SuiteModel>(GetSuites()); }