This commit is contained in:
Adam McCane 2024-02-20 21:43:16 -05:00
commit 6f693d0aa3
7 changed files with 507 additions and 276 deletions

View File

@ -1205,8 +1205,8 @@ namespace Louis__Pharmacy_CNSA212_FP
string Medication_id, string Medication_id,
string Physician_name, string Physician_name,
string Physician_id, string Physician_id,
string Completed_refills, int Completed_refills,
string Max_refills) int Max_refills)
{ {
try try
{ {
@ -1221,12 +1221,12 @@ namespace Louis__Pharmacy_CNSA212_FP
cmdString.CommandText = "CreatePrescription"; cmdString.CommandText = "CreatePrescription";
cmdString.Parameters.Add("@Medication_id", SqlDbType.VarChar, 7).Value = Medication_id; cmdString.Parameters.Add("@Medication_id", SqlDbType.VarChar, 7).Value = Medication_id;
cmdString.Parameters.Add("@numRefills", SqlDbType.VarChar, 60).Value = Completed_refills; cmdString.Parameters.Add("@numRefills", SqlDbType.Int).Value = Completed_refills;
cmdString.Parameters.Add("@pastNumRefills", SqlDbType.VarChar, 30).Value = Max_refills; cmdString.Parameters.Add("@pastNumRefills", SqlDbType.Int).Value = Max_refills;
cmdString.Parameters.Add("@PrescribedBy", SqlDbType.VarChar, 30).Value = Physician_name; cmdString.Parameters.Add("@PrescribedBy", SqlDbType.VarChar, 30).Value = Physician_name;
cmdString.Parameters.Add("@Physician_id", SqlDbType.VarChar, 30).Value = Physician_id; cmdString.Parameters.Add("@Physician_id", SqlDbType.VarChar, 8).Value = Physician_id;
cmdString.Parameters.Add("@Patient_id", SqlDbType.VarChar, 100).Value = Patient_id; cmdString.Parameters.Add("@Patient_id", SqlDbType.VarChar, 8).Value = Patient_id;
cmdString.Parameters.Add("@RxNum", SqlDbType.VarChar, 30).Value = RxNum; cmdString.Parameters.Add("@RxNum", SqlDbType.VarChar, 11).Value = RxNum;
cmdString.ExecuteNonQuery(); cmdString.ExecuteNonQuery();
@ -1247,8 +1247,8 @@ namespace Louis__Pharmacy_CNSA212_FP
string Medication_id, string Medication_id,
string Physician_name, string Physician_name,
string Physician_id, string Physician_id,
string Completed_refills, int Completed_refills,
string Max_refills) int Max_refills)
{ {
try try
{ {

View File

@ -68,11 +68,11 @@ namespace Louis__Pharmacy_CNSA212_FP
this.tbpMedication = new System.Windows.Forms.TabPage(); this.tbpMedication = new System.Windows.Forms.TabPage();
this.splcPrescription = new System.Windows.Forms.SplitContainer(); this.splcPrescription = new System.Windows.Forms.SplitContainer();
this.btnMedicationSearch = new System.Windows.Forms.Button(); this.btnMedicationSearch = new System.Windows.Forms.Button();
this.txtPrescriptionPatID = new System.Windows.Forms.TextBox(); this.txtMedicationName = new System.Windows.Forms.TextBox();
this.txtRxNumber = new System.Windows.Forms.TextBox(); this.txtMedicationNumber = new System.Windows.Forms.TextBox();
this.lblPrescriptionPatID = new System.Windows.Forms.Label(); this.lblPrescriptionPatID = new System.Windows.Forms.Label();
this.lblDisMedicationNum = new System.Windows.Forms.Label(); this.lblDisMedicationNum = new System.Windows.Forms.Label();
this.dgvPrescription = new System.Windows.Forms.DataGridView(); this.dgvMedication = new System.Windows.Forms.DataGridView();
this.Medication_id = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Medication_id = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.MedicationName = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.MedicationName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.IntakeMethod = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.IntakeMethod = new System.Windows.Forms.DataGridViewTextBoxColumn();
@ -117,7 +117,14 @@ namespace Louis__Pharmacy_CNSA212_FP
this.label2 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.btnRxSearch = new System.Windows.Forms.Button(); this.btnRxSearch = new System.Windows.Forms.Button();
this.dgvRx = new System.Windows.Forms.DataGridView(); this.dgvPrescription = new System.Windows.Forms.DataGridView();
this.RxNum_id = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.numRefills = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.pastNumRefills = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.PrescribedBy = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Physician_id = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Medicationid = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Patientid = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.cmuPrescription = new System.Windows.Forms.ContextMenuStrip(this.components); this.cmuPrescription = new System.Windows.Forms.ContextMenuStrip(this.components);
this.cmuPrescriptionNew = new System.Windows.Forms.ToolStripMenuItem(); this.cmuPrescriptionNew = new System.Windows.Forms.ToolStripMenuItem();
this.cmuPrescriptionEdit = new System.Windows.Forms.ToolStripMenuItem(); this.cmuPrescriptionEdit = new System.Windows.Forms.ToolStripMenuItem();
@ -141,7 +148,7 @@ namespace Louis__Pharmacy_CNSA212_FP
this.splcPrescription.Panel1.SuspendLayout(); this.splcPrescription.Panel1.SuspendLayout();
this.splcPrescription.Panel2.SuspendLayout(); this.splcPrescription.Panel2.SuspendLayout();
this.splcPrescription.SuspendLayout(); this.splcPrescription.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgvPrescription)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dgvMedication)).BeginInit();
this.cmuMedication.SuspendLayout(); this.cmuMedication.SuspendLayout();
this.tbpPhysician.SuspendLayout(); this.tbpPhysician.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splcPhysician)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.splcPhysician)).BeginInit();
@ -151,7 +158,7 @@ namespace Louis__Pharmacy_CNSA212_FP
((System.ComponentModel.ISupportInitialize)(this.dgvPhysician)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dgvPhysician)).BeginInit();
this.cmuPhysician.SuspendLayout(); this.cmuPhysician.SuspendLayout();
this.tbcInfoPrescriptions.SuspendLayout(); this.tbcInfoPrescriptions.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgvRx)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dgvPrescription)).BeginInit();
this.cmuPrescription.SuspendLayout(); this.cmuPrescription.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
@ -222,6 +229,7 @@ namespace Louis__Pharmacy_CNSA212_FP
// //
// splcPatient.Panel1 // splcPatient.Panel1
// //
this.splcPatient.Panel1.ContextMenuStrip = this.cmuPatient;
this.splcPatient.Panel1.Controls.Add(this.txtPatientID); this.splcPatient.Panel1.Controls.Add(this.txtPatientID);
this.splcPatient.Panel1.Controls.Add(this.lblPatientID); this.splcPatient.Panel1.Controls.Add(this.lblPatientID);
this.splcPatient.Panel1.Controls.Add(lblPatientLast); this.splcPatient.Panel1.Controls.Add(lblPatientLast);
@ -501,15 +509,16 @@ namespace Louis__Pharmacy_CNSA212_FP
// //
// splcPrescription.Panel1 // splcPrescription.Panel1
// //
this.splcPrescription.Panel1.ContextMenuStrip = this.cmuMedication;
this.splcPrescription.Panel1.Controls.Add(this.btnMedicationSearch); this.splcPrescription.Panel1.Controls.Add(this.btnMedicationSearch);
this.splcPrescription.Panel1.Controls.Add(this.txtPrescriptionPatID); this.splcPrescription.Panel1.Controls.Add(this.txtMedicationName);
this.splcPrescription.Panel1.Controls.Add(this.txtRxNumber); this.splcPrescription.Panel1.Controls.Add(this.txtMedicationNumber);
this.splcPrescription.Panel1.Controls.Add(this.lblPrescriptionPatID); this.splcPrescription.Panel1.Controls.Add(this.lblPrescriptionPatID);
this.splcPrescription.Panel1.Controls.Add(this.lblDisMedicationNum); this.splcPrescription.Panel1.Controls.Add(this.lblDisMedicationNum);
// //
// splcPrescription.Panel2 // splcPrescription.Panel2
// //
this.splcPrescription.Panel2.Controls.Add(this.dgvPrescription); this.splcPrescription.Panel2.Controls.Add(this.dgvMedication);
this.splcPrescription.Size = new System.Drawing.Size(733, 484); this.splcPrescription.Size = new System.Drawing.Size(733, 484);
this.splcPrescription.SplitterDistance = 241; this.splcPrescription.SplitterDistance = 241;
this.splcPrescription.TabIndex = 0; this.splcPrescription.TabIndex = 0;
@ -522,20 +531,21 @@ namespace Louis__Pharmacy_CNSA212_FP
this.btnMedicationSearch.TabIndex = 4; this.btnMedicationSearch.TabIndex = 4;
this.btnMedicationSearch.Text = "Search"; this.btnMedicationSearch.Text = "Search";
this.btnMedicationSearch.UseVisualStyleBackColor = true; this.btnMedicationSearch.UseVisualStyleBackColor = true;
this.btnMedicationSearch.Click += new System.EventHandler(this.btnMedicationSearch_Click);
// //
// txtPrescriptionPatID // txtMedicationName
// //
this.txtPrescriptionPatID.Location = new System.Drawing.Point(184, 74); this.txtMedicationName.Location = new System.Drawing.Point(184, 74);
this.txtPrescriptionPatID.Name = "txtPrescriptionPatID"; this.txtMedicationName.Name = "txtMedicationName";
this.txtPrescriptionPatID.Size = new System.Drawing.Size(100, 20); this.txtMedicationName.Size = new System.Drawing.Size(100, 20);
this.txtPrescriptionPatID.TabIndex = 3; this.txtMedicationName.TabIndex = 3;
// //
// txtRxNumber // txtMedicationNumber
// //
this.txtRxNumber.Location = new System.Drawing.Point(184, 51); this.txtMedicationNumber.Location = new System.Drawing.Point(184, 51);
this.txtRxNumber.Name = "txtRxNumber"; this.txtMedicationNumber.Name = "txtMedicationNumber";
this.txtRxNumber.Size = new System.Drawing.Size(100, 20); this.txtMedicationNumber.Size = new System.Drawing.Size(100, 20);
this.txtRxNumber.TabIndex = 2; this.txtMedicationNumber.TabIndex = 2;
// //
// lblPrescriptionPatID // lblPrescriptionPatID
// //
@ -557,27 +567,20 @@ namespace Louis__Pharmacy_CNSA212_FP
this.lblDisMedicationNum.Text = "Medication ID:"; this.lblDisMedicationNum.Text = "Medication ID:";
this.lblDisMedicationNum.Click += new System.EventHandler(this.lblDisMedicationNum_Click); this.lblDisMedicationNum.Click += new System.EventHandler(this.lblDisMedicationNum_Click);
// //
// dgvPrescription // dgvMedication
// //
this.dgvPrescription.AllowUserToAddRows = false; this.dgvMedication.AllowUserToAddRows = false;
this.dgvPrescription.AllowUserToDeleteRows = false; this.dgvMedication.AllowUserToDeleteRows = false;
this.dgvPrescription.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dgvMedication.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvPrescription.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.dgvMedication.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.Medication_id, this.MedicationName, this.IntakeMethod, this.Frequency, this.Dosage, this.Purpose, this.RxNum });
this.Medication_id, this.dgvMedication.ContextMenuStrip = this.cmuMedication;
this.MedicationName, this.dgvMedication.Location = new System.Drawing.Point(3, 3);
this.IntakeMethod, this.dgvMedication.Name = "dgvMedication";
this.Frequency, this.dgvMedication.ReadOnly = true;
this.Dosage, this.dgvMedication.RowHeadersWidth = 51;
this.Purpose, this.dgvMedication.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.RxNum}); this.dgvMedication.Size = new System.Drawing.Size(730, 237);
this.dgvPrescription.ContextMenuStrip = this.cmuMedication; this.dgvMedication.TabIndex = 0;
this.dgvPrescription.Location = new System.Drawing.Point(3, 3);
this.dgvPrescription.Name = "dgvPrescription";
this.dgvPrescription.ReadOnly = true;
this.dgvPrescription.RowHeadersWidth = 51;
this.dgvPrescription.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.dgvPrescription.Size = new System.Drawing.Size(730, 237);
this.dgvPrescription.TabIndex = 0;
// //
// Medication_id // Medication_id
// //
@ -664,7 +667,7 @@ namespace Louis__Pharmacy_CNSA212_FP
this.cmuMedicationEdit.Name = "cmuMedicationEdit"; this.cmuMedicationEdit.Name = "cmuMedicationEdit";
this.cmuMedicationEdit.Size = new System.Drawing.Size(107, 22); this.cmuMedicationEdit.Size = new System.Drawing.Size(107, 22);
this.cmuMedicationEdit.Text = "Edit"; this.cmuMedicationEdit.Text = "Edit";
this.cmuMedicationEdit.Click += new System.EventHandler(this.cmuRxEdit_Click); this.cmuMedicationEdit.Click += new System.EventHandler(this.cmuMedicationEdit_Click);
// //
// cmuMedicationDelete // cmuMedicationDelete
// //
@ -694,6 +697,7 @@ namespace Louis__Pharmacy_CNSA212_FP
// splcPhysician.Panel1 // splcPhysician.Panel1
// //
this.splcPhysician.Panel1.AutoScroll = true; this.splcPhysician.Panel1.AutoScroll = true;
this.splcPhysician.Panel1.ContextMenuStrip = this.cmuPhysician;
this.splcPhysician.Panel1.Controls.Add(this.txtPhysicianID); this.splcPhysician.Panel1.Controls.Add(this.txtPhysicianID);
this.splcPhysician.Panel1.Controls.Add(this.lblPhysicianID); this.splcPhysician.Panel1.Controls.Add(this.lblPhysicianID);
this.splcPhysician.Panel1.Controls.Add(lblPhysicianLast); this.splcPhysician.Panel1.Controls.Add(lblPhysicianLast);
@ -914,6 +918,7 @@ namespace Louis__Pharmacy_CNSA212_FP
// //
// tbcInfoPrescriptions // tbcInfoPrescriptions
// //
this.tbcInfoPrescriptions.ContextMenuStrip = this.cmuPrescription;
this.tbcInfoPrescriptions.Controls.Add(this.txtRxPatientID); this.tbcInfoPrescriptions.Controls.Add(this.txtRxPatientID);
this.tbcInfoPrescriptions.Controls.Add(this.txtRxMedicationID); this.tbcInfoPrescriptions.Controls.Add(this.txtRxMedicationID);
this.tbcInfoPrescriptions.Controls.Add(this.txtRxPhysicianID); this.tbcInfoPrescriptions.Controls.Add(this.txtRxPhysicianID);
@ -923,7 +928,7 @@ namespace Louis__Pharmacy_CNSA212_FP
this.tbcInfoPrescriptions.Controls.Add(this.label2); this.tbcInfoPrescriptions.Controls.Add(this.label2);
this.tbcInfoPrescriptions.Controls.Add(this.label1); this.tbcInfoPrescriptions.Controls.Add(this.label1);
this.tbcInfoPrescriptions.Controls.Add(this.btnRxSearch); this.tbcInfoPrescriptions.Controls.Add(this.btnRxSearch);
this.tbcInfoPrescriptions.Controls.Add(this.dgvRx); this.tbcInfoPrescriptions.Controls.Add(this.dgvPrescription);
this.tbcInfoPrescriptions.Location = new System.Drawing.Point(4, 22); this.tbcInfoPrescriptions.Location = new System.Drawing.Point(4, 22);
this.tbcInfoPrescriptions.Name = "tbcInfoPrescriptions"; this.tbcInfoPrescriptions.Name = "tbcInfoPrescriptions";
this.tbcInfoPrescriptions.Padding = new System.Windows.Forms.Padding(3); this.tbcInfoPrescriptions.Padding = new System.Windows.Forms.Padding(3);
@ -1005,20 +1010,70 @@ namespace Louis__Pharmacy_CNSA212_FP
this.btnRxSearch.TabIndex = 1; this.btnRxSearch.TabIndex = 1;
this.btnRxSearch.Text = "Search"; this.btnRxSearch.Text = "Search";
this.btnRxSearch.UseVisualStyleBackColor = true; this.btnRxSearch.UseVisualStyleBackColor = true;
this.btnRxSearch.Click += new System.EventHandler(this.btnRxSearch_Click); this.btnRxSearch.Click += new System.EventHandler(this.btnPrescriptionSearch_Click);
// //
// dgvRx // dgvPrescription
// //
this.dgvRx.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dgvPrescription.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvRx.ContextMenuStrip = this.cmuPrescription; this.dgvPrescription.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.RxNum_id, this.numRefills, this.pastNumRefills, this.PrescribedBy, this.Physician_id, this.Medicationid, this.Patientid });
this.dgvRx.Location = new System.Drawing.Point(0, 236); this.dgvPrescription.ContextMenuStrip = this.cmuPrescription;
this.dgvRx.Name = "dgvRx"; this.dgvPrescription.Location = new System.Drawing.Point(0, 236);
this.dgvRx.ReadOnly = true; this.dgvPrescription.Name = "dgvPrescription";
this.dgvRx.RowHeadersWidth = 51; this.dgvPrescription.ReadOnly = true;
this.dgvRx.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.dgvPrescription.RowHeadersWidth = 51;
this.dgvRx.Size = new System.Drawing.Size(730, 248); this.dgvPrescription.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.dgvRx.TabIndex = 0; this.dgvPrescription.Size = new System.Drawing.Size(730, 248);
this.dgvRx.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvRx_CellContentClick); this.dgvPrescription.TabIndex = 0;
this.dgvPrescription.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvRx_CellContentClick);
//
// RxNum_id
//
this.RxNum_id.DataPropertyName = "RxNum_id";
this.RxNum_id.HeaderText = "Prescription ID";
this.RxNum_id.Name = "RxNum_id";
this.RxNum_id.ReadOnly = true;
//
// numRefills
//
this.numRefills.DataPropertyName = "numRefills";
this.numRefills.HeaderText = "Allowed Refills";
this.numRefills.Name = "numRefills";
this.numRefills.ReadOnly = true;
//
// pastNumRefills
//
this.pastNumRefills.DataPropertyName = "pastNumRefills";
this.pastNumRefills.HeaderText = "Refills Used";
this.pastNumRefills.Name = "pastNumRefills";
this.pastNumRefills.ReadOnly = true;
//
// PrescribedBy
//
this.PrescribedBy.DataPropertyName = "PrescribedBy";
this.PrescribedBy.HeaderText = "Prescribed By";
this.PrescribedBy.Name = "PrescribedBy";
this.PrescribedBy.ReadOnly = true;
//
// Physician_id
//
this.Physician_id.DataPropertyName = "Physician_id";
this.Physician_id.HeaderText = "Physician ID";
this.Physician_id.Name = "Physician_id";
this.Physician_id.ReadOnly = true;
//
// Medicationid
//
this.Medicationid.DataPropertyName = "Medication_id";
this.Medicationid.HeaderText = "Medication ID";
this.Medicationid.Name = "Medicationid";
this.Medicationid.ReadOnly = true;
//
// Patientid
//
this.Patientid.DataPropertyName = "Patient_id";
this.Patientid.HeaderText = "Patient ID";
this.Patientid.Name = "Patientid";
this.Patientid.ReadOnly = true;
// //
// cmuPrescription // cmuPrescription
// //
@ -1093,7 +1148,7 @@ namespace Louis__Pharmacy_CNSA212_FP
this.splcPrescription.Panel2.ResumeLayout(false); this.splcPrescription.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splcPrescription)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.splcPrescription)).EndInit();
this.splcPrescription.ResumeLayout(false); this.splcPrescription.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dgvPrescription)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dgvMedication)).EndInit();
this.cmuMedication.ResumeLayout(false); this.cmuMedication.ResumeLayout(false);
this.tbpPhysician.ResumeLayout(false); this.tbpPhysician.ResumeLayout(false);
this.splcPhysician.Panel1.ResumeLayout(false); this.splcPhysician.Panel1.ResumeLayout(false);
@ -1105,12 +1160,20 @@ namespace Louis__Pharmacy_CNSA212_FP
this.cmuPhysician.ResumeLayout(false); this.cmuPhysician.ResumeLayout(false);
this.tbcInfoPrescriptions.ResumeLayout(false); this.tbcInfoPrescriptions.ResumeLayout(false);
this.tbcInfoPrescriptions.PerformLayout(); this.tbcInfoPrescriptions.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.dgvRx)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dgvPrescription)).EndInit();
this.cmuPrescription.ResumeLayout(false); this.cmuPrescription.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
} }
private System.Windows.Forms.DataGridViewTextBoxColumn RxNum_id;
private System.Windows.Forms.DataGridViewTextBoxColumn numRefills;
private System.Windows.Forms.DataGridViewTextBoxColumn pastNumRefills;
private System.Windows.Forms.DataGridViewTextBoxColumn PrescribedBy;
private System.Windows.Forms.DataGridViewTextBoxColumn Physician_id;
private System.Windows.Forms.DataGridViewTextBoxColumn Medicationid;
private System.Windows.Forms.DataGridViewTextBoxColumn Patientid;
private System.Windows.Forms.ToolStripMenuItem cmuPrescriptionViewRefills; private System.Windows.Forms.ToolStripMenuItem cmuPrescriptionViewRefills;
private System.Windows.Forms.TextBox txtRxPhysicianID; private System.Windows.Forms.TextBox txtRxPhysicianID;
@ -1118,7 +1181,7 @@ namespace Louis__Pharmacy_CNSA212_FP
private System.Windows.Forms.TextBox txtRxPatientID; private System.Windows.Forms.TextBox txtRxPatientID;
private System.Windows.Forms.Button btnRxSearch; private System.Windows.Forms.Button btnRxSearch;
private System.Windows.Forms.DataGridView dgvRx; private System.Windows.Forms.DataGridView dgvPrescription;
private System.Windows.Forms.ContextMenuStrip cmuPrescription; private System.Windows.Forms.ContextMenuStrip cmuPrescription;
private System.Windows.Forms.ToolStripMenuItem cmuPrescriptionNew; private System.Windows.Forms.ToolStripMenuItem cmuPrescriptionNew;
@ -1157,10 +1220,10 @@ namespace Louis__Pharmacy_CNSA212_FP
private System.Windows.Forms.SplitContainer splcPatient; private System.Windows.Forms.SplitContainer splcPatient;
private System.Windows.Forms.SplitContainer splcPrescription; private System.Windows.Forms.SplitContainer splcPrescription;
private System.Windows.Forms.Button btnPatientSearch; private System.Windows.Forms.Button btnPatientSearch;
public System.Windows.Forms.TextBox txtRxNumber; public System.Windows.Forms.TextBox txtMedicationNumber;
private System.Windows.Forms.Label lblPrescriptionPatID; private System.Windows.Forms.Label lblPrescriptionPatID;
private System.Windows.Forms.Label lblDisMedicationNum; private System.Windows.Forms.Label lblDisMedicationNum;
private System.Windows.Forms.TextBox txtPrescriptionPatID; private System.Windows.Forms.TextBox txtMedicationName;
private System.Windows.Forms.Button btnMedicationSearch; private System.Windows.Forms.Button btnMedicationSearch;
private System.Windows.Forms.Button btnPhysicianSearch; private System.Windows.Forms.Button btnPhysicianSearch;
private System.Windows.Forms.TextBox txtPatientLast; private System.Windows.Forms.TextBox txtPatientLast;
@ -1169,7 +1232,7 @@ namespace Louis__Pharmacy_CNSA212_FP
private System.Windows.Forms.TextBox txtPhysicianLast; private System.Windows.Forms.TextBox txtPhysicianLast;
private System.Windows.Forms.TextBox txtPhysicianFirst; private System.Windows.Forms.TextBox txtPhysicianFirst;
private System.Windows.Forms.DataGridView dgvPhysician; private System.Windows.Forms.DataGridView dgvPhysician;
private System.Windows.Forms.DataGridView dgvPrescription; private System.Windows.Forms.DataGridView dgvMedication;
private System.Windows.Forms.DataGridViewTextBoxColumn pat_id; private System.Windows.Forms.DataGridViewTextBoxColumn pat_id;
private System.Windows.Forms.DataGridViewTextBoxColumn FirstName; private System.Windows.Forms.DataGridViewTextBoxColumn FirstName;
private System.Windows.Forms.DataGridViewTextBoxColumn LastName; private System.Windows.Forms.DataGridViewTextBoxColumn LastName;
@ -1205,7 +1268,7 @@ namespace Louis__Pharmacy_CNSA212_FP
System.Windows.Forms.Label label2 = new System.Windows.Forms.Label(); System.Windows.Forms.Label label2 = new System.Windows.Forms.Label();
System.Windows.Forms.Label label3 = new System.Windows.Forms.Label(); System.Windows.Forms.Label label3 = new System.Windows.Forms.Label();
System.Windows.Forms.Label label4 = new System.Windows.Forms.Label(); System.Windows.Forms.Label label4 = new System.Windows.Forms.Label();
System.Windows.Forms.TextBox txtRxPrescriptionID = new System.Windows.Forms.TextBox(); public System.Windows.Forms.TextBox txtRxPrescriptionID;
private System.Windows.Forms.ToolStripMenuItem cmuPrescriptionRefillThis; private System.Windows.Forms.ToolStripMenuItem cmuPrescriptionRefillThis;
} }
} }

