private ScanType GetFromScanList(ScanTypeCollection types, DepartmentStockView stock)
 {
     string checkTypeName = stock.ProductMaster.ProductType.TypeName;
     foreach (ScanType scanType in types)
     {
         if(scanType.TypeName.Equals(checkTypeName))
         {
             return scanType;
         }
     }
     return null;
 }
        private void DepartmentStockCheckingForm_Load(object sender, EventArgs e)
        {
            scanTypesList = new ScanTypeCollection(scanTypeBindingSource);
            scanTypeBindingSource.DataSource = scanTypesList;
            scanTypeBindingSource.ResetBindings(true);
            cboTypeList.Refresh();
            cboTypeList.Invalidate();

            stockList = new DepartmentStockViewCollection(bdsStockDefect);
            bdsStockDefect.DataSource = stockList;
            bdsStockDefect.EndEdit();
            bdsStockDefect.ResetBindings(true);
            dgvStocks.Refresh();
            dgvStocks.Invalidate();
        }