public ProductAddView(StructGoods updateProduct) { InitializeComponent(); InitUI(); if (updateProduct != null) { product = updateProduct; RefreshUI(); } }
//添加新行 private void AddNewRow(StructGoods product) { DataRow row = this.mainDataTable.NewRow(); this.mainDataTable.Rows.Add(row); row[TitleList.Number.ToString()] = this.mainDataTable.Rows.Count + ""; row[TitleList.Name.ToString()] = product.GoodsName; row[TitleList.Type.ToString()] = SysManage.GetProductTypeName(product.Category); row[TitleList.Price.ToString()] = product.Price; row[TitleList.IsIntegral.ToString()] = product.UseIntegal; row[TitleList.IsShowStore.ToString()] = product.Hide; row[TitleList.Integral.ToString()] = product.Integal; row[TitleList.Num.ToString()] = product.Count; }
public static void UpdateProduct(DataResultBlock resultBlock, StructGoods product) { CSGoodsUpdate.Builder update = new CSGoodsUpdate.Builder() { Goods = product, }; MessageContent.Builder content = new MessageContent.Builder(); content.SetMessageType(1); content.SetCsGoodsUpdate(update); SendModel send = new SendModel() { cmd = Cmd.CMD_GOODS_UPDATE, content = content.Build() }; NetMessageManage.SendMsg(send, resultBlock); }
public static void AddProduct(DataResultBlock resultBlock, StructGoods product) { CSGoodsAdd.Builder addproduct = new CSGoodsAdd.Builder() { Goods = product, }; MessageContent.Builder content = new MessageContent.Builder(); content.SetMessageType(1); content.SetCsGoodsAdd(addproduct); SendModel send = new SendModel() { cmd = Cmd.CMD_GOODS_ADD, content = content.Build() }; NetMessageManage.SendMsg(send, resultBlock); }
//删除选中商品 private void simpleButton1_Click(object sender, EventArgs e) { List <int> ids = new List <int>(); for (int i = 0; i < this.mainDataTable.Rows.Count; i++) { StructGoods prodcut = this.products[i]; DataRow row = this.mainDataTable.Rows[i]; if (row[TitleList.Check.ToString()].ToString().Equals("True")) { ids.Add(prodcut.GoodsId); } } if (ids.Count == 0) { return; } ProductNetOperation.DeleteProduct(DeleteProductResult, ids); }
public void ColumnButtonClick(object sender, ButtonPressedEventArgs e) { int rowhandle = this.gridView1.FocusedRowHandle; StructGoods product = this.products[rowhandle]; DataRow row = this.gridView1.GetDataRow(rowhandle); String tag = (String)e.Button.Tag; String[] param = tag.Split('_'); //查看销售记录 if (param[0].Equals(TitleList.SellRecord.ToString())) { ProductSellRecordView view = new ProductSellRecordView(product.GoodsId); MainViewManage.ShowSecondView(view); } else if (param[0].Equals(TitleList.Operation.ToString())) { //修改信息 if (param[1].Equals("0")) { ProductAddView view = new ProductAddView(product); CloseFormHandle close = new CloseFormHandle(delegate { this.mainDataTable.Clear(); GetProductList(); }); ToolsManage.ShowForm(view, false, close); } //删除 else { List <int> ids = new List <int>() { product.GoodsId, }; ProductNetOperation.DeleteProduct(DeleteProductResult, ids); } } }