private void gridView1_ShowingEditor(object sender, CancelEventArgs e) { if (this.action == "insert" || this.action == "update") { if (this.gridView1.FocusedColumn.Name == "gridColumn9") { Model.ProduceOtherMaterialDetail detail = this.gridView1.GetRow(this.gridView1.FocusedRowHandle) as Model.ProduceOtherMaterialDetail; this.repositoryItemComboBox1.Items.Clear(); if (detail != null) { //if (detail.DepotId != null) //{ // IList<Model.DepotPosition> unitList = depotPositionManager.Select(detail.DepotId); // foreach (Model.DepotPosition item in unitList) // { // this.repositoryItemComboBox1.Items.Add(item.Id); // } //} this.bindingSourceDetails.Position = this.bindingSourceDetails.IndexOf(detail); } this.gridControl1.RefreshDataSource(); } if (this.gridView1.FocusedColumn.Name == "gridColumnUnit") { if (this.gridView1.FocusedColumn.ColumnEdit is DevExpress.XtraEditors.Repository.RepositoryItemComboBox) { Model.Product p = (this.gridView1.GetRow(this.gridView1.FocusedRowHandle) as Model.ProduceOtherMaterialDetail).Product; this.repositoryItemComboBox2.Items.Clear(); if (p != null) { if (!string.IsNullOrEmpty(p.BasedUnitGroupId)) { BL.ProductUnitManager manager = new Book.BL.ProductUnitManager(); Model.UnitGroup ug = new BL.UnitGroupManager().Get(p.BasedUnitGroupId); IList <Model.ProductUnit> unitList = manager.Select(ug); foreach (Model.ProductUnit item in unitList) { this.repositoryItemComboBox2.Items.Add(item.CnName); } } } } this.gridControl1.RefreshDataSource(); } } }
private void simpleButton2_Click(object sender, EventArgs e) { if (this.bindingSourceDetails.Current != null) { this._produceOtherMaterial.Details.Remove(this.bindingSourceDetails.Current as Book.Model.ProduceOtherMaterialDetail); if (this._produceOtherMaterial.Details.Count == 0) { Model.ProduceOtherMaterialDetail detail = new Model.ProduceOtherMaterialDetail(); detail.ProduceOtherMaterialDetailId = Guid.NewGuid().ToString(); detail.OtherMaterialQuantity = 0; detail.OtherMaterialALLUserQuantity = 0; detail.ProductStock = 0; detail.Distributioned = 0; detail.ProductSpecification = ""; detail.Product = new Book.Model.Product(); this._produceOtherMaterial.Details.Add(detail); this.bindingSourceDetails.Position = this.bindingSourceDetails.IndexOf(detail); } this.gridControl1.RefreshDataSource(); } }
private void simpleButtonOther_Click(object sender, EventArgs e) { ProduceOtherCompact.ChooseOutContract f = new ProduceOtherCompact.ChooseOutContract(); if (f.ShowDialog(this) != DialogResult.OK) { return; } Model.ProduceOtherCompact OtherCompact = f.SelectItem as Model.ProduceOtherCompact; if (OtherCompact == null) { return; } if (this._produceOtherMaterial.Details.Count > 0 && string.IsNullOrEmpty(this._produceOtherMaterial.Details[0].ProductId)) { this._produceOtherMaterial.Details.RemoveAt(0); } this._produceOtherMaterial.Details.Clear(); this.textEditOtherCompact.Text = OtherCompact.ProduceOtherCompactId; this.newChooseContorlSipu.EditValue = OtherCompact.Supplier; this.textEditCusXOId.Text = string.Empty; if (!string.IsNullOrEmpty(OtherCompact.MRSHeaderId)) { Model.MRSHeader mrsHeader = this.mRSHeaderManager.Get(OtherCompact.MRSHeaderId); if (mrsHeader != null) { Model.MPSheader mPSheader = this.mPSheaderManager.Get(mrsHeader.MPSheaderId); if (mPSheader != null) { Model.InvoiceXO invoiceXO = this.invoiceXOManager.Get(mPSheader.InvoiceXOId); this.textEditCusXOId.Text = invoiceXO == null ? string.Empty : invoiceXO.CustomerInvoiceXOId; } } } //if (ProduceOtherCompact.ChooseOutContract._OtherCompactDetailList.Count == 0) return; //if (this._produceOtherInDepot.Details.Count > 0 && string.IsNullOrEmpty(this._produceOtherInDepot.Details[0].ProductId)) // this._produceOtherInDepot.Details.RemoveAt(0); //this._produceOtherInDepot.Details.Clear(); //this.textEditOtherCompact.Text = ProduceOtherCompact.ChooseOutContract._OtherCompactDetailList[0].ProduceOtherCompactId; //this._produceOtherMaterial.Details = (from p in this.OtherCompactMaterialManager.Select(OtherCompact) // group p by new { p.ProductId, p.ProductUnit } into b // select new Model.ProduceOtherMaterialDetail() // { // ProduceOtherMaterialDetailId = Guid.NewGuid().ToString(), // ProduceOtherCompactMaterialId = (from p in b select p.ProduceOtherCompactMaterialId).ToString(), // ProductId = b.Key.ProductId, // Product = new BL.ProductManager().Get(b.Key.ProductId), // ProductUnit =b.Key.ProductUnit, // OtherMaterialQuantity = (from p in b select p.ProduceQuantity).Sum(), // Description = (from p in b select p.Description).ToString(), // }).ToList(); foreach (Model.ProduceOtherCompactMaterial item in this.OtherCompactMaterialManager.Select(OtherCompact)) { Model.ProduceOtherMaterialDetail detail = new Model.ProduceOtherMaterialDetail(); detail.ProduceOtherMaterialDetailId = Guid.NewGuid().ToString(); detail.ProduceOtherCompactMaterialId = item.ProduceOtherCompactMaterialId; detail.Product = this.productManager.Get(item.ProductId); detail.ProductId = item.ProductId; detail.ProductUnit = item.ProductUnit; detail.OtherMaterialQuantity = item.ProduceQuantity;// - (item.AlreadyOutQuantity == null ? 0 : item.AlreadyOutQuantity); if (detail.OtherMaterialQuantity < 0) { detail.OtherMaterialQuantity = 0; } // detail.ProcessPrice = 0; detail.Description = item.Description; detail.ParentProductId = item.ParentProductId; detail.ParentProduct = item.ParentProduct; detail.ProductStock = detail.Product.StocksQuantity; if (!detail.Product.ProduceMaterialDistributioned.HasValue) { detail.Product.ProduceMaterialDistributioned = 0; } if (!detail.Product.OtherMaterialDistributioned.HasValue) { detail.Product.OtherMaterialDistributioned = 0; } detail.Distributioned = detail.Product.OtherMaterialDistributioned + detail.Product.ProduceMaterialDistributioned; detail.Inumber = this._produceOtherMaterial.Details.Count + 1; this._produceOtherMaterial.Details.Add(detail); } this.gridControl1.RefreshDataSource(); }
private void simpleButton1_Click_1(object sender, EventArgs e) { ChooseProductForm f = new ChooseProductForm(); if (f.ShowDialog(this) == DialogResult.OK) { if (this._produceOtherMaterial.Details.Count > 0 && this._produceOtherMaterial.Details[0] != null && string.IsNullOrEmpty(this._produceOtherMaterial.Details[0].ProductId)) { this._produceOtherMaterial.Details.RemoveAt(0); } Model.ProduceOtherMaterialDetail detail = null; if (ChooseProductForm.ProductList != null || ChooseProductForm.ProductList.Count > 0) { foreach (Model.Product product in ChooseProductForm.ProductList) { detail = new Book.Model.ProduceOtherMaterialDetail(); detail.ProduceOtherMaterialDetailId = Guid.NewGuid().ToString(); detail.Product = this.productManager.Get(product.ProductId); detail.ProductId = product.ProductId; detail.ProductSpecification = detail.Product.ProductSpecification; detail.OtherMaterialQuantity = 0; detail.OtherMaterialALLUserQuantity = 0; detail.ProductStock = detail.Product.StocksQuantity; if (!detail.Product.ProduceMaterialDistributioned.HasValue) { detail.Product.ProduceMaterialDistributioned = 0; } if (!detail.Product.OtherMaterialDistributioned.HasValue) { detail.Product.OtherMaterialDistributioned = 0; } detail.Distributioned = detail.Product.ProduceMaterialDistributioned + detail.Product.OtherMaterialDistributioned; detail.Inumber = this._produceOtherMaterial.Details.Count + 1; this._produceOtherMaterial.Details.Add(detail); } } if (ChooseProductForm.ProductList == null || ChooseProductForm.ProductList.Count == 0) { detail = new Book.Model.ProduceOtherMaterialDetail(); detail.ProduceOtherMaterialDetailId = Guid.NewGuid().ToString(); detail.Product = this.productManager.Get((f.SelectedItem as Model.Product).ProductId); detail.ProductId = detail.Product.ProductId; detail.ProductSpecification = detail.Product.ProductSpecification; detail.OtherMaterialQuantity = 0; detail.OtherMaterialALLUserQuantity = 0; detail.ProductStock = detail.Product.StocksQuantity; if (!detail.Product.ProduceMaterialDistributioned.HasValue) { detail.Product.ProduceMaterialDistributioned = 0; } if (!detail.Product.OtherMaterialDistributioned.HasValue) { detail.Product.OtherMaterialDistributioned = 0; } detail.Distributioned = detail.Product.ProduceMaterialDistributioned + detail.Product.OtherMaterialDistributioned; detail.Inumber = this._produceOtherMaterial.Details.Count + 1; this._produceOtherMaterial.Details.Add(detail); } this.bindingSourceDetails.Position = this.bindingSourceDetails.IndexOf(detail); this.gridControl1.RefreshDataSource(); } f.Dispose(); System.GC.Collect(); }
public void Update(Model.ProduceOtherMaterialDetail e) { this.Update <Model.ProduceOtherMaterialDetail>(e); }
public void Insert(Model.ProduceOtherMaterialDetail e) { this.Insert <Model.ProduceOtherMaterialDetail>(e); }