private async void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            if (IsValidForm())
            {
                DbStatus status = await medicalTitleService.Add(new MedicalTitle()
                {
                    Name = NameBox.Text
                });

                OperationStatus = StatusHandler.Handle(OperationType.Create, status);
                Close();
            }
            else
            {
                FieldValidation.WriteMessage(ErrorLabel, language.SelectValues);
            }
        }
Ejemplo n.º 2
0
        private async void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            MedicalTitle medicalTitle = new MedicalTitle()
            {
                Name = NameBox.Text
            };

            DbStatus status = await medicalTitleService.Add(medicalTitle);

            if (status == DbStatus.SUCCESS)
            {
                WindowHelper.WriteMessage(language.AddingSuccess, MessageLabel, true);
            }
            else if (status == DbStatus.EXISTS)
            {
                WindowHelper.WriteMessage(language.EntityExists, MessageLabel, false);
            }
            NameBox.Text         = string.Empty;
            SaveButton.IsEnabled = false;
        }