Пример #1
0
        private void Reader_OnBarCodeRead(object sender, BarCodeReader.BarCodeReadEventArgs e)
        {
            InventoryService iService = new InventoryService(_context);
            Regex            reg      = null;

            reg          = new System.Text.RegularExpressions.Regex("^[1-9][0-9]*$");
            foundBarCode = string.Empty;
            Invoke(new MethodInvoker(() => { txtScannerOutput.Text = e.ValueRead.ToString(); }));
            Invoke(new MethodInvoker(() => { foundBarCode = e.ValueRead.ToString(); }));
            if (txtScannerOutput.Text != string.Empty)
            {
                if (selectedPart != null && _scanType == ScanType.associate)
                {
                    partsService.AssociateSKU(selectedPart, foundBarCode);
                    var _part = partsService.Find(selectedPart.PartID);
                    if (_part.Sku == foundBarCode)
                    {
                        MessageBox.Show("Success Associating SKU to Part");
                        Invoke(new MethodInvoker(() => { this.txtPartSearch.Text = " "; }));
                    }
                    return;
                }
                else if (_scanType == ScanType.find)
                {
                    Part partlookup = partsService.FindBySKU(foundBarCode);
                    if (!String.IsNullOrEmpty(partlookup.Sku))
                    {
                        reader.CloseScanner();
                        Invoke(new MethodInvoker(() => { OpenPartDetailForm(partlookup.PartID, _context);; }));
                    }
                }
            }
        }
Пример #2
0
        /// <summary>
        /// TODO  use PartID and DTO to hydrate the control
        /// </summary>
        /// <param name="part"></param>
        /// <param name="ctx"></param>
        public PartView(Part part, BadgerDataModel ctx)
        {
            InitializeComponent();
            _context = ctx;
            ISuppliersService var = new SuppliersService(_context);

            inventoryService = new InventoryService(_context);
            partsService     = new PartsService(_context);
            this.dataGridView1.AutoGenerateColumns   = false;
            this.dgvTransactions.AutoGenerateColumns = false;
            if (part.PartID > 0)
            {
                _part = partsService.Find(part.PartID);
            }
            else
            {
                _part           = partsService.New();
                _part.AddedBy   = Globals.CurrentUserName;
                _part.DateAdded = DateTime.Today;
            }
            cboSuppliers.DisplayMember = "SupplierName";
            cboSuppliers.ValueMember   = "SupplierID";
            cboSuppliers.SelectedItem  = _part.SupplierId;
            cboSuppliers.DataSource    = var.GetAll();

            cboUnits.DisplayMember = "UOM";
            cboUnits.ValueMember   = "UID";
            cboUnits.SelectedItem  = _part.UID;
            cboUnits.DataSource    = partsService.Units();

            cboManus.DisplayMember = "Manufacturer";
            cboManus.ValueMember   = "ManuID";
            cboManus.SelectedItem  = _part.ManuId;
            cboManus.DataSource    = partsService.Manufacturers();


            bsPart.DataSource = _part;

            // This triggers the Save Button On changed--
            bsPart.CurrentItemChanged += BsPart_CurrentItemChanged;

            this.btnSave.Enabled         = _isDirty;
            this.txtSupplierDesc.Enabled = false;
            _documents = _context.Document.Where(r => r.PartID == _part.PartID).ToList();
            // _documents = _part.Document.ToList();
            bsDocuments.DataSource        = _documents;
            this.dataGridView1.DataSource = bsDocuments;

            LoadTransaction();

            this.rbRecieved.Checked = true;
        }