Ejemplo n.º 1
0
        private void HandleReceivedBarCode(String barCode)
        {
            var container = GenericContainerManager.GetGenericContainerByBarCode(barCode);

            if (container == null)
            {
                _resetTimer.Enabled = true;
                return;
            }
            if (LoadSampleStorageDuoDialog.IsSampleContainer(container))
            {
                AddListviewItem(new ContainerToBePlacedViewItem(container));
                if (_putInContainer != null)
                {
                    EnableOkButton();
                }
            }
            else if (LoadSampleStorageDuoDialog.IsStorageContainer(container))
            {
                _putInContainer = container;
                UpdateContainerText(container.GetIdentifier());
                DialogResult = DialogResult.OK;
            }
            else
            {
                throw new DataException("This container neither represent a sample container nor a deposit");
            }
        }
Ejemplo n.º 2
0
 public BarCodeListViewItem(IGenericContainer container)
     : base(container.GetBarCode())
 {
     MyBarCode = container.GetBarCode();
     MyText    = container.GetIdentifier();
     this.SubItems.Add(MyText);
 }
Ejemplo n.º 3
0
 private void InitWithPutInContainer(IGenericContainer container)
 {
     StatusLabel.Text           = "Waiting for scanned containers (plates/tubes/etc) to be placed in the deposit below. \nClose and go to next step by pressing OK or cancel.";
     PutInContainerTextBox.Text = container.GetIdentifier();
     _putInContainer            = container;
     OkButton.Enabled           = false;
 }
Ejemplo n.º 4
0
 public SampleListDialog()
 {
     InitializeComponent();
     MyPutInContainer    = null;
     MyBarCodeController = null;
     InitListView();
 }
Ejemplo n.º 5
0
        private void Init()
        {
            // Hide advanced panel.
            PrintGroupBox.Height -= AdvancedPanel.Height;
            CloseButton.Location  = new Point(CloseButton.Location.X, CloseButton.Location.Y - AdvancedPanel.Height);
            this.Height          -= AdvancedPanel.Height;

            // Define columns for bar code list view.
            BarCodeListView.Columns.Add("Registered bar codes", (BarCodeListView.Width / 2) - 12);
            BarCodeListView.Columns.Add(TEXT_COLUMN_NAME, (BarCodeListView.Width / 2) - 12);

            // Print bar code properties.
            BarCodeHeightComboBox.SelectedItem = "Tall";
            BarCodeWidthComboBox.SelectedItem  = "Narrow";
            OffsetX.Value = LabelPrinter.GetDefaultBarCodeOffsetX();
            OffsetY.Value = LabelPrinter.GetDefaultBarCodeOffsetY();
            BarCodeTypeComboBox.SelectedIndex = 0;
            PrintModeComboBox.SelectedIndex   = 0;
            PrintServerNameTextBox.Text       = LabelPrinter.GetDefaultPrintServerName();

            IGenericContainer container = null;

            container = ContainerManager.GetUncontainedContainer();
            if (IsNotNull(container))
            {
                BarCodeListView.BeginUpdate();
                BarCodeListView.Items.Add(new BarCodeListViewItem(container));
                BarCodeListView.EndUpdate();
            }
            else
            {
                ShowWarning("Could not find the Uncontained object!");
            }
            PrintButton.Enabled = IsNotEmpty(BarCodeListView.Items);
        }
 private static void CheckMoveContainer(IGenericContainer moveContainer)
 {
     // Check that no top level container is moved into another container.
     if (moveContainer.IsTopLevel())
     {
         throw new DataException("Can't move a TopLevel container into another container");
     }
 }
Ejemplo n.º 7
0
 public SampleListDialog()
 {
     InitializeComponent();
     _putInContainer      = null;
     _barCodeController   = null;
     _resetTimer.Elapsed += ResetTimer_Elapsed;
     InitListView();
 }
Ejemplo n.º 8
0
 public DuoViewItem(IGenericContainer deposit, IGenericContainer container)
     : base(container.GetIdentifier())
 {
     _deposit         = deposit;
     _sampleContainer = container;
     _containerPath   = "";
     SubItems.Add(deposit.GetIdentifier());
     Checked = true;
 }
Ejemplo n.º 9
0
 public DuoViewItem(IGenericContainer deposit, IGenericContainer container)
     : base(container.GetIdentifier())
 {
     MyDeposit         = deposit;
     MySampleContainer = container;
     MyContainerPath   = "";
     this.SubItems.Add(deposit.GetIdentifier());
     this.Checked = true;
 }
Ejemplo n.º 10
0
 public SampleStoreageDuo(IGenericContainer deposit, IGenericContainer container)
 {
     MySampleContainer  = container;
     MyStorageContainer = deposit;
     MyIsTerminated     = true;
     MyIsComplete       = true;
     MyIsChecked        = true;
     MyContainerPath    = "";
 }
