Ejemplo n.º 1
0
        public void TestGetAllBatchTypes()
        {
            TestAddBatchType();
            List <BatchType> tests = BatchTypeController.GetAllBatchTypes();

            CleanUp();
            List <BatchType> emptyTests = BatchTypeController.GetAllBatchTypes();

            Assert.IsTrue(type1.Equals(tests[0], type1));
            Assert.IsTrue(type1.Equals(tests[1], type2));
            Assert.IsTrue(type1.Equals(tests[2], type3));
            Assert.IsTrue(type1.Equals(tests[3], type4));
            Assert.AreEqual(null, emptyTests);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HistoryWindow"/> class.
        /// </summary>
        public HistoryWindow()
        {
            InitializeComponent();

            try
            {
                _machineIDs = MachineController.GetMachineIDs();
            }
            catch
            {
                MessageBox.Show("Error getting Machine IDs.", "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            try
            {
                _batches = BatchController.GetAllBatches();
            }
            catch
            {
                MessageBox.Show("Error getting Batches.", "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            try
            {
                _batchTypes = BatchTypeController.GetAllBatchTypes();
            }
            catch
            {
                MessageBox.Show("Error getting Batch Types.", "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            cboMachines.ItemsSource   = _machineIDs;
            cboMachines.SelectedIndex = 0;

            cboBatchTypes.ItemsSource   = _batchTypes;
            cboBatchTypes.SelectedIndex = 0;

            dgHistory.ItemsSource = _batches;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EditBatchTypeWindow"/> class.
        /// </summary>
        public EditBatchTypeWindow()
        {
            InitializeComponent();

            try
            {
                _batchTypes = BatchTypeController.GetAllBatchTypes();
            }
            catch
            {
                MessageBox.Show("Error retrieving batch types from the database.  Please Try again.", "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
                Close();
            }

            if (_batchTypes.Count > 0)
            {
                cboBatchTypes.ItemsSource   = _batchTypes;
                cboBatchTypes.SelectedIndex = 0;
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NewBatchWindow"/> class.
        /// </summary>
        public NewBatchWindow()
        {
            InitializeComponent();

            _machine = MachineController.InitializeMachine();

            _lblStatus1Dispatcher = lblStatus1.Dispatcher;
            _lblStatus2Dispatcher = lblStatus2.Dispatcher;
            _lblStatus3Dispatcher = lblStatus3.Dispatcher;
            _lblStatus4Dispatcher = lblStatus4.Dispatcher;
            _lblStatus5Dispatcher = lblStatus5.Dispatcher;
            _lblStatus6Dispatcher = lblStatus6.Dispatcher;

            _worker = new BackgroundWorker();
            _worker.WorkerReportsProgress      = true;
            _worker.WorkerSupportsCancellation = true;
            _worker.DoWork             += worker_MakeBatch;
            _worker.ProgressChanged    += new ProgressChangedEventHandler(worker_ProgressChanged);
            _worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(worker_RunWorkerCompleted);

            //Load batch types into combo box
            try
            {
                _batchTypes = BatchTypeController.GetAllBatchTypes();
            }
            catch
            {
                MessageBox.Show("Error retrieving batch types from database.", "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            if (_batchTypes.Count <= 0)
            {
                MessageBox.Show("No batch types found.", "Notice!", MessageBoxButton.OK, MessageBoxImage.Asterisk);
                return;
            }

            cboBatchTypes.ItemsSource   = _batchTypes;
            cboBatchTypes.SelectedIndex = 0;
        }