using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace PrimarySystemSimulator { public partial class Register : Form { public Patient Patient = null; public Register() { InitializeComponent(); } public Register(string ack) { InitializeComponent(); try { if (!string.IsNullOrEmpty(ack) && File.Exists(ack)) { string[] lines = File.ReadAllLines(ack); if (lines != null && lines.Length > 0) { foreach (string line in lines) { if (line.StartsWith("PGS:")) { lblPGS.Text = line.Replace("PGS:", "").Trim(' ').Replace("\r\n", "").Replace("\n", ""); } else if (line.StartsWith("UDID:")) { udid.Text = line.Replace("UDID:", "").Trim(' ').Replace("\r\n", "").Replace("\n", ""); } } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } } private void button1_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.patient.Text)) { MessageBox.Show("Bitte geben Sie einen Patientennamen ein"); } else if (string.IsNullOrEmpty(this.patientnummer.Text)) { MessageBox.Show("Bitte geben Sie eine Patientennummer ein"); } else if (string.IsNullOrEmpty(this.zip.Text)) { MessageBox.Show("Bitte geben Sie eine PLZ ein"); } else { Patient = new Patient(); Patient.Name = this.patient.Text; Patient.PatId = this.patientnummer.Text; Patient.Birthday = this.birthday.Value.ToString("yyyy-MM-dd"); Patient.UDID = udid.Text; Patient.PGS = lblPGS.Text; Patient.Zip = zip.Text; Patient.Status = "COMPLETED"; this.DialogResult = DialogResult.OK; } } private void button2_Click(object sender, EventArgs e) { Patient = new Patient(); Patient.Name = this.patient.Text; Patient.PatId = this.patientnummer.Text; Patient.Birthday = this.birthday.Value.ToString("yyyy-MM-dd"); Patient.UDID = udid.Text; Patient.PGS = lblPGS.Text; Patient.Zip = zip.Text; Patient.Status = "REJECTED"; this.DialogResult = DialogResult.Cancel; } } }