Ejemplo n.º 11
0
 private void InitWithSampleContainer(IGenericContainer container)
 {
     SampleContainerListView.BeginUpdate();
     SampleContainerListView.Items.Add(new ContainerToBePlacedViewItem(container));
     SampleContainerListView.EndUpdate();
     _putInContainer  = null;
     StatusLabel.Text = "Waiting for more scanned containers (plates/tubes/etc). \nClose and go to next step by scan a deposit (Box/Shelf/Freezer/etc)";
     OkButton.Enabled = false;
 }
Ejemplo n.º 12
0
 public void SetStorageContainer(IGenericContainer storageContainer)
 {
     MyStorageContainer = storageContainer;
     if (IsNotNull(MySampleContainer))
     {
         SetCompleted();
         SetTerminated();
     }
 }
Ejemplo n.º 13
0
 private bool CheckContainerType(IGenericContainer genericContainer)
 {
     if (IsNull(genericContainer) ||
         !(IsSampleContainer(genericContainer) || IsStorageContainer(genericContainer)))
     {
         return(false);
     }
     return(true);
 }
 public static void MoveGenericContainer(IGenericContainer moveContainer,
                                         IGenericContainer toContainer, int user_id)
 {
     // Check parameters.
     CheckNotNull(moveContainer, "moveContainer");
     CheckMoveContainer(moveContainer);
     CheckToContainer(toContainer);
     CheckCirularReferens(moveContainer, toContainer);
     Database.MoveContainer(moveContainer.GetId(), GetId(toContainer), user_id);
 }
 private void UpdateListView(GenericContainerList selectedContainers,
                             IGenericContainer depositContainer)
 {
     SampleStorageListView.BeginUpdate();
     foreach (IGenericContainer container in selectedContainers)
     {
         SampleStorageListView.Items.Add(new DuoViewItem(depositContainer, container));
     }
     SampleStorageListView.EndUpdate();
     SampleStorageListView.Columns[(int)ListIndex.SampleContainer].Width = -2;
 }
Ejemplo n.º 16
0
        public void TestThatMultipleIndexerDontConflict()
        {
            var stub = new StubIGenericContainer <int>();

            stub.Item_Get(index => 12).Item_Get((key, i) => 3);

            IGenericContainer <int> container = stub;

            Assert.AreEqual(12, container[0]);
            Assert.AreEqual(3, container["foo", 0]);
        }
Ejemplo n.º 17
0
 public SampleStoreageDuo(IGenericContainer sampleContainer, int index)
 {
     MySampleContainer  = sampleContainer;
     MyStorageContainer = null;
     MyIsTerminated     = false;
     MyIsComplete       = false;
     MyStatus           = "Waiting for Storage id";
     MyIndex            = index;
     MyIsChecked        = true;
     MyContainerPath    = "";
 }
Ejemplo n.º 18
0
 private bool IsSampleContainer(IGenericContainer genericContainer)
 {
     if (genericContainer.GetContainerType() == ContainerType.FlowCell ||
         genericContainer.GetContainerType() == ContainerType.BeadChip ||
         genericContainer.GetContainerType() == ContainerType.Plate ||
         genericContainer.GetContainerType() == ContainerType.Tube ||
         genericContainer.GetContainerType() == ContainerType.Box)
     {
         return(true);
     }
     return(false);
 }
Ejemplo n.º 19
0
 private bool IsStorageContainer(IGenericContainer genericContainer)
 {
     if (genericContainer.GetContainerType() == ContainerType.Box ||
         genericContainer.GetContainerType() == ContainerType.Building ||
         genericContainer.GetContainerType() == ContainerType.Floor ||
         genericContainer.GetContainerType() == ContainerType.Freezer ||
         genericContainer.GetContainerType() == ContainerType.Refrigerator ||
         genericContainer.GetContainerType() == ContainerType.Room ||
         genericContainer.GetContainerType() == ContainerType.Shelf ||
         genericContainer.GetContainerType() == ContainerType.TopLevel ||
         genericContainer.GetContainerType() == ContainerType.Uncontained)
     {
         return(true);
     }
     return(false);
 }
 private static void CheckToContainer(IGenericContainer toContainer)
 {
     // Check that target container isn't a BeadChip, plate or tube.
     if (IsNotNull(toContainer) && toContainer.IsBeadChip())
     {
         throw new DataException("Can't move containers into a BeadChip");
     }
     if (IsNotNull(toContainer) && toContainer.IsPlate())
     {
         throw new DataException("Can't move containers into a plate");
     }
     if (IsNotNull(toContainer) && toContainer.IsTube())
     {
         throw new DataException("Can't move containers into a tube");
     }
 }
