private void списокПациентовToolStripMenuItem_Click(object sender, EventArgs e) { var PatientList = new FormBaseData(); PatientList.ShowDialog(); }
public void SaveButton_Click(object sender, EventArgs e) { if (txtHeight.Text != String.Empty && txtWeight.Text != String.Empty && txtaddName.Text != String.Empty && txtaddPatronymic.Text != String.Empty && txtaddSurname.Text != String.Empty) { if (saveFileDialog1.ShowDialog() == DialogResult.OK) { if (RButtonMale.Checked) { Gender_ = "Мужской"; } else if (RButtonFemale.Checked) { Gender_ = "Женский"; } FIO_ = txtaddSurname.Text + ' ' + txtaddName.Text + ' ' + txtaddPatronymic.Text; DateTime DoB_ = addDOB1.Value; Height_ = Convert.ToDouble(txtHeight.Text); Weight_ = Convert.ToDouble(txtWeight.Text); DateTime dateNow = DateTime.Now; int Age_ = dateNow.Year - addDOB1.Value.Year; if (dateNow.Month < addDOB1.Value.Month || (dateNow.Month == addDOB1.Value.Month && dateNow.Day < addDOB1.Value.Day)) { Age_--; } { int DateNow = Age_; } var FormPatientProfile = new FormPatinetProfile(); var FormDataBase = new FormBaseData(); FormPatientProfile.lblFIO.Text = "ФИО: " + FIO_; FormPatientProfile.lblGenderinProfile.Text = "Пол: " + Gender_; FormPatientProfile.lblHeightinProfile.Text = "Рост: " + Height_ + " см"; FormPatientProfile.lblWeightinProfile.Text = "Вес: " + Weight_ + " кг"; FormPatientProfile.lblDoBinProfile.Text = "Дата рождения: " + DoB_.ToShortDateString(); FormPatientProfile.lblAgeinProfile.Text = "Возраст: " + Age_; FormPatientProfile.dateTiPi1.Value = DoB_; FormPatientProfile.ProfilePicture.Image = pictureBox1.Image; //FormDataBase.DB1.Rows.Add(FIO_, Age_, Height_, Weight_, Gender_); using (StreamWriter sw = new StreamWriter(saveFileDialog1.FileName, true)) { sw.WriteLine(txtaddSurname.Text + " " + txtaddName.Text + " " + txtaddPatronymic.Text); sw.WriteLine(DoB_); sw.WriteLine(Age_); sw.WriteLine(Gender_); sw.WriteLine(txtHeight.Text); sw.WriteLine(txtWeight.Text); sw.Close(); } this.Hide(); FormPatientProfile.Show(); } } else { MessageBox.Show("Заполните пустые ячейки"); } }