private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { Model.ProduceOtherInDepotDetail detail; ChooseProduceOtherCompactForm form = new ChooseProduceOtherCompactForm("product"); if (form.ShowDialog(this) == DialogResult.OK) { this._produceOtherInDepot.Details.Clear(); foreach (var item in OtherCompactDetailManager.SelectIsInDepot(_compact)) { detail = new Book.Model.ProduceOtherInDepotDetail(); detail.ProduceOtherInDepotDetailId = Guid.NewGuid().ToString(); detail.ProduceQuantity = item.NoInDepotCount; detail.ProducePrice = item.OtherCompactPrice; detail.ProductGuige = ""; detail.ProduceMoney = item.OtherCompactMoney; detail.ProduceOtherCompactDetailId = item.OtherCompactDetailId; detail.ProcessPrice = 0; detail.ProductUnit = item.ProductUnit; detail.ProductId = item.ProductId; detail.Product = item.Product; this._produceOtherInDepot.Details.Add(detail); } this.gridControl1.RefreshDataSource(); } }
private void simpleButton3_Click(object sender, EventArgs e) { ProduceOtherCompact.ChooseOtherCompactDetailForm f = new Book.UI.produceManager.ProduceOtherCompact.ChooseOtherCompactDetailForm(); if (f.ShowDialog(this) != DialogResult.OK) { return; } if (_produceOtherCompactDetail.Count != 0) { this._produceOtherInDepot.Details.Clear(); if (_produceOtherCompactDetail != null) { foreach (Model.ProduceOtherCompactDetail ProduceOtherCompactDetail in _produceOtherCompactDetail) { Model.ProduceOtherInDepotDetail produceOtherInDepotDetail = new Book.Model.ProduceOtherInDepotDetail(); produceOtherInDepotDetail.ProduceOtherInDepotDetailId = Guid.NewGuid().ToString(); produceOtherInDepotDetail.Product = ProduceOtherCompactDetail.Product; produceOtherInDepotDetail.ProductId = ProduceOtherCompactDetail.ProductId; produceOtherInDepotDetail.ProductUnit = ProduceOtherCompactDetail.Product.MainUnit == null ? string.Empty : ProduceOtherCompactDetail.Product.MainUnit.CnName; produceOtherInDepotDetail.ProduceOtherCompactDetailId = ProduceOtherCompactDetail.ProduceOtherCompactId; produceOtherInDepotDetail.ProduceQuantity = ProduceOtherCompactDetail.OtherCompactCount; produceOtherInDepotDetail.ProducePrice = ProduceOtherCompactDetail.OtherCompactPrice; produceOtherInDepotDetail.ProduceMoney = ProduceOtherCompactDetail.OtherCompactMoney; produceOtherInDepotDetail.ProduceOtherInDepot = this._produceOtherInDepot; produceOtherInDepotDetail.ProduceOtherInDepotId = this._produceOtherInDepot.ProduceOtherInDepotId; produceOtherInDepotDetail.InvoiceXOId = ProduceOtherCompactDetail.InvoiceXOId; produceOtherInDepotDetail.InvoiceXODetailId = ProduceOtherCompactDetail.InvoiceXODetailId; this._produceOtherInDepot.Details.Add(produceOtherInDepotDetail); } } this.gridControl1.RefreshDataSource(); _produceOtherCompactDetail.Clear(); } }
private void simpleButton1_Click(object sender, EventArgs e) { ChooseProductForm f = new ChooseProductForm(); if (f.ShowDialog(this) == DialogResult.OK) { if (this._produceOtherInDepot.Details.Count > 0 && this._produceOtherInDepot.Details[0] != null && string.IsNullOrEmpty(this._produceOtherInDepot.Details[0].ProductId)) { this._produceOtherInDepot.Details.RemoveAt(0); } Model.ProduceOtherInDepotDetail detail = null; if (ChooseProductForm.ProductList != null || ChooseProductForm.ProductList.Count > 0) { foreach (Model.Product product in ChooseProductForm.ProductList) { detail = new Book.Model.ProduceOtherInDepotDetail(); detail.ProduceOtherInDepotDetailId = Guid.NewGuid().ToString(); // detail.Inumber = this._produceMaterial.Details.Count + 1; detail.Product = this.productManager.Get(product.ProductId); detail.ProductId = detail.Product.ProductId; detail.ProductGuige = (f.SelectedItem as Model.Product).ProductSpecification; detail.ProduceQuantity = 0; detail.ProducePrice = 0; detail.ProduceMoney = 0; detail.ProcessPrice = 0; detail.ProduceInDepotQuantity = 0; detail.ProduceTransferQuantity = 0; if (detail.Product.DepotUnit != null) { detail.ProductUnit = detail.Product.DepotUnit.CnName; } this._produceOtherInDepot.Details.Add(detail); } } if (ChooseProductForm.ProductList == null || ChooseProductForm.ProductList.Count == 0) { detail = new Book.Model.ProduceOtherInDepotDetail(); Model.Product product = f.SelectedItem as Model.Product; // detail.Inumber = this._produceOtherInDepot.Details.Count + 1; detail.ProduceOtherInDepotDetailId = Guid.NewGuid().ToString(); detail.Product = this.productManager.Get(product.ProductId); detail.ProductId = detail.Product.ProductId; detail.ProductGuige = detail.Product.ProductSpecification; detail.ProduceQuantity = 0; detail.ProducePrice = 0; detail.ProduceMoney = 0; detail.ProcessPrice = 0; detail.ProduceInDepotQuantity = 0; detail.ProduceTransferQuantity = 0; if (detail.Product.DepotUnit != null) { detail.ProductUnit = detail.Product.DepotUnit.CnName; } this._produceOtherInDepot.Details.Add(detail); //this.bindingSourceProductId.DataSource = productManager.Select(); } this.gridControl1.RefreshDataSource(); this.bindingSourceDetails.Position = this.bindingSourceDetails.IndexOf(detail); f.Dispose(); GC.Collect(); } }