Ejemplo n.º 21
0
 public SampleListDialog(IGenericContainer container)
 {
     InitializeComponent();
     InitListView();
     MyBarCodeController = new BarCodeController(this);
     MyBarCodeController.BarCodeReceived += new BarCodeEventHandler(BarCodeReceived);
     if (LoadSampleStorageDuoDialog.IsSampleContainer(container))
     {
         InitWithSampleContainer(container);
     }
     else if (LoadSampleStorageDuoDialog.IsStorageContainer(container))
     {
         InitWithPutInContainer(container);
     }
     else
     {
         throw new Data.Exception.DataException("This container neither represent a sample container nor a deposit");
     }
 }
Ejemplo n.º 22
0
        public void TestIndexerSet()
        {
            var stub = new StubIGenericContainer <int>();
            int res  = -1;

            stub.Item_Set((index, value) =>
            {
                if (index != 0)
                {
                    throw new IndexOutOfRangeException();
                }
                res = value;
            });

            IGenericContainer <int> container = stub;

            container[0] = 13;

            Assert.AreEqual(13, res);
        }
        private static void CheckCirularReferens(IGenericContainer moveContainer,
                                                 IGenericContainer toContainer)
        {
            GenericContainerList containerPath;

            // Check that containers not are moved into it's own content.
            // Avoid circular reference.
            if (IsNotNull(toContainer))
            {
                containerPath = toContainer.GetContainerPath();
                //Add the destination container itself to the path.
                containerPath.Add(toContainer);
                if (containerPath.IsMember(moveContainer))
                {
                    throw new DataException("Can't move " +
                                            moveContainer.GetIdentifier() +
                                            " into " +
                                            toContainer.GetIdentifier() +
                                            ". Circular referenses are not allowed!");
                }
            }
        }
Ejemplo n.º 24
0
 private void MoveContainer(IGenericContainer moveContainer,
                            IGenericContainer toContainer, int userId)
 {
     // Moves containers into target container. If tocontainer is null
     // the moveContainers is moved out from currect location
     try
     {
         if (toContainer.GetContainerType() == ContainerType.Uncontained)
         {
             toContainer = null;
         }
         // Move the containers.
         ChiasmaDepData.BeginTransaction();
         GenericContainerManager.MoveGenericContainer(moveContainer, toContainer, userId);
         ChiasmaDepData.CommitTransaction();
     }
     catch
     {
         ChiasmaDepData.RollbackTransaction();
         throw;
     }
 }
Ejemplo n.º 25
0
        public void TestIndexerGet()
        {
            var stub = new StubIGenericContainer <int>();

            stub.Item_Get(index =>
            {
                switch (index)
                {
                case 0:
                    return(13);

                case 1:
                    return(5);

                default:
                    throw new IndexOutOfRangeException();
                }
            });

            IGenericContainer <int> container = stub;

            Assert.AreEqual(13, container[0]);
            Assert.AreEqual(5, container[1]);
        }
Ejemplo n.º 26
0
        private void HandleReceivedBarCode(String barCode)
        {
            IGenericContainer container;

            container = GenericContainerManager.GetGenericContainerByBarCode(barCode);
            if (LoadSampleStorageDuoDialog.IsSampleContainer(container))
            {
                SampleContainerListView.Items.Add(new ContainerToBePlacedViewItem(container));
                if (MyPutInContainer != null)
                {
                    OkButton.Enabled = true;
                }
            }
            else if (LoadSampleStorageDuoDialog.IsStorageContainer(container))
            {
                MyPutInContainer           = container;
                PutInContainerTextBox.Text = container.GetIdentifier();
                DialogResult = DialogResult.OK;
            }
            else
            {
                throw new Data.Exception.DataException("This container neither represent a sample container nor a deposit");
            }
        }
 public TemplateToExcelManager(ILogger logger, IGenericContainer <ITemplateObject, ReadOnlyMemory <byte> > container, Encoding encoding)
 {
     Logger    = logger;
     Container = container;
     Encoder   = encoding;
 }
Ejemplo n.º 28
0
 public void SetSampleContainer(IGenericContainer sampleContainer)
 {
     MySampleContainer = sampleContainer;
 }
Ejemplo n.º 29
0
 public ContainerToBePlacedViewItem(IGenericContainer container)
     : base(container.GetIdentifier())
 {
     _container = container;
 }
 private static void RegisterSpecFlowDependencies(IObjectContainer objectContainer, IGenericContainer container)
 {
     container.Register(() => objectContainer);
     container.Register(() =>
     {
         var specFlowContainer = container.Resolve <IObjectContainer>();
         return(specFlowContainer.Resolve <ScenarioContext>());
     });
     container.Register(() =>
     {
         var specFlowContainer = container.Resolve <IObjectContainer>();
         return(specFlowContainer.Resolve <FeatureContext>());
     });
     container.Register(() =>
     {
         var specFlowContainer = container.Resolve <IObjectContainer>();
         return(specFlowContainer.Resolve <TestThreadContext>());
     });
 }