View File

@ -25,7 +25,8 @@ namespace Louis__Pharmacy_CNSA212_FP
dgvPatient.DoubleClick += cmuPatientEdit_Click; dgvPatient.DoubleClick += cmuPatientEdit_Click;
dgvPhysician.DoubleClick += cmuPhysicianEdit_Click; dgvPhysician.DoubleClick += cmuPhysicianEdit_Click;
dgvRx.DoubleClick += cmuRxEdit_Click; dgvPrescription.DoubleClick += cmuPrescriptionEdit_Click;
dgvMedication.DoubleClick += cmuMedicationEdit_Click;
tbcInfo.SelectedIndexChanged += frmInfoTabChange; tbcInfo.SelectedIndexChanged += frmInfoTabChange;
@ -43,6 +44,13 @@ namespace Louis__Pharmacy_CNSA212_FP
cmuPhysicianDelete.Enabled = false; cmuPhysicianDelete.Enabled = false;
cmuMedicationEdit.Enabled = false; cmuMedicationEdit.Enabled = false;
cmuMedicationDelete.Enabled = false; cmuMedicationDelete.Enabled = false;
cmuPrescriptionEdit.Enabled = false;
cmuPrescriptionDelete.Enabled = false;
dgvMedication.Visible = false;
dgvPatient.Visible = false;
dgvPhysician.Visible = false;
dgvPrescription.Visible = false;
txtPatientFirst.Focus(); txtPatientFirst.Focus();
@ -137,7 +145,7 @@ namespace Louis__Pharmacy_CNSA212_FP
// if data grid view is not focused, run the search function // if data grid view is not focused, run the search function
if (e.KeyCode == Keys.Enter && prescriptionIsActive && !dgvPrescription.Focused) if (e.KeyCode == Keys.Enter && prescriptionIsActive && !dgvPrescription.Focused)
{ {
btnPatientSearch_Click(sender,e); btnPrescriptionSearch_Click(sender,e);
} }
// if data grid view is focused, run the edit function // if data grid view is focused, run the edit function
else if (e.KeyCode == Keys.Enter && prescriptionIsActive && dgvPrescription.Focused) else if (e.KeyCode == Keys.Enter && prescriptionIsActive && dgvPrescription.Focused)
@ -148,14 +156,14 @@ namespace Louis__Pharmacy_CNSA212_FP
// if data grid view is not focused, run the search function // if data grid view is not focused, run the search function
if (e.KeyCode == Keys.Enter && medicationIsActive && !dgvRx.Focused) if (e.KeyCode == Keys.Enter && medicationIsActive && !dgvMedication.Focused)
{ {
btnRxSearch_Click(sender,e); btnMedicationSearch_Click(sender,e);
} }
// if data grid view is focused, run the edit function // if data grid view is focused, run the edit function
else if (e.KeyCode == Keys.Enter && medicationIsActive && dgvRx.Focused) else if (e.KeyCode == Keys.Enter && medicationIsActive && dgvMedication.Focused)
{ {
cmuRxEdit_Click(sender,e); cmuMedicationEdit_Click(sender,e);
} }
@ -259,6 +267,7 @@ namespace Louis__Pharmacy_CNSA212_FP
cmuPatientEdit.Enabled = dgvPatient.Rows.Count > 0; cmuPatientEdit.Enabled = dgvPatient.Rows.Count > 0;
cmuPatientDelete.Enabled = dgvPatient.Rows.Count > 0; cmuPatientDelete.Enabled = dgvPatient.Rows.Count > 0;
dgvPatient.Visible = dgvPatient.Rows.Count > 0;
dgvPatient.Focus(); dgvPatient.Focus();
@ -433,6 +442,9 @@ namespace Louis__Pharmacy_CNSA212_FP
cmuPhysicianEdit.Enabled = dgvPhysician.Rows.Count > 0; cmuPhysicianEdit.Enabled = dgvPhysician.Rows.Count > 0;
cmuPhysicianDelete.Enabled = dgvPhysician.Rows.Count > 0; cmuPhysicianDelete.Enabled = dgvPhysician.Rows.Count > 0;
dgvPhysician.Visible = dgvPhysician.Rows.Count > 0;
dgvPhysician.Focus(); dgvPhysician.Focus();
} }
@ -584,14 +596,14 @@ namespace Louis__Pharmacy_CNSA212_FP
medicationAdd.Focus(); medicationAdd.Focus();
} }
private void cmuRxEdit_Click(object sender, EventArgs e) private void cmuMedicationEdit_Click(object sender, EventArgs e)
{ {
if (dgvRx.Rows.Count > 0) if (dgvMedication.Rows.Count > 0)
{ {
dgvRx.DataSource = ds.Tables[0]; dgvMedication.DataSource = ds.Tables[0];
DataGridViewRow row = new DataGridViewRow(); DataGridViewRow row = new DataGridViewRow();
row = dgvRx.SelectedRows[0]; row = dgvMedication.SelectedRows[0];
string rxID = ""; string rxID = "";
rxID = (row.Cells[0].Value).ToString(); rxID = (row.Cells[0].Value).ToString();
frmMedication prescriptionAdd = new frmMedication(this, false); frmMedication prescriptionAdd = new frmMedication(this, false);
@ -608,12 +620,12 @@ namespace Louis__Pharmacy_CNSA212_FP
if (dgvRx.Rows.Count > 0) if (dgvPrescription.Rows.Count > 0)
{ {
dgvRx.DataSource = ds.Tables[0]; dgvPrescription.DataSource = ds.Tables[0];
DataGridViewRow row = new DataGridViewRow(); DataGridViewRow row = new DataGridViewRow();
row = dgvRx.SelectedRows[0]; row = dgvPrescription.SelectedRows[0];
string medID = ""; string medID = "";
medID = (row.Cells[0].Value).ToString(); medID = (row.Cells[0].Value).ToString();
@ -623,7 +635,7 @@ namespace Louis__Pharmacy_CNSA212_FP
{ {
PharmacyDataTier.DeleteMedication(medID); PharmacyDataTier.DeleteMedication(medID);
} }
btnRxSearch_Click(sender, e); btnPrescriptionSearch_Click(sender, e);
} }
} }
@ -646,13 +658,13 @@ namespace Louis__Pharmacy_CNSA212_FP
private void cmuPrescriptionEdit_Click(object sender, EventArgs e) private void cmuPrescriptionEdit_Click(object sender, EventArgs e)
{ {
if (dgvRx.Rows.Count > 0) if (dgvPrescription.Rows.Count > 0)
{ {
dgvRx.DataSource = ds.Tables[0]; dgvPrescription.DataSource = ds.Tables[0];
// Console.WriteLine( dgvPatient.SelectedRows.Count); // Console.WriteLine( dgvPatient.SelectedRows.Count);
DataGridViewRow row = new DataGridViewRow(); DataGridViewRow row = new DataGridViewRow();
row = dgvRx.SelectedRows[0]; row = dgvPrescription.SelectedRows[0];
string prescID = ""; string prescID = "";
prescID = (row.Cells[0].Value).ToString(); prescID = (row.Cells[0].Value).ToString();
frmPrescription PrescriptionAdd = new frmPrescription(this, false); frmPrescription PrescriptionAdd = new frmPrescription(this, false);
@ -670,12 +682,12 @@ namespace Louis__Pharmacy_CNSA212_FP
{ {
if (dgvRx.Rows.Count > 0) if (dgvPrescription.Rows.Count > 0)
{ {
dgvRx.DataSource = ds.Tables[0]; dgvPrescription.DataSource = ds.Tables[0];
DataGridViewRow row = new DataGridViewRow(); DataGridViewRow row = new DataGridViewRow();
row = dgvRx.SelectedRows[0]; row = dgvPrescription.SelectedRows[0];
string PresID = ""; string PresID = "";
PresID = (row.Cells[0].Value).ToString(); PresID = (row.Cells[0].Value).ToString();
@ -685,7 +697,7 @@ namespace Louis__Pharmacy_CNSA212_FP
{ {
PharmacyDataTier.DeletePrescription(PresID); PharmacyDataTier.DeletePrescription(PresID);
} }
btnRxSearch_Click(sender, e); btnPrescriptionSearch_Click(sender, e);
} }
} }
@ -699,7 +711,7 @@ namespace Louis__Pharmacy_CNSA212_FP
medicationAdd.Focus(); medicationAdd.Focus();
} }
private void btnRxSearch_Click(object sender, EventArgs e) public void btnPrescriptionSearch_Click(object sender, EventArgs e)
{ {
string rxNum = ""; string rxNum = "";
string physID = ""; string physID = "";
@ -729,14 +741,14 @@ namespace Louis__Pharmacy_CNSA212_FP
if (ds.Tables[0].Rows.Count > 0) // There is a record. if (ds.Tables[0].Rows.Count > 0) // There is a record.
{ {
dgvRx.Visible = true; dgvPrescription.Visible = true;
// Get data source. // Get data source.
dgvRx.DataSource = ds.Tables[0]; dgvPrescription.DataSource = ds.Tables[0];
dgvRx.AlternatingRowsDefaultCellStyle.BackColor = Color.LightGreen; dgvPrescription.AlternatingRowsDefaultCellStyle.BackColor = Color.LightGreen;
// Set the row and column header styles. // Set the row and column header styles.
dgvRx.ColumnHeadersDefaultCellStyle.ForeColor = Color.White; dgvPrescription.ColumnHeadersDefaultCellStyle.ForeColor = Color.White;
dgvRx.ColumnHeadersDefaultCellStyle.BackColor = Color.Green; dgvPrescription.ColumnHeadersDefaultCellStyle.BackColor = Color.Green;
} }
else else
{ {
@ -757,16 +769,18 @@ namespace Louis__Pharmacy_CNSA212_FP
catch (Exception exception) catch (Exception exception)
{ {
ep1.SetError(txtPrescriptionPatID, "Invalid Value"); ep1.SetError(txtMedicationName, "Invalid Value");
} }
} }
cmuMedicationEdit.Enabled = dgvRx.Rows.Count > 0; cmuPrescriptionEdit.Enabled = dgvPrescription.Rows.Count > 0;
cmuMedicationDelete.Enabled = dgvRx.Rows.Count > 0; cmuPrescriptionDelete.Enabled = dgvPrescription.Rows.Count > 0;
dgvRx.Focus(); dgvPrescription.Visible = dgvPrescription.Rows.Count > 0;
dgvPrescription.Focus();
} }
@ -823,16 +837,86 @@ namespace Louis__Pharmacy_CNSA212_FP
} }
private void cmuPrescriptionViewRefills_Click(object sender, EventArgs e) public void btnMedicationSearch_Click(object sender, EventArgs e)
{ {
string rxID = "";
rxID = ds.Tables[0].Rows[0]["RxNum_id"].ToString(); string medID = "";
string medicationName = "";
frmRefill refill = new frmRefill();
if (txtMedicationName.Text.Length+txtMedicationNumber.Text.Length > 0)
{
try
{
medicationName = txtMedicationName.Text;
try
{
medID = txtMedicationNumber.Text;
try
{
ds = PharmacyDataTier.MedicationInfoSearch(medID,medicationName);
if (ds.Tables[0].Rows.Count > 0) // There is a record.
{
dgvMedication.Visible = true;
// Get data source.
dgvMedication.DataSource = ds.Tables[0];
dgvMedication.AlternatingRowsDefaultCellStyle.BackColor = Color.LightGreen;
// Set the row and column header styles.
dgvMedication.ColumnHeadersDefaultCellStyle.ForeColor = Color.White;
dgvMedication.ColumnHeadersDefaultCellStyle.BackColor = Color.Green;
}
else
{
dgvMedication.Visible = false; // Hide the DataGridView if no results are found.
MessageBox.Show("No records found.");
}
}
catch (Exception exception)
{
ep1.SetError(btnMedicationSearch, "Error Searching");
}
}
catch (Exception exception)
{
ep1.SetError(txtMedicationNumber, "Invalid Value");
}
}
catch (Exception exception)
{
ep1.SetError(txtMedicationName, "Invalid Value");
}
}
cmuMedicationEdit.Enabled = dgvMedication.Rows.Count > 0;
cmuMedicationDelete.Enabled = dgvMedication.Rows.Count > 0;
dgvMedication.Visible = dgvMedication.Rows.Count > 0;
dgvMedication.Focus();
} }
} }
} }

