I think I have all 4 tabs working with add, update, and delete
This commit is contained in:
parent
9bb5379c29
commit
0f0255a5f6
@ -1205,8 +1205,8 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
string Medication_id,
|
||||
string Physician_name,
|
||||
string Physician_id,
|
||||
string Completed_refills,
|
||||
string Max_refills)
|
||||
int Completed_refills,
|
||||
int Max_refills)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -1221,12 +1221,12 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
cmdString.CommandText = "CreatePrescription";
|
||||
|
||||
cmdString.Parameters.Add("@Medication_id", SqlDbType.VarChar, 7).Value = Medication_id;
|
||||
cmdString.Parameters.Add("@numRefills", SqlDbType.VarChar, 60).Value = Completed_refills;
|
||||
cmdString.Parameters.Add("@pastNumRefills", SqlDbType.VarChar, 30).Value = Max_refills;
|
||||
cmdString.Parameters.Add("@numRefills", SqlDbType.Int).Value = Completed_refills;
|
||||
cmdString.Parameters.Add("@pastNumRefills", SqlDbType.Int).Value = Max_refills;
|
||||
cmdString.Parameters.Add("@PrescribedBy", SqlDbType.VarChar, 30).Value = Physician_name;
|
||||
cmdString.Parameters.Add("@Physician_id", SqlDbType.VarChar, 30).Value = Physician_id;
|
||||
cmdString.Parameters.Add("@Patient_id", SqlDbType.VarChar, 100).Value = Patient_id;
|
||||
cmdString.Parameters.Add("@RxNum", SqlDbType.VarChar, 30).Value = RxNum;
|
||||
cmdString.Parameters.Add("@Physician_id", SqlDbType.VarChar, 8).Value = Physician_id;
|
||||
cmdString.Parameters.Add("@Patient_id", SqlDbType.VarChar, 8).Value = Patient_id;
|
||||
cmdString.Parameters.Add("@RxNum", SqlDbType.VarChar, 11).Value = RxNum;
|
||||
|
||||
cmdString.ExecuteNonQuery();
|
||||
|
||||
@ -1247,8 +1247,8 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
string Medication_id,
|
||||
string Physician_name,
|
||||
string Physician_id,
|
||||
string Completed_refills,
|
||||
string Max_refills)
|
||||
int Completed_refills,
|
||||
int Max_refills)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
111
Louis'-Pharmacy_CNSA212-FP/frmInfo.Designer.cs
generated
111
Louis'-Pharmacy_CNSA212-FP/frmInfo.Designer.cs
generated
@ -117,7 +117,14 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
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.cmuPrescriptionNew = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.cmuPrescriptionEdit = new System.Windows.Forms.ToolStripMenuItem();
|
||||
@ -151,7 +158,7 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
((System.ComponentModel.ISupportInitialize)(this.dgvPhysician)).BeginInit();
|
||||
this.cmuPhysician.SuspendLayout();
|
||||
this.tbcInfoPrescriptions.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dgvRx)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dgvPrescription)).BeginInit();
|
||||
this.cmuPrescription.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
@ -222,6 +229,7 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
//
|
||||
// splcPatient.Panel1
|
||||
//
|
||||
this.splcPatient.Panel1.ContextMenuStrip = this.cmuPatient;
|
||||
this.splcPatient.Panel1.Controls.Add(this.txtPatientID);
|
||||
this.splcPatient.Panel1.Controls.Add(this.lblPatientID);
|
||||
this.splcPatient.Panel1.Controls.Add(lblPatientLast);
|
||||
@ -483,6 +491,7 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
//
|
||||
// splcPrescription.Panel1
|
||||
//
|
||||
this.splcPrescription.Panel1.ContextMenuStrip = this.cmuMedication;
|
||||
this.splcPrescription.Panel1.Controls.Add(this.btnMedicationSearch);
|
||||
this.splcPrescription.Panel1.Controls.Add(this.txtMedicationName);
|
||||
this.splcPrescription.Panel1.Controls.Add(this.txtMedicationNumber);
|
||||
@ -506,14 +515,14 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
this.btnMedicationSearch.UseVisualStyleBackColor = true;
|
||||
this.btnMedicationSearch.Click += new System.EventHandler(this.btnMedicationSearch_Click);
|
||||
//
|
||||
// txtPrescriptionPatID
|
||||
// txtMedicationName
|
||||
//
|
||||
this.txtMedicationName.Location = new System.Drawing.Point(184, 74);
|
||||
this.txtMedicationName.Name = "txtMedicationName";
|
||||
this.txtMedicationName.Size = new System.Drawing.Size(100, 20);
|
||||
this.txtMedicationName.TabIndex = 3;
|
||||
//
|
||||
// txtRxNumber
|
||||
// txtMedicationNumber
|
||||
//
|
||||
this.txtMedicationNumber.Location = new System.Drawing.Point(184, 51);
|
||||
this.txtMedicationNumber.Name = "txtMedicationNumber";
|
||||
@ -540,7 +549,7 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
this.lblDisMedicationNum.Text = "Medication ID:";
|
||||
this.lblDisMedicationNum.Click += new System.EventHandler(this.lblDisMedicationNum_Click);
|
||||
//
|
||||
// dgvPrescription
|
||||
// dgvMedication
|
||||
//
|
||||
this.dgvMedication.AllowUserToAddRows = false;
|
||||
this.dgvMedication.AllowUserToDeleteRows = false;
|
||||
@ -667,6 +676,7 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
// splcPhysician.Panel1
|
||||
//
|
||||
this.splcPhysician.Panel1.AutoScroll = true;
|
||||
this.splcPhysician.Panel1.ContextMenuStrip = this.cmuPhysician;
|
||||
this.splcPhysician.Panel1.Controls.Add(this.txtPhysicianID);
|
||||
this.splcPhysician.Panel1.Controls.Add(this.lblPhysicianID);
|
||||
this.splcPhysician.Panel1.Controls.Add(lblPhysicianLast);
|
||||
@ -873,6 +883,7 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
//
|
||||
// tbcInfoPrescriptions
|
||||
//
|
||||
this.tbcInfoPrescriptions.ContextMenuStrip = this.cmuPrescription;
|
||||
this.tbcInfoPrescriptions.Controls.Add(this.txtRxPatientID);
|
||||
this.tbcInfoPrescriptions.Controls.Add(this.txtRxMedicationID);
|
||||
this.tbcInfoPrescriptions.Controls.Add(this.txtRxPhysicianID);
|
||||
@ -882,7 +893,7 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
this.tbcInfoPrescriptions.Controls.Add(this.label2);
|
||||
this.tbcInfoPrescriptions.Controls.Add(this.label1);
|
||||
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.Name = "tbcInfoPrescriptions";
|
||||
this.tbcInfoPrescriptions.Padding = new System.Windows.Forms.Padding(3);
|
||||
@ -964,20 +975,70 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
this.btnRxSearch.TabIndex = 1;
|
||||
this.btnRxSearch.Text = "Search";
|
||||
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.dgvRx.ContextMenuStrip = this.cmuPrescription;
|
||||
this.dgvRx.Location = new System.Drawing.Point(0, 236);
|
||||
this.dgvRx.Name = "dgvRx";
|
||||
this.dgvRx.ReadOnly = true;
|
||||
this.dgvRx.RowHeadersWidth = 51;
|
||||
this.dgvRx.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
|
||||
this.dgvRx.Size = new System.Drawing.Size(730, 248);
|
||||
this.dgvRx.TabIndex = 0;
|
||||
this.dgvRx.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvRx_CellContentClick);
|
||||
this.dgvPrescription.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
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.dgvPrescription.ContextMenuStrip = this.cmuPrescription;
|
||||
this.dgvPrescription.Location = new System.Drawing.Point(0, 236);
|
||||
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, 248);
|
||||
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
|
||||
//
|
||||
@ -1058,11 +1119,19 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
this.cmuPhysician.ResumeLayout(false);
|
||||
this.tbcInfoPrescriptions.ResumeLayout(false);
|
||||
this.tbcInfoPrescriptions.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dgvRx)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dgvPrescription)).EndInit();
|
||||
this.cmuPrescription.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.TextBox txtRxPhysicianID;
|
||||
@ -1070,7 +1139,7 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
private System.Windows.Forms.TextBox txtRxPatientID;
|
||||
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.ToolStripMenuItem cmuPrescriptionNew;
|
||||
@ -1157,7 +1226,7 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
System.Windows.Forms.Label label2 = 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.TextBox txtRxPrescriptionID = new System.Windows.Forms.TextBox();
|
||||
public System.Windows.Forms.TextBox txtRxPrescriptionID;
|
||||
private System.Windows.Forms.ToolStripMenuItem cmuPrescriptionRefillThis;
|
||||
}
|
||||
}
|
@ -24,7 +24,8 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
|
||||
dgvPatient.DoubleClick += cmuPatientEdit_Click;
|
||||
dgvPhysician.DoubleClick += cmuPhysicianEdit_Click;
|
||||
dgvRx.DoubleClick += cmuMedicationEdit_Click;
|
||||
dgvPrescription.DoubleClick += cmuPrescriptionEdit_Click;
|
||||
dgvMedication.DoubleClick += cmuMedicationEdit_Click;
|
||||
|
||||
tbcInfo.SelectedIndexChanged += frmInfoTabChange;
|
||||
|
||||
@ -42,6 +43,13 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
cmuPhysicianDelete.Enabled = false;
|
||||
cmuMedicationEdit.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();
|
||||
@ -134,12 +142,12 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
}
|
||||
|
||||
// if data grid view is not focused, run the search function
|
||||
if (e.KeyCode == Keys.Enter && prescriptionIsActive && !dgvMedication.Focused)
|
||||
if (e.KeyCode == Keys.Enter && prescriptionIsActive && !dgvPrescription.Focused)
|
||||
{
|
||||
btnRxSearch_Click(sender,e);
|
||||
btnPrescriptionSearch_Click(sender,e);
|
||||
}
|
||||
// if data grid view is focused, run the edit function
|
||||
else if (e.KeyCode == Keys.Enter && prescriptionIsActive && dgvMedication.Focused)
|
||||
else if (e.KeyCode == Keys.Enter && prescriptionIsActive && dgvPrescription.Focused)
|
||||
{
|
||||
cmuPrescriptionEdit_Click(sender,e);
|
||||
}
|
||||
@ -258,6 +266,7 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
|
||||
cmuPatientEdit.Enabled = dgvPatient.Rows.Count > 0;
|
||||
cmuPatientDelete.Enabled = dgvPatient.Rows.Count > 0;
|
||||
dgvPatient.Visible = dgvPatient.Rows.Count > 0;
|
||||
|
||||
dgvPatient.Focus();
|
||||
|
||||
@ -432,6 +441,9 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
cmuPhysicianEdit.Enabled = dgvPhysician.Rows.Count > 0;
|
||||
cmuPhysicianDelete.Enabled = dgvPhysician.Rows.Count > 0;
|
||||
|
||||
|
||||
dgvPhysician.Visible = dgvPhysician.Rows.Count > 0;
|
||||
|
||||
dgvPhysician.Focus();
|
||||
|
||||
}
|
||||
@ -607,12 +619,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();
|
||||
row = dgvRx.SelectedRows[0];
|
||||
row = dgvPrescription.SelectedRows[0];
|
||||
string medID = "";
|
||||
medID = (row.Cells[0].Value).ToString();
|
||||
|
||||
@ -622,7 +634,7 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
{
|
||||
PharmacyDataTier.DeleteMedication(medID);
|
||||
}
|
||||
btnRxSearch_Click(sender, e);
|
||||
btnPrescriptionSearch_Click(sender, e);
|
||||
}
|
||||
|
||||
}
|
||||
@ -645,13 +657,13 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
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);
|
||||
DataGridViewRow row = new DataGridViewRow();
|
||||
row = dgvRx.SelectedRows[0];
|
||||
row = dgvPrescription.SelectedRows[0];
|
||||
string prescID = "";
|
||||
prescID = (row.Cells[0].Value).ToString();
|
||||
frmPrescription PrescriptionAdd = new frmPrescription(this, false);
|
||||
@ -669,12 +681,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();
|
||||
row = dgvRx.SelectedRows[0];
|
||||
row = dgvPrescription.SelectedRows[0];
|
||||
string PresID = "";
|
||||
PresID = (row.Cells[0].Value).ToString();
|
||||
|
||||
@ -684,7 +696,7 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
{
|
||||
PharmacyDataTier.DeletePrescription(PresID);
|
||||
}
|
||||
btnRxSearch_Click(sender, e);
|
||||
btnPrescriptionSearch_Click(sender, e);
|
||||
}
|
||||
|
||||
}
|
||||
@ -698,7 +710,7 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
medicationAdd.Focus();
|
||||
}
|
||||
|
||||
private void btnRxSearch_Click(object sender, EventArgs e)
|
||||
public void btnPrescriptionSearch_Click(object sender, EventArgs e)
|
||||
{
|
||||
string rxNum = "";
|
||||
string physID = "";
|
||||
@ -728,14 +740,14 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
|
||||
if (ds.Tables[0].Rows.Count > 0) // There is a record.
|
||||
{
|
||||
dgvRx.Visible = true;
|
||||
dgvPrescription.Visible = true;
|
||||
// Get data source.
|
||||
dgvRx.DataSource = ds.Tables[0];
|
||||
dgvRx.AlternatingRowsDefaultCellStyle.BackColor = Color.LightGreen;
|
||||
dgvPrescription.DataSource = ds.Tables[0];
|
||||
dgvPrescription.AlternatingRowsDefaultCellStyle.BackColor = Color.LightGreen;
|
||||
|
||||
// Set the row and column header styles.
|
||||
dgvRx.ColumnHeadersDefaultCellStyle.ForeColor = Color.White;
|
||||
dgvRx.ColumnHeadersDefaultCellStyle.BackColor = Color.Green;
|
||||
dgvPrescription.ColumnHeadersDefaultCellStyle.ForeColor = Color.White;
|
||||
dgvPrescription.ColumnHeadersDefaultCellStyle.BackColor = Color.Green;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -762,10 +774,12 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
}
|
||||
|
||||
|
||||
cmuMedicationEdit.Enabled = dgvRx.Rows.Count > 0;
|
||||
cmuMedicationDelete.Enabled = dgvRx.Rows.Count > 0;
|
||||
cmuPrescriptionEdit.Enabled = dgvPrescription.Rows.Count > 0;
|
||||
cmuPrescriptionDelete.Enabled = dgvPrescription.Rows.Count > 0;
|
||||
|
||||
dgvPrescription.Visible = dgvPrescription.Rows.Count > 0;
|
||||
|
||||
dgvRx.Focus();
|
||||
dgvPrescription.Focus();
|
||||
|
||||
}
|
||||
|
||||
@ -898,6 +912,8 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
cmuMedicationEdit.Enabled = dgvMedication.Rows.Count > 0;
|
||||
cmuMedicationDelete.Enabled = dgvMedication.Rows.Count > 0;
|
||||
|
||||
dgvMedication.Visible = dgvMedication.Rows.Count > 0;
|
||||
|
||||
dgvMedication.Focus();
|
||||
}
|
||||
}
|
||||
|
@ -129,6 +129,9 @@
|
||||
<metadata name="lblPhysicianLast.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</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">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
@ -174,8 +177,8 @@
|
||||
<metadata name="Medications.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</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 name="cmuMedication.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>125, 17</value>
|
||||
</metadata>
|
||||
<metadata name="Medication_id.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
@ -198,8 +201,8 @@
|
||||
<metadata name="RxNum.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="cmuMedication.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>125, 17</value>
|
||||
<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="Phys_id.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
@ -234,12 +237,30 @@
|
||||
<metadata name="Specialty.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</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">
|
||||
<value>332, 17</value>
|
||||
</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" />
|
||||
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
|
@ -131,6 +131,7 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
this.btnCancel.TabIndex = 25;
|
||||
this.btnCancel.Text = "Cancel";
|
||||
this.btnCancel.UseVisualStyleBackColor = true;
|
||||
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click_1);
|
||||
//
|
||||
// btnGO
|
||||
//
|
||||
@ -140,7 +141,7 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
this.btnGO.Size = new System.Drawing.Size(67, 23);
|
||||
this.btnGO.TabIndex = 24;
|
||||
this.btnGO.UseVisualStyleBackColor = true;
|
||||
this.btnGO.Click += new System.EventHandler(this.btnGO_Click_2);
|
||||
this.btnGO.Click += new System.EventHandler(this.btnGO_Click);
|
||||
//
|
||||
// label7
|
||||
//
|
||||
@ -149,7 +150,7 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
this.label7.Name = "label7";
|
||||
this.label7.Size = new System.Drawing.Size(109, 28);
|
||||
this.label7.TabIndex = 23;
|
||||
this.label7.Text = "Max Refills:";
|
||||
this.label7.Text = "Refills Allowed:";
|
||||
this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
// label6
|
||||
@ -159,7 +160,7 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Size = new System.Drawing.Size(109, 28);
|
||||
this.label6.TabIndex = 22;
|
||||
this.label6.Text = "Completed Refills:";
|
||||
this.label6.Text = "Refills Used:";
|
||||
this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
// label5
|
||||
|
@ -87,153 +87,153 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
Close();
|
||||
}
|
||||
|
||||
private void btnGO_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
var hasFailed = false;
|
||||
|
||||
var Patient_id = "";
|
||||
var Medication_id = "";
|
||||
var Physician_name = "";
|
||||
var Physician_id = "";
|
||||
var Completed_refills = "";
|
||||
var Max_refills = "";
|
||||
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)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
Patient_id = txtPatID.Text;
|
||||
|
||||
if (Patient_id.Length > 8)
|
||||
{
|
||||
throw new Exception();
|
||||
}else
|
||||
while (Patient_id.Length < 8)
|
||||
{
|
||||
Patient_id = "0" + Patient_id;
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
epLocal.SetError(txtPatID, "Invalid Value");
|
||||
hasFailed = true;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
RxNum = txtRxNum.Text;
|
||||
|
||||
if (RxNum.Length > 11)
|
||||
{
|
||||
throw new Exception();
|
||||
}
|
||||
else
|
||||
{
|
||||
while (RxNum.Length < 11)
|
||||
{
|
||||
RxNum = "0" + RxNum;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
epLocal.SetError(txtRxNum, "Invalid Value");
|
||||
hasFailed = true;
|
||||
}
|
||||
try
|
||||
{
|
||||
|
||||
Physician_id = txtPhysID.Text;
|
||||
|
||||
if (Physician_id.Length > 8)
|
||||
{
|
||||
throw new Exception();
|
||||
}else
|
||||
while (Physician_id.Length < 8)
|
||||
{
|
||||
Physician_id = "0" + Physician_id;
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
epLocal.SetError(txtPhysID, "Invalid Value");
|
||||
hasFailed = true;
|
||||
}
|
||||
try
|
||||
{
|
||||
Physician_name = txtPhysName.Text;
|
||||
if (Physician_name.Length > 30)
|
||||
{
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
epLocal.SetError(txtPhysName, "Invalid Value");
|
||||
hasFailed = true;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
Medication_id = txtMedID.Text;
|
||||
if (Medication_id.Length > 7)
|
||||
{
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
while (Medication_id.Length < 7)
|
||||
{
|
||||
Medication_id = "0" + Medication_id;
|
||||
}
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
epLocal.SetError(txtMedID, "Invalid Value");
|
||||
hasFailed = true;
|
||||
}
|
||||
if (!hasFailed)
|
||||
{
|
||||
if (isAdd)
|
||||
{
|
||||
PharmacyDataTier.CreatePrescription(
|
||||
RxNum,
|
||||
Patient_id,
|
||||
Medication_id,
|
||||
Physician_name,
|
||||
Physician_id,
|
||||
Completed_refills,
|
||||
Max_refills);
|
||||
}
|
||||
else
|
||||
{
|
||||
PharmacyDataTier.UpdatePrescription(
|
||||
RxNum,
|
||||
Patient_id,
|
||||
Medication_id,
|
||||
Physician_name,
|
||||
Physician_id,
|
||||
Completed_refills,
|
||||
Max_refills);
|
||||
}
|
||||
|
||||
SourceForm.txtMedicationNumber.Text = RxNum;
|
||||
//SourceForm.btnRxSearch_Click(sender, e);
|
||||
Close();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// private void btnGO_Click(object sender, EventArgs e)
|
||||
// {
|
||||
//
|
||||
// var hasFailed = false;
|
||||
//
|
||||
// var Patient_id = "";
|
||||
// var Medication_id = "";
|
||||
// var Physician_name = "";
|
||||
// var Physician_id = "";
|
||||
// var Completed_refills = "";
|
||||
// var Max_refills = "";
|
||||
// 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)
|
||||
// {
|
||||
//
|
||||
// try
|
||||
// {
|
||||
//
|
||||
// Patient_id = txtPatID.Text;
|
||||
//
|
||||
// if (Patient_id.Length > 8)
|
||||
// {
|
||||
// throw new Exception();
|
||||
// }else
|
||||
// while (Patient_id.Length < 8)
|
||||
// {
|
||||
// Patient_id = "0" + Patient_id;
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// catch (Exception exception)
|
||||
// {
|
||||
// epLocal.SetError(txtPatID, "Invalid Value");
|
||||
// hasFailed = true;
|
||||
// }
|
||||
//
|
||||
// try
|
||||
// {
|
||||
// RxNum = txtRxNum.Text;
|
||||
//
|
||||
// if (RxNum.Length > 11)
|
||||
// {
|
||||
// throw new Exception();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// while (RxNum.Length < 11)
|
||||
// {
|
||||
// RxNum = "0" + RxNum;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// catch (Exception exception)
|
||||
// {
|
||||
// epLocal.SetError(txtRxNum, "Invalid Value");
|
||||
// hasFailed = true;
|
||||
// }
|
||||
// try
|
||||
// {
|
||||
//
|
||||
// Physician_id = txtPhysID.Text;
|
||||
//
|
||||
// if (Physician_id.Length > 8)
|
||||
// {
|
||||
// throw new Exception();
|
||||
// }else
|
||||
// while (Physician_id.Length < 8)
|
||||
// {
|
||||
// Physician_id = "0" + Physician_id;
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// catch (Exception exception)
|
||||
// {
|
||||
// epLocal.SetError(txtPhysID, "Invalid Value");
|
||||
// hasFailed = true;
|
||||
// }
|
||||
// try
|
||||
// {
|
||||
// Physician_name = txtPhysName.Text;
|
||||
// if (Physician_name.Length > 30)
|
||||
// {
|
||||
// throw new Exception();
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// catch (Exception exception)
|
||||
// {
|
||||
// epLocal.SetError(txtPhysName, "Invalid Value");
|
||||
// hasFailed = true;
|
||||
// }
|
||||
//
|
||||
// try
|
||||
// {
|
||||
// Medication_id = txtMedID.Text;
|
||||
// if (Medication_id.Length > 7)
|
||||
// {
|
||||
// throw new Exception();
|
||||
// }
|
||||
//
|
||||
// while (Medication_id.Length < 7)
|
||||
// {
|
||||
// Medication_id = "0" + Medication_id;
|
||||
// }
|
||||
// }
|
||||
// catch (Exception exception)
|
||||
// {
|
||||
// epLocal.SetError(txtMedID, "Invalid Value");
|
||||
// hasFailed = true;
|
||||
// }
|
||||
// if (!hasFailed)
|
||||
// {
|
||||
// if (isAdd)
|
||||
// {
|
||||
// PharmacyDataTier.CreatePrescription(
|
||||
// RxNum,
|
||||
// Patient_id,
|
||||
// Medication_id,
|
||||
// Physician_name,
|
||||
// Physician_id,
|
||||
// Completed_refills,
|
||||
// Max_refills);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// PharmacyDataTier.UpdatePrescription(
|
||||
// RxNum,
|
||||
// Patient_id,
|
||||
// Medication_id,
|
||||
// Physician_name,
|
||||
// Physician_id,
|
||||
// Completed_refills,
|
||||
// Max_refills);
|
||||
// }
|
||||
//
|
||||
// SourceForm.txtRxPrescriptionID.Text = RxNum;
|
||||
// SourceForm.btnPrescriptionSearch_Click(sender, e);
|
||||
// Close();
|
||||
//
|
||||
//
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
private void frmPrescription_Load(object sender, EventArgs e)
|
||||
{
|
||||
@ -294,9 +294,9 @@ 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 = "";
|
||||
int numRefills = 0;
|
||||
int pastNumRefills = 0;
|
||||
@ -304,14 +304,22 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
string PhysicianID = "";
|
||||
string Medication_id = "";
|
||||
string Patient_id = "";
|
||||
|
||||
|
||||
bool hasFailed = false;
|
||||
|
||||
|
||||
epLocal.Clear();
|
||||
|
||||
if (txtRxNum.Text.Length > 0 && txtRxNum.Text.Length <= 11)
|
||||
{
|
||||
RxNum_id = txtRxNum.Text;
|
||||
}
|
||||
|
||||
while (RxNum_id.Length < 11)
|
||||
{
|
||||
RxNum_id = "0" + RxNum_id;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (txtPhysName.Text.Length > 0)
|
||||
{
|
||||
PrescribedBy = txtPhysName.Text;
|
||||
@ -330,6 +338,13 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
hasFailed = true;
|
||||
epLocal.SetError(txtPatID, "Patient Does Not Exist");
|
||||
}
|
||||
else
|
||||
{
|
||||
while (Patient_id.Length < 8)
|
||||
{
|
||||
Patient_id = "0" + Patient_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -346,6 +361,13 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
hasFailed = true;
|
||||
epLocal.SetError(txtMedID, "Medication Does Not Exist");
|
||||
}
|
||||
else
|
||||
{
|
||||
while (Medication_id.Length < 7)
|
||||
{
|
||||
Medication_id = "0" + Medication_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -362,6 +384,13 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
hasFailed = true;
|
||||
epLocal.SetError(txtPhysID, "Physician Does Not Exist");
|
||||
}
|
||||
else
|
||||
{
|
||||
while (PhysicianID.Length < 8)
|
||||
{
|
||||
PhysicianID = "0" + PhysicianID;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -371,13 +400,13 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
|
||||
if (txtCompletedRefills.Text.Length > 0)
|
||||
{
|
||||
pastNumRefills = int.Parse(txtCompletedRefills.Text);
|
||||
}
|
||||
else throw new Exception();
|
||||
|
||||
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
@ -396,14 +425,42 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
epLocal.SetError(txtMaxRefills, "Invalid Value");
|
||||
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,"");
|
||||
}
|
||||
|
||||
private void btnCancel_Click_1(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user