Пример #1
0
        private void SubmitButton_Click(object sender, EventArgs e)
        {
            if (NewValue == default)
            {
                MessageBoxService.ShowIncorrectInputWarning("Input value must not be empty.");
                return;
            }

            DialogResult = DialogResult.OK;
        }
Пример #2
0
        private void SubmitButton_Click(object sender, System.EventArgs e)
        {
            if (string.IsNullOrEmpty(NewValueTextBox.Text))
            {
                MessageBoxService.ShowIncorrectInputWarning("Input value must not be empty.");
                return;
            }

            NewValue = NewValueTextBox.Text;

            DialogResult = DialogResult.OK;
        }
Пример #3
0
        private void SubmitButton_Click(object sender, EventArgs e)
        {
            try
            {
                NewValue = Convert.ToDouble(NewValueTextBox.Text);
            }
            catch (Exception)
            {
                MessageBoxService.ShowIncorrectInputWarning("New value must be of type double.");
                return;
            }

            DialogResult = DialogResult.OK;
        }
        private void SubmitButton_Click(object sender, EventArgs e)
        {
            int minAge;

            try
            {
                minAge = Convert.ToInt32(MinAgeTextBox.Text);
            }
            catch (Exception)
            {
                MessageBoxService.ShowIncorrectInputWarning("Minimum age must be int type value.");
                return;
            }

            if (minAge < 0)
            {
                MessageBoxService.ShowIncorrectInputWarning("Minimum age must be greater or equal than '0'.");
                return;
            }

            double dose;

            try
            {
                dose = Convert.ToDouble(DoseTextBox.Text);
            }
            catch (Exception)
            {
                MessageBoxService.ShowIncorrectInputWarning("Dose must be double type value.");
                return;
            }

            if (dose <= 0)
            {
                MessageBoxService.ShowIncorrectInputWarning("Dose must be greater than '0'.");
                return;
            }

            DialogResultEntity = new Dosage
            {
                DiseaseMedicamentId = _diseaseMedicament.Id,
                MinAge = minAge,
                Dose   = dose
            };

            DialogResult = DialogResult.OK;
        }
Пример #5
0
        private void SubmitButton_Click(object sender, System.EventArgs e)
        {
            var name = NameTextBox.Text;

            if (string.IsNullOrEmpty(name))
            {
                MessageBoxService.ShowIncorrectInputWarning("Field 'Name' must not be empty.");
                return;
            }

            DialogResultEntity = new Disease
            {
                Name = name
            };

            DialogResult = DialogResult.OK;
        }
Пример #6
0
        private void SubmitButton_Click(object sender, EventArgs e)
        {
            var sex                   = SexTextBox.Text;
            var fullName              = FullNameTextBox.Text;
            var phoneNumber           = PhoneNumberTextBox.Text;
            var insurancePolicyNumber = InsurancePolicyNumberTextBox.Text;

            if (string.IsNullOrEmpty(sex) ||
                string.IsNullOrEmpty(fullName) ||
                string.IsNullOrEmpty(phoneNumber) ||
                string.IsNullOrEmpty(insurancePolicyNumber))
            {
                MessageBoxService.ShowIncorrectInputWarning("All fields must not be empty.");
                return;
            }

            int age;

            try
            {
                age = Convert.ToInt32(AgeTextBox.Text);
            }
            catch (Exception)
            {
                MessageBoxService.ShowIncorrectInputWarning("'Age' is 'int' type field.");

                return;
            }

            DialogResultEntity = new Client
            {
                Sex                   = sex,
                Age                   = age,
                FullName              = fullName,
                PhoneNumber           = phoneNumber,
                InsurancePolicyNumber = insurancePolicyNumber
            };

            DialogResult = DialogResult.OK;
        }
        private void SubmitButton_Click(object sender, EventArgs e)
        {
            var name = NameTextBox.Text;

            if (string.IsNullOrEmpty(name))
            {
                MessageBoxService.ShowIncorrectInputWarning("Field 'Name' must not be empty.");
                return;
            }

            double stockQuantity;

            try
            {
                stockQuantity = Convert.ToDouble(StockQuantityTextBox.Text);
            }
            catch (Exception)
            {
                MessageBoxService.ShowIncorrectInputWarning("Field 'StockQuantity' must have value of type double.");
                return;
            }

            if (stockQuantity < 0)
            {
                MessageBoxService.ShowIncorrectInputWarning("Field 'StockQuantity' must not be less than 0.");
                return;
            }

            DialogResultEntity = new Medicament
            {
                Name          = name,
                StockQuantity = stockQuantity
            };

            DialogResult = DialogResult.OK;
        }
Пример #8
0
        private void SubmitButton_Click(object sender, EventArgs e)
        {
            float dosageMultiplier;

            try
            {
                dosageMultiplier = (float)Convert.ToDouble(DosageMultiplierTextBox.Text);
            }
            catch (Exception)
            {
                MessageBoxService.ShowIncorrectInputWarning(
                    "Make sure you entered float type value into the 'Dosage multiplier' field.");
                return;
            }

            DialogResultEntity = new Substitute
            {
                OriginalMedicamentId   = SelectedOriginalMedicamentId,
                SubstituteMedicamentId = SelectedSubstituteMedicamentId,
                DosageMultiplier       = dosageMultiplier
            };

            DialogResult = DialogResult.OK;
        }