// Default Constructor public PrescriptionForm(PIMSController.PrescDrug drug) { tempDrug = drug; this.Size = Screen.PrimaryScreen.WorkingArea.Size; InitializeComponent(); BindingSource bs = new BindingSource(); bs.DataSource = PIMS.Program.drugs; comboBox1.DataSource = bs; if (drug.prescribingPhysician != "new") { this.physicanTextBox.Text = Program.currentUser.name; } // If we have drugs to add // Add them if (drug.id != 0) { this.comboBox1.Text = drug.drug.name; this.sigTextBox.Text = drug.SIG; this.dateTimePicker1.Value = drug.dateFilled; // Makes the patient's prescription text box's not editable makeReadOnly(); } // This is a new drug else { // Makes the patient's prescription text box's editable makeReadable(); saveUpdateButton.Text = "Save New Prescription"; } }
// Allow the Docotor to add a current prescription for the patient private void addCurrentPrescriptionButton_Click(object sender, EventArgs e) { PIMSController.PrescDrug drug = new PIMSController.PrescDrug(); drug.prescribingPhysician = "new"; // Clear contents of Panel2 Program.myForm.splitContainer1.Panel2.Controls.Clear(); // Add PrescriptionForm to Panel2 Program.myForm.splitContainer1.Panel2.Controls.Add(new PrescriptionForm(drug)); }