private bool HasInStockDefectList(DepartmentStockTempView stock, DepartmentStockTempViewCollection list, out int stockDefIndex) { int count = 0; foreach (DepartmentStockTempView stockDefect in list) { if (stockDefect.ProductMaster.ProductMasterId.Equals(stock.ProductMaster.ProductMasterId)) { stockDefIndex = count; return true; } count += 1; } stockDefIndex = count; return false; }
private void DepartmentStockCheckingForm_Load(object sender, EventArgs e) { stockList = new DepartmentStockTempViewCollection(bdsStockDefect); bdsStockDefect.DataSource = stockList; bdsStockDefect.EndEdit(); bdsStockDefect.ResetBindings(true); dgvStock.Refresh(); dgvStock.Invalidate(); stockList.Clear(); DepartmentStockAdhocProcessingEventArgs eventArgs = new DepartmentStockAdhocProcessingEventArgs(); EventUtility.fireEvent(LoadAdhocStocksEvent,this,eventArgs); if(eventArgs.DeptStockAdhocList!= null && eventArgs.DeptStockAdhocList.Count > 0) { foreach (DepartmentStockTempView stockTempView in eventArgs.DeptStockAdhocList) { stockList.Add(stockTempView); } bdsStockDefect.EndEdit(); dgvStock.Refresh(); dgvStock.Invalidate(); } }