예제 #1
0
        private async void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            if (FormIsValid())
            {
                MedicalRecord medicalRecord = new MedicalRecord()
                {
                    Name              = FirstNameBox.Text,
                    LastName          = LastNameBox.Text,
                    BirthDate         = BirthDatePicker.SelectedDate.Value,
                    BirthPlace        = BirthPlaceBox.Text,
                    FathersFullName   = FathersNameBox.Text,
                    MothersFullName   = MothersNameBox.Text,
                    FathersProfession = FathersProfessionBox.Text,
                    MothersProfession = MothersProfessionBox.Text,
                    Gender            = (sbyte)(MaleCheckBox.IsChecked.Value ? 0 : 1),
                    MarriageStatus    = (sbyte)(MarriedCheckBox.IsChecked.Value ? 0 : 1),
                    Jmb             = UNBBox.Text,
                    InsuranceNumber = InsuranceNumberBox.Text,
                    IdResidence     = ((PlaceViewModel)ResidancePlaceComboBox.SelectedItem).IdPlace
                };
                DbStatus status = await medicalRecordService.Add(medicalRecord);

                OperationStatus = StatusHandler.Handle(OperationType.Create, status);
                Close();
            }
            else
            {
                FieldValidation.WriteMessage(ErrorLabel, language.SelectValues);
            }
        }
예제 #2
0
        private async void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            MedicalRecord medicalRecord = new MedicalRecord()
            {
                Name              = NameBox.Text,
                LastName          = LastNameBox.Text,
                BirthDate         = BirthDatePicker.SelectedDate.Value,
                BirthPlace        = BirthPlaceBox.Text,
                FathersFullName   = FathersNameBox.Text,
                MothersFullName   = MothersNameBox.Text,
                FathersProfession = FathersProfessionBox.Text,
                MothersProfession = MothersProfessionBox.Text,
                Gender            = (sbyte)(MaleCheckBox.IsChecked.Value ? 0 : 1),
                MarriageStatus    = (sbyte)(MarriedCheckBox.IsChecked.Value ? 0 : 1),
                Jmb             = JmbBox.Text,
                InsuranceNumber = InsuranceNumberBox.Text,
                IdResidence     = ((PlaceViewModel)(ResidancePlaceComboBox.SelectedItem)).IdPlace
            };
            DbStatus status = await medicalRecordService.Add(medicalRecord);

            if (status == DbStatus.SUCCESS)
            {
                WindowHelper.WriteMessage(language.AddingSuccess, MessageLabel, true);
            }
            else if (status == DbStatus.EXISTS)
            {
                WindowHelper.WriteMessage(language.EntityExists, MessageLabel, false);
            }
            else if (status == DbStatus.DATABASE_ERROR)
            {
                WindowHelper.WriteMessage(language.DatabaseError, MessageLabel, false);
            }

            SaveButton.IsEnabled = false;
        }
 public IActionResult Post([FromBody] MedicalRecordItemModel model)
 {
     _service.Add(model);
     return(Ok());
 }