private void Button_Click(object sender, RoutedEventArgs e)
        {
            array.Clear();
            try
            {
                array.Add(tbFirstName.Text);
                array.Add(tbSecondName.Text);
                array.Add(dateOfBirth.SelectedDate.Value.ToShortDateString());
                array.Add(tbDiagnos.Text);
                array.Add(dateSecond.SelectedDate.Value.ToShortDateString());
                array.Add(timeSecond.Text);
                date[$"{dateFirst.SelectedDate.Value.ToShortDateString() + timeFirst.Text}"] = array;

                var jsonFile = File.ReadAllText("person.json");
                var json     = JsonConvert.DeserializeObject(jsonFile);
                fullJson.Merge(json);
                try
                {
                    fullJson.Add(dateFirst.SelectedDate.Value.ToShortDateString() + timeFirst.Text, date[$"{dateFirst.SelectedDate.Value.ToShortDateString() + timeFirst.Text}"]);
                    File.WriteAllText("person.json", fullJson.ToString());
                    this.Close();
                }
                catch
                {
                    MessageBox.Show("Данное время занято другим пациентом", "Ошибка", MessageBoxButton.OK);
                }
            }
            catch
            {
                MessageBox.Show("Не все поля заполнены!", "Ошибка", MessageBoxButton.OK);
            }

            mw.FillWeek();
            mw.fillFromJson();
        }
Beispiel #2
0
 private void mwShowPers_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     mw.fillFromJson();
     mw.FillWeek();
 }