View File

@ -129,6 +129,9 @@
<metadata name="lblPhysicianLast.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="lblPhysicianLast.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value> <value>False</value>
</metadata> </metadata>
<metadata name="cmuPatient.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="pat_id.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="pat_id.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
@ -174,8 +177,8 @@
<metadata name="Medications.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="Medications.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="cmuPatient.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="cmuMedication.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value> <value>125, 17</value>
</metadata> </metadata>
<metadata name="Medication_id.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="Medication_id.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
@ -198,8 +201,8 @@
<metadata name="RxNum.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="RxNum.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="cmuMedication.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="cmuPhysician.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>125, 17</value> <value>211, 17</value>
</metadata> </metadata>
<metadata name="Phys_id.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="Phys_id.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
@ -234,12 +237,30 @@
<metadata name="Specialty.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="Specialty.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="cmuPhysician.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>211, 17</value>
</metadata>
<metadata name="cmuPrescription.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="cmuPrescription.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>332, 17</value> <value>332, 17</value>
</metadata> </metadata>
<metadata name="RxNum_id.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="numRefills.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="pastNumRefills.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="PrescribedBy.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Physician_id.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Medicationid.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Patientid.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>

View File

@ -216,8 +216,8 @@ namespace Louis__Pharmacy_CNSA212_FP
RxNum); RxNum);
} }
SourceForm.txtRxNumber.Text = Medication_id; SourceForm.txtMedicationNumber.Text = Medication_id;
//SourceForm.btnPrescriptionSearch_Click(sender, e); SourceForm.btnMedicationSearch_Click(sender, e);
Close(); Close();

View File

@ -131,6 +131,7 @@ namespace Louis__Pharmacy_CNSA212_FP
this.btnCancel.TabIndex = 25; this.btnCancel.TabIndex = 25;
this.btnCancel.Text = "Cancel"; this.btnCancel.Text = "Cancel";
this.btnCancel.UseVisualStyleBackColor = true; this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click_1);
// //
// btnGO // btnGO
// //
@ -140,7 +141,7 @@ namespace Louis__Pharmacy_CNSA212_FP
this.btnGO.Size = new System.Drawing.Size(67, 23); this.btnGO.Size = new System.Drawing.Size(67, 23);
this.btnGO.TabIndex = 24; this.btnGO.TabIndex = 24;
this.btnGO.UseVisualStyleBackColor = true; this.btnGO.UseVisualStyleBackColor = true;
this.btnGO.Click += new System.EventHandler(this.btnGO_Click_2); this.btnGO.Click += new System.EventHandler(this.btnGO_Click);
// //
// label7 // label7
// //
@ -149,7 +150,7 @@ namespace Louis__Pharmacy_CNSA212_FP
this.label7.Name = "label7"; this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(109, 28); this.label7.Size = new System.Drawing.Size(109, 28);
this.label7.TabIndex = 23; this.label7.TabIndex = 23;
this.label7.Text = "Max Refills:"; this.label7.Text = "Refills Allowed:";
this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
// //
// label6 // label6
@ -159,7 +160,7 @@ namespace Louis__Pharmacy_CNSA212_FP
this.label6.Name = "label6"; this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(109, 28); this.label6.Size = new System.Drawing.Size(109, 28);
this.label6.TabIndex = 22; this.label6.TabIndex = 22;
this.label6.Text = "Completed Refills:"; this.label6.Text = "Refills Used:";
this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
// //
// label5 // label5

View File

@ -87,153 +87,153 @@ namespace Louis__Pharmacy_CNSA212_FP
Close(); Close();
} }
private void btnGO_Click(object sender, EventArgs e) // private void btnGO_Click(object sender, EventArgs e)
{ // {
//
var hasFailed = false; // var hasFailed = false;
//
var Patient_id = ""; // var Patient_id = "";
var Medication_id = ""; // var Medication_id = "";
var Physician_name = ""; // var Physician_name = "";
var Physician_id = ""; // var Physician_id = "";
var Completed_refills = ""; // var Completed_refills = "";
var Max_refills = ""; // var Max_refills = "";
var RxNum = ""; // var RxNum = "";
//
//
if (txtMedID.Text.Length + txtPhysName.Text.Length + txtMedID.Text.Length + txtPhysID.Text.Length + txtCompletedRefills.Text.Length + txtMaxRefills.Text.Length + txtRxNum.Text.Length > 0) // if (txtMedID.Text.Length + txtPhysName.Text.Length + txtMedID.Text.Length + txtPhysID.Text.Length + txtCompletedRefills.Text.Length + txtMaxRefills.Text.Length + txtRxNum.Text.Length > 0)
{ // {
//
try // try
{ // {
//
Patient_id = txtPatID.Text; // Patient_id = txtPatID.Text;
//
if (Patient_id.Length > 8) // if (Patient_id.Length > 8)
{ // {
throw new Exception(); // throw new Exception();
}else // }else
while (Patient_id.Length < 8) // while (Patient_id.Length < 8)
{ // {
Patient_id = "0" + Patient_id; // Patient_id = "0" + Patient_id;
} // }
//
} // }
catch (Exception exception) // catch (Exception exception)
{ // {
epLocal.SetError(txtPatID, "Invalid Value"); // epLocal.SetError(txtPatID, "Invalid Value");
hasFailed = true; // hasFailed = true;
} // }
//
try // try
{ // {
RxNum = txtRxNum.Text; // RxNum = txtRxNum.Text;
//
if (RxNum.Length > 11) // if (RxNum.Length > 11)
{ // {
throw new Exception(); // throw new Exception();
} // }
else // else
{ // {
while (RxNum.Length < 11) // while (RxNum.Length < 11)
{ // {
RxNum = "0" + RxNum; // RxNum = "0" + RxNum;
} // }
} // }
//
} // }
catch (Exception exception) // catch (Exception exception)
{ // {
epLocal.SetError(txtRxNum, "Invalid Value"); // epLocal.SetError(txtRxNum, "Invalid Value");
hasFailed = true; // hasFailed = true;
} // }
try // try
{ // {
//
Physician_id = txtPhysID.Text; // Physician_id = txtPhysID.Text;
//
if (Physician_id.Length > 8) // if (Physician_id.Length > 8)
{ // {
throw new Exception(); // throw new Exception();
}else // }else
while (Physician_id.Length < 8) // while (Physician_id.Length < 8)
{ // {
Physician_id = "0" + Physician_id; // Physician_id = "0" + Physician_id;
} // }
//
} // }
catch (Exception exception) // catch (Exception exception)
{ // {
epLocal.SetError(txtPhysID, "Invalid Value"); // epLocal.SetError(txtPhysID, "Invalid Value");
hasFailed = true; // hasFailed = true;
} // }
try // try
{ // {
Physician_name = txtPhysName.Text; // Physician_name = txtPhysName.Text;
if (Physician_name.Length > 30) // if (Physician_name.Length > 30)
{ // {
throw new Exception(); // throw new Exception();
} // }
//
} // }
catch (Exception exception) // catch (Exception exception)
{ // {
epLocal.SetError(txtPhysName, "Invalid Value"); // epLocal.SetError(txtPhysName, "Invalid Value");
hasFailed = true; // hasFailed = true;
} // }
//
try // try
{ // {
Medication_id = txtMedID.Text; // Medication_id = txtMedID.Text;
if (Medication_id.Length > 7) // if (Medication_id.Length > 7)
{ // {
throw new Exception(); // throw new Exception();
} // }
//
while (Medication_id.Length < 7) // while (Medication_id.Length < 7)
{ // {
Medication_id = "0" + Medication_id; // Medication_id = "0" + Medication_id;
} // }
} // }
catch (Exception exception) // catch (Exception exception)
{ // {
epLocal.SetError(txtMedID, "Invalid Value"); // epLocal.SetError(txtMedID, "Invalid Value");
hasFailed = true; // hasFailed = true;
} // }
if (!hasFailed) // if (!hasFailed)
{ // {
if (isAdd) // if (isAdd)
{ // {
PharmacyDataTier.CreatePrescription( // PharmacyDataTier.CreatePrescription(
RxNum, // RxNum,
Patient_id, // Patient_id,
Medication_id, // Medication_id,
Physician_name, // Physician_name,
Physician_id, // Physician_id,
Completed_refills, // Completed_refills,
Max_refills); // Max_refills);
} // }
else // else
{ // {
PharmacyDataTier.UpdatePrescription( // PharmacyDataTier.UpdatePrescription(
RxNum, // RxNum,
Patient_id, // Patient_id,
Medication_id, // Medication_id,
Physician_name, // Physician_name,
Physician_id, // Physician_id,
Completed_refills, // Completed_refills,
Max_refills); // Max_refills);
} // }
//
SourceForm.txtRxNumber.Text = RxNum; // SourceForm.txtRxPrescriptionID.Text = RxNum;
//SourceForm.btnRxSearch_Click(sender, e); // SourceForm.btnPrescriptionSearch_Click(sender, e);
Close(); // Close();
//
//
} // }
} // }
//
} // }
private void frmPrescription_Load(object sender, EventArgs e) private void frmPrescription_Load(object sender, EventArgs e)
{ {
@ -294,7 +294,7 @@ namespace Louis__Pharmacy_CNSA212_FP
} }
private void btnGO_Click_2(object sender, EventArgs e) private void btnGO_Click(object sender, EventArgs e)
{ {
string RxNum_id = ""; string RxNum_id = "";
@ -307,9 +307,17 @@ namespace Louis__Pharmacy_CNSA212_FP
bool hasFailed = false; bool hasFailed = false;
epLocal.Clear();
if (txtRxNum.Text.Length > 0 && txtRxNum.Text.Length <= 11) if (txtRxNum.Text.Length > 0 && txtRxNum.Text.Length <= 11)
{ {
RxNum_id = txtRxNum.Text; RxNum_id = txtRxNum.Text;
while (RxNum_id.Length < 11)
{
RxNum_id = "0" + RxNum_id;
}
} }
if (txtPhysName.Text.Length > 0) if (txtPhysName.Text.Length > 0)
@ -330,6 +338,13 @@ namespace Louis__Pharmacy_CNSA212_FP
hasFailed = true; hasFailed = true;
epLocal.SetError(txtPatID, "Patient Does Not Exist"); epLocal.SetError(txtPatID, "Patient Does Not Exist");
} }
else
{
while (Patient_id.Length < 8)
{
Patient_id = "0" + Patient_id;
}
}
} }
else else
{ {
@ -346,6 +361,13 @@ namespace Louis__Pharmacy_CNSA212_FP
hasFailed = true; hasFailed = true;
epLocal.SetError(txtMedID, "Medication Does Not Exist"); epLocal.SetError(txtMedID, "Medication Does Not Exist");
} }
else
{
while (Medication_id.Length < 7)
{
Medication_id = "0" + Medication_id;
}
}
} }
else else
{ {
@ -362,6 +384,13 @@ namespace Louis__Pharmacy_CNSA212_FP
hasFailed = true; hasFailed = true;
epLocal.SetError(txtPhysID, "Physician Does Not Exist"); epLocal.SetError(txtPhysID, "Physician Does Not Exist");
} }
else
{
while (PhysicianID.Length < 8)
{
PhysicianID = "0" + PhysicianID;
}
}
} }
else else
{ {
@ -403,7 +432,35 @@ namespace Louis__Pharmacy_CNSA212_FP
epLocal.SetError(txtMaxRefills, "Invalid Value"); epLocal.SetError(txtMaxRefills, "Invalid Value");
hasFailed = true; hasFailed = true;
} }
if (!hasFailed)
{
if (isAdd)
{
PharmacyDataTier.CreatePrescription(
RxNum_id,
Patient_id, Medication_id,
PrescribedBy,
PhysicianID,
pastNumRefills,
numRefills);
}
else
{
PharmacyDataTier.UpdatePrescription(
RxNum_id,
Patient_id, Medication_id,
PrescribedBy,
PhysicianID,
pastNumRefills,
numRefills);
}
SourceForm.txtRxPrescriptionID.Text = RxNum_id;
SourceForm.btnPrescriptionSearch_Click(sender, e);
Close();
}
} }
@ -483,5 +540,10 @@ namespace Louis__Pharmacy_CNSA212_FP
epLocal.SetError(txtMaxRefills,""); epLocal.SetError(txtMaxRefills,"");
} }
private void btnCancel_Click_1(object sender, EventArgs e)
{
Close();
}
} }
} }