示例#1
0
 private void AddSerumBtn_Click(object sender, RoutedEventArgs e)
 {
     if (!string.IsNullOrWhiteSpace(SerumTextBox.Text))
     {
         if (!SerumReferences.Any(a => a.ReferenceNumber == SerumTextBox.Text.Trim()))
         {
             SerumReferences.Add(new SerumReference {
                 ReferenceNumber = SerumTextBox.Text.Trim()
             });
             SerumRefGrid.ItemsSource = SerumReferences;
             SerumRefGrid.Items.Refresh();
         }
         else
         {
             MessageBox.Show("This reference number is already added");
         }
         SerumTextBox.Text = string.Empty;
     }
 }
示例#2
0
        private bool ValidatePage(bool skipPrintCountLbl = false)
        {
            RemoveErrorBorders();

            bool          isValid       = true;
            List <string> errorMessages = new List <string>();

            if (ArrayListbx.SelectedIndex == -1)
            {
                ArrayLabel.BorderBrush     = Brushes.Red;
                ArrayLabel.BorderThickness = new Thickness(2);
                isValid = false;
            }
            if (GroupListbx.SelectedIndex == -1)
            {
                GroupLabel.BorderBrush     = Brushes.Red;
                GroupLabel.BorderThickness = new Thickness(2);
                isValid = false;
            }
            if (App.ccPageType != CCType.N && AntigenListbx.SelectedIndex == -1)
            {
                AntigenLabel.BorderBrush     = Brushes.Red;
                AntigenLabel.BorderThickness = new Thickness(2);
                isValid = false;
            }
            if (!SerumReferences.Any())
            {
                SerumRefLabel.BorderBrush     = Brushes.Red;
                SerumRefLabel.BorderThickness = new Thickness(2);
                isValid = false;
            }
            if (string.IsNullOrWhiteSpace(DilutionFactorTextBox.Text))
            {
                DilutionLabel.BorderBrush     = Brushes.Red;
                DilutionLabel.BorderThickness = new Thickness(2);
                isValid = false;
            }
            if (!DilutionDatePicker.SelectedDate.HasValue)
            {
                DateLabel.BorderBrush     = Brushes.Red;
                DateLabel.BorderThickness = new Thickness(2);
                isValid = false;
            }
            if (string.IsNullOrWhiteSpace(ExpirationDateTextBox.Text))
            {
                ExpirationLabel.BorderBrush     = Brushes.Red;
                ExpirationLabel.BorderThickness = new Thickness(2);
                isValid = false;
            }
            if (!skipPrintCountLbl && string.IsNullOrWhiteSpace(QuantityLabelTextBox.Text))
            {
                QtyLabel.BorderBrush     = Brushes.Red;
                QtyLabel.BorderThickness = new Thickness(2);
                isValid = false;
            }

            if (AntigensGrid.ItemsSource == null)
            {
                AntigensGrid.BorderBrush     = Brushes.Red;
                AntigensGrid.BorderThickness = new Thickness(2);
                isValid = false;
            }

            if (!isValid)
            {
                errorMessages.Add("Please complete missing fields");
            }

            if (!ValidateGetMinMax(errorMessages))
            {
                isValid = false;
            }

            if (!isValid)
            {
                ErrorMessages.Text = " * " + string.Join("\r\n * ", errorMessages);
            }
            else
            {
                ErrorMessages.Text = string.Empty;
            }

            return(isValid);
        }