diff --git a/Louis'-Pharmacy_CNSA212-FP/frmInfo.Designer.cs b/Louis'-Pharmacy_CNSA212-FP/frmInfo.Designer.cs index d7d7eb1..c02ffb8 100644 --- a/Louis'-Pharmacy_CNSA212-FP/frmInfo.Designer.cs +++ b/Louis'-Pharmacy_CNSA212-FP/frmInfo.Designer.cs @@ -34,8 +34,8 @@ namespace Louis__Pharmacy_CNSA212_FP System.Windows.Forms.Label lblPatientLast; System.Windows.Forms.Label lblPhysicianFirst; System.Windows.Forms.Label lblPhysicianLast; - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmInfo)); this.tbcInfo = new System.Windows.Forms.TabControl(); this.tbpPatient = new System.Windows.Forms.TabPage(); @@ -285,7 +285,22 @@ namespace Louis__Pharmacy_CNSA212_FP this.dgvPatient.AllowUserToAddRows = false; this.dgvPatient.AllowUserToDeleteRows = false; this.dgvPatient.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.dgvPatient.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.pat_id, this.FirstName, this.LastName, this.MiddleInitials, this.City, this.UsState, this.Zip, this.Ibs, this.Height_feet, this.Height_inches, this.Ailment, this.DOB, this.PhoneNumber, this.Gender, this.Medications }); + this.dgvPatient.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.pat_id, + this.FirstName, + this.LastName, + this.MiddleInitials, + this.City, + this.UsState, + this.Zip, + this.Ibs, + this.Height_feet, + this.Height_inches, + this.Ailment, + this.DOB, + this.PhoneNumber, + this.Gender, + this.Medications}); this.dgvPatient.ContextMenuStrip = this.cmuPatient; this.dgvPatient.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically; this.dgvPatient.Location = new System.Drawing.Point(0, 0); @@ -400,9 +415,9 @@ namespace Louis__Pharmacy_CNSA212_FP // DOB // this.DOB.DataPropertyName = "DOB"; - dataGridViewCellStyle3.Format = "d"; - dataGridViewCellStyle3.NullValue = null; - this.DOB.DefaultCellStyle = dataGridViewCellStyle3; + dataGridViewCellStyle1.Format = "d"; + dataGridViewCellStyle1.NullValue = null; + this.DOB.DefaultCellStyle = dataGridViewCellStyle1; this.DOB.HeaderText = "DOB"; this.DOB.MinimumWidth = 6; this.DOB.Name = "DOB"; @@ -439,7 +454,10 @@ namespace Louis__Pharmacy_CNSA212_FP // cmuPatient // this.cmuPatient.ImageScalingSize = new System.Drawing.Size(20, 20); - this.cmuPatient.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.cmuPatientNew, this.cmuPatientEdit, this.cmuPatientDelete }); + this.cmuPatient.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.cmuPatientNew, + this.cmuPatientEdit, + this.cmuPatientDelete}); this.cmuPatient.Name = "contextMenuStrip1"; this.cmuPatient.Size = new System.Drawing.Size(108, 70); // @@ -544,7 +562,14 @@ namespace Louis__Pharmacy_CNSA212_FP this.dgvPrescription.AllowUserToAddRows = false; this.dgvPrescription.AllowUserToDeleteRows = false; this.dgvPrescription.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.dgvPrescription.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.Medication_id, this.MedicationName, this.IntakeMethod, this.Frequency, this.Dosage, this.Purpose, this.RxNum }); + this.dgvPrescription.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.Medication_id, + this.MedicationName, + this.IntakeMethod, + this.Frequency, + this.Dosage, + this.Purpose, + this.RxNum}); this.dgvPrescription.ContextMenuStrip = this.cmuMedication; this.dgvPrescription.Location = new System.Drawing.Point(3, 3); this.dgvPrescription.Name = "dgvPrescription"; @@ -620,7 +645,10 @@ namespace Louis__Pharmacy_CNSA212_FP // cmuMedication // this.cmuMedication.ImageScalingSize = new System.Drawing.Size(20, 20); - this.cmuMedication.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.cmuMedicationNew, this.cmuMedicationEdit, this.cmuMedicationDelete }); + this.cmuMedication.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.cmuMedicationNew, + this.cmuMedicationEdit, + this.cmuMedicationDelete}); this.cmuMedication.Name = "cmuMedication"; this.cmuMedication.Size = new System.Drawing.Size(108, 70); // @@ -729,7 +757,18 @@ namespace Louis__Pharmacy_CNSA212_FP this.dgvPhysician.AllowUserToAddRows = false; this.dgvPhysician.AllowUserToDeleteRows = false; this.dgvPhysician.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.dgvPhysician.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.Phys_id, this.namefirst, this.namelast, this.initialsmiddle, this.cit, this.state, this.zipp, this.dobb, this.numberphone, this.gennder, this.Specialty }); + this.dgvPhysician.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.Phys_id, + this.namefirst, + this.namelast, + this.initialsmiddle, + this.cit, + this.state, + this.zipp, + this.dobb, + this.numberphone, + this.gennder, + this.Specialty}); this.dgvPhysician.ContextMenuStrip = this.cmuPhysician; this.dgvPhysician.Location = new System.Drawing.Point(0, 3); this.dgvPhysician.Name = "dgvPhysician"; @@ -806,9 +845,9 @@ namespace Louis__Pharmacy_CNSA212_FP // dobb // this.dobb.DataPropertyName = "DOB"; - dataGridViewCellStyle4.Format = "d"; - dataGridViewCellStyle4.NullValue = null; - this.dobb.DefaultCellStyle = dataGridViewCellStyle4; + dataGridViewCellStyle2.Format = "d"; + dataGridViewCellStyle2.NullValue = null; + this.dobb.DefaultCellStyle = dataGridViewCellStyle2; this.dobb.HeaderText = "DOB"; this.dobb.MinimumWidth = 6; this.dobb.Name = "dobb"; @@ -845,7 +884,10 @@ namespace Louis__Pharmacy_CNSA212_FP // cmuPhysician // this.cmuPhysician.ImageScalingSize = new System.Drawing.Size(20, 20); - this.cmuPhysician.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.cmuPhysicianNew, this.cmuPhysicianEdit, this.cmuPhysicianDelete }); + this.cmuPhysician.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.cmuPhysicianNew, + this.cmuPhysicianEdit, + this.cmuPhysicianDelete}); this.cmuPhysician.Name = "cmuPhysician"; this.cmuPhysician.Size = new System.Drawing.Size(108, 70); // @@ -978,9 +1020,14 @@ namespace Louis__Pharmacy_CNSA212_FP // cmuPrescription // this.cmuPrescription.ImageScalingSize = new System.Drawing.Size(20, 20); - this.cmuPrescription.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.cmuPrescriptionNew, this.cmuPrescriptionEdit, this.cmuPrescriptionDelete, this.cmuPrescriptionRefillThis, this.cmuPrescriptionViewRefills }); + this.cmuPrescription.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.cmuPrescriptionNew, + this.cmuPrescriptionEdit, + this.cmuPrescriptionDelete, + this.cmuPrescriptionRefillThis, + this.cmuPrescriptionViewRefills}); this.cmuPrescription.Name = "cmuPrescription"; - this.cmuPrescription.Size = new System.Drawing.Size(244, 136); + this.cmuPrescription.Size = new System.Drawing.Size(244, 114); // // cmuPrescriptionNew // @@ -1007,6 +1054,7 @@ namespace Louis__Pharmacy_CNSA212_FP this.cmuPrescriptionRefillThis.Name = "cmuPrescriptionRefillThis"; this.cmuPrescriptionRefillThis.Size = new System.Drawing.Size(243, 22); this.cmuPrescriptionRefillThis.Text = "Refill This Prescription"; + this.cmuPrescriptionRefillThis.Click += new System.EventHandler(this.cmuPrescriptionRefillThis_Click); // // cmuPrescriptionViewRefills // @@ -1055,6 +1103,7 @@ namespace Louis__Pharmacy_CNSA212_FP ((System.ComponentModel.ISupportInitialize)(this.dgvRx)).EndInit(); this.cmuPrescription.ResumeLayout(false); this.ResumeLayout(false); + } private System.Windows.Forms.ToolStripMenuItem cmuPrescriptionViewRefills; diff --git a/Louis'-Pharmacy_CNSA212-FP/frmInfo.cs b/Louis'-Pharmacy_CNSA212-FP/frmInfo.cs index ae67966..0c59fb7 100644 --- a/Louis'-Pharmacy_CNSA212-FP/frmInfo.cs +++ b/Louis'-Pharmacy_CNSA212-FP/frmInfo.cs @@ -707,9 +707,48 @@ namespace Louis__Pharmacy_CNSA212_FP } - private void cmuAddRefill_Click(object sender, EventArgs e) + private void cmuPrescriptionRefillThis_Click(object sender, EventArgs e) { + string refillID = ""; + DateTime date = new DateTime(); + string patientID = ""; + string medicationID = ""; + string rxNum = ""; + Int32 numRefills = 0; + Int32 pastNumRefills = 0; + rxNum = ds.Tables[0].Rows[0]["RxNum_id"].ToString(); + + try + { + DataSet ds = new DataSet(); + PharmacyDataTier phaDT = new PharmacyDataTier(); + + ds = phaDT.NumberofRefills(rxNum); + + numRefills = Int32.Parse(ds.Tables[0].Rows[0]["numRefills"].ToString()); + pastNumRefills = Int32.Parse(ds.Tables[0].Rows[0]["pastNumRefills"].ToString()); + + if (numRefills == pastNumRefills) + { + MessageBox.Show("This prescription has reached the maximum number of refills.", "Max Refill", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + else + { + refillID = PharmacyDataTier.GetNextRefillID().ToString(); + date = DateTime.Now; + patientID = ds.Tables[0].Rows[0]["Patient_id"].ToString() ; + medicationID = ds.Tables[0].Rows[0]["Medication_id"].ToString(); + + PharmacyDataTier.AddRefill(refillID, date, patientID, medicationID, rxNum); + PharmacyDataTier.PastRefills(rxNum); + } + } + catch (Exception exception) + { + + } } } + } }