This commit is contained in:
Adam McCane 2024-02-20 18:38:30 -05:00
commit 388dc680ea
8 changed files with 234 additions and 58 deletions

View File

@ -902,7 +902,7 @@ namespace Louis__Pharmacy_CNSA212_FP
cmdString.Connection = myConn;
cmdString.CommandType = CommandType.StoredProcedure;
cmdString.CommandTimeout = 1500;
cmdString.CommandText = "GetNextRxNum";
cmdString.CommandText = "GetNextRxID";
object result = cmdString.ExecuteScalar();
double value = 0;

View File

@ -1029,13 +1029,14 @@ namespace Louis__Pharmacy_CNSA212_FP
this.cmuPrescriptionRefillThis,
this.cmuPrescriptionViewRefills});
this.cmuPrescription.Name = "cmuPrescription";
this.cmuPrescription.Size = new System.Drawing.Size(244, 114);
this.cmuPrescription.Size = new System.Drawing.Size(244, 136);
//
// cmuPrescriptionNew
//
this.cmuPrescriptionNew.Name = "cmuPrescriptionNew";
this.cmuPrescriptionNew.Size = new System.Drawing.Size(243, 22);
this.cmuPrescriptionNew.Text = "New";
this.cmuPrescriptionNew.Click += new System.EventHandler(this.cmuPrescriptionNew_Click_1);
//
// cmuPrescriptionEdit
//

View File

@ -670,6 +670,15 @@ namespace Louis__Pharmacy_CNSA212_FP
}
private void cmuPrescriptionNew_Click_1(object sender, EventArgs e)
{
frmPrescription medicationAdd = new frmPrescription(this, true);
medicationAdd.MdiParent = MdiParent;
medicationAdd.StartPosition = FormStartPosition.CenterScreen;
medicationAdd.Show();
medicationAdd.Focus();
}
private void btnRxSearch_Click(object sender, EventArgs e)
{
string rxNum = "";
@ -724,13 +733,13 @@ namespace Louis__Pharmacy_CNSA212_FP
}
}
catch (Exception exception)
{
}
catch (Exception exception)
{
ep1.SetError(txtPrescriptionPatID, "Invalid Value");
ep1.SetError(txtPrescriptionPatID, "Invalid Value");
}
}
}
@ -793,6 +802,7 @@ namespace Louis__Pharmacy_CNSA212_FP
{
}
}
}
}
}

View File

@ -119,6 +119,7 @@ namespace Louis__Pharmacy_CNSA212_FP
this.label7.TabIndex = 6;
this.label7.Text = "Rx Number:";
this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label7.Click += new System.EventHandler(this.label7_Click);
//
// btnGO
//

View File

@ -34,8 +34,11 @@ namespace Louis__Pharmacy_CNSA212_FP
}
KeyPreview = true;
KeyDown += frmMedication_KeyDown;
}
private void frmMedication_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Escape)
@ -269,5 +272,10 @@ namespace Louis__Pharmacy_CNSA212_FP
{
epLocal.SetError(txtRxNum,"");
}
private void label7_Click(object sender, EventArgs e)
{
}
}
}

View File

@ -199,7 +199,7 @@ namespace Louis__Pharmacy_CNSA212_FP
if (txtFirstName.Text.Length <= 30 && txtFirstName.Text.Length>=1)
if (txtFirstName.Text.Length <= 30 && txtFirstName.Text.Length>=1)
{
FirstName = txtFirstName.Text;
}else if (txtFirstName.Text.Length < 1)

View File

@ -50,157 +50,166 @@ namespace Louis__Pharmacy_CNSA212_FP
//
// txtMaxRefills
//
this.txtMaxRefills.Location = new System.Drawing.Point(433, 347);
this.txtMaxRefills.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.txtMaxRefills.Location = new System.Drawing.Point(325, 282);
this.txtMaxRefills.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.txtMaxRefills.Name = "txtMaxRefills";
this.txtMaxRefills.Size = new System.Drawing.Size(163, 22);
this.txtMaxRefills.Size = new System.Drawing.Size(123, 20);
this.txtMaxRefills.TabIndex = 33;
//
// txtCompletedRefills
//
this.txtCompletedRefills.Location = new System.Drawing.Point(433, 313);
this.txtCompletedRefills.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.txtCompletedRefills.Location = new System.Drawing.Point(325, 254);
this.txtCompletedRefills.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.txtCompletedRefills.Name = "txtCompletedRefills";
this.txtCompletedRefills.Size = new System.Drawing.Size(163, 22);
this.txtCompletedRefills.Size = new System.Drawing.Size(123, 20);
this.txtCompletedRefills.TabIndex = 32;
//
// txtPhysID
//
this.txtPhysID.Location = new System.Drawing.Point(433, 279);
this.txtPhysID.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.txtPhysID.Location = new System.Drawing.Point(325, 227);
this.txtPhysID.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.txtPhysID.Name = "txtPhysID";
this.txtPhysID.Size = new System.Drawing.Size(163, 22);
this.txtPhysID.Size = new System.Drawing.Size(123, 20);
this.txtPhysID.TabIndex = 31;
//
// txtPhysName
//
this.txtPhysName.Location = new System.Drawing.Point(433, 244);
this.txtPhysName.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.txtPhysName.Location = new System.Drawing.Point(325, 198);
this.txtPhysName.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.txtPhysName.Name = "txtPhysName";
this.txtPhysName.Size = new System.Drawing.Size(163, 22);
this.txtPhysName.Size = new System.Drawing.Size(123, 20);
this.txtPhysName.TabIndex = 30;
//
// txtMedID
//
this.txtMedID.Location = new System.Drawing.Point(433, 210);
this.txtMedID.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.txtMedID.Location = new System.Drawing.Point(325, 171);
this.txtMedID.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.txtMedID.Name = "txtMedID";
this.txtMedID.Size = new System.Drawing.Size(163, 22);
this.txtMedID.Size = new System.Drawing.Size(123, 20);
this.txtMedID.TabIndex = 29;
//
// txtPatID
//
this.txtPatID.Location = new System.Drawing.Point(433, 175);
this.txtPatID.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.txtPatID.Location = new System.Drawing.Point(325, 142);
this.txtPatID.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.txtPatID.Name = "txtPatID";
this.txtPatID.Size = new System.Drawing.Size(163, 22);
this.txtPatID.Size = new System.Drawing.Size(123, 20);
this.txtPatID.TabIndex = 28;
//
// txtRxNum
//
this.txtRxNum.Location = new System.Drawing.Point(433, 141);
this.txtRxNum.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.txtRxNum.Location = new System.Drawing.Point(325, 115);
this.txtRxNum.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.txtRxNum.Name = "txtRxNum";
this.txtRxNum.Size = new System.Drawing.Size(163, 22);
this.txtRxNum.Size = new System.Drawing.Size(123, 20);
this.txtRxNum.TabIndex = 27;
//
// lblDisPurpose
//
this.lblDisPurpose.Font = new System.Drawing.Font("Microsoft Sans Serif", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblDisPurpose.Location = new System.Drawing.Point(142, 32);
this.lblDisPurpose.Location = new System.Drawing.Point(106, 26);
this.lblDisPurpose.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblDisPurpose.Name = "lblDisPurpose";
this.lblDisPurpose.Size = new System.Drawing.Size(615, 58);
this.lblDisPurpose.Size = new System.Drawing.Size(461, 47);
this.lblDisPurpose.TabIndex = 26;
this.lblDisPurpose.Text = "Prescription";
this.lblDisPurpose.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// btnCancel
//
this.btnCancel.Location = new System.Drawing.Point(782, 463);
this.btnCancel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.btnCancel.Location = new System.Drawing.Point(586, 376);
this.btnCancel.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(89, 28);
this.btnCancel.Size = new System.Drawing.Size(67, 23);
this.btnCancel.TabIndex = 25;
this.btnCancel.Text = "Cancel";
this.btnCancel.UseVisualStyleBackColor = true;
//
// btnGO
//
this.btnGO.Location = new System.Drawing.Point(667, 463);
this.btnGO.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.btnGO.Location = new System.Drawing.Point(500, 376);
this.btnGO.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.btnGO.Name = "btnGO";
this.btnGO.Size = new System.Drawing.Size(89, 28);
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);
//
// label7
//
this.label7.Location = new System.Drawing.Point(282, 341);
this.label7.Location = new System.Drawing.Point(212, 277);
this.label7.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(145, 34);
this.label7.Size = new System.Drawing.Size(109, 28);
this.label7.TabIndex = 23;
this.label7.Text = "Max Refills:";
this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// label6
//
this.label6.Location = new System.Drawing.Point(282, 307);
this.label6.Location = new System.Drawing.Point(212, 249);
this.label6.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(145, 34);
this.label6.Size = new System.Drawing.Size(109, 28);
this.label6.TabIndex = 22;
this.label6.Text = "Completed Refills:";
this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// label5
//
this.label5.Location = new System.Drawing.Point(282, 272);
this.label5.Location = new System.Drawing.Point(212, 221);
this.label5.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(145, 34);
this.label5.Size = new System.Drawing.Size(109, 28);
this.label5.TabIndex = 21;
this.label5.Text = "Physician ID:";
this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// label4
//
this.label4.Location = new System.Drawing.Point(282, 238);
this.label4.Location = new System.Drawing.Point(212, 193);
this.label4.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(145, 34);
this.label4.Size = new System.Drawing.Size(109, 28);
this.label4.TabIndex = 20;
this.label4.Text = "Physician Name:";
this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// label3
//
this.label3.Location = new System.Drawing.Point(282, 203);
this.label3.Location = new System.Drawing.Point(212, 165);
this.label3.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(145, 34);
this.label3.Size = new System.Drawing.Size(109, 28);
this.label3.TabIndex = 19;
this.label3.Text = "Medication ID:";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// label2
//
this.label2.Location = new System.Drawing.Point(282, 169);
this.label2.Location = new System.Drawing.Point(212, 137);
this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(145, 34);
this.label2.Size = new System.Drawing.Size(109, 28);
this.label2.TabIndex = 18;
this.label2.Text = "Patient ID:";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// label1
//
this.label1.Location = new System.Drawing.Point(282, 135);
this.label1.Location = new System.Drawing.Point(212, 110);
this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(145, 34);
this.label1.Size = new System.Drawing.Size(109, 28);
this.label1.TabIndex = 17;
this.label1.Text = "RX Number:";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// frmPrescription
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(929, 523);
this.ClientSize = new System.Drawing.Size(697, 425);
this.Controls.Add(this.txtMaxRefills);
this.Controls.Add(this.txtCompletedRefills);
this.Controls.Add(this.txtPhysID);
@ -218,12 +227,12 @@ namespace Louis__Pharmacy_CNSA212_FP
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.Name = "frmPrescription";
this.Text = "frmPrescription";
this.Load += new System.EventHandler(this.frmPrescription_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion

View File

@ -41,6 +41,8 @@ namespace Louis__Pharmacy_CNSA212_FP
}
KeyPreview = true;
KeyDown += frmPrescription_KeyDown;
txtRxNum.Enabled = false;
}
private void frmPrescription_KeyDown(object sender, KeyEventArgs e)
@ -209,10 +211,154 @@ namespace Louis__Pharmacy_CNSA212_FP
if (isAdd)
{
var nextID = PharmacyDataTier.GetNextRxNum();
txtMedID.Text = nextID.ToString();
txtRxNum.Text = nextID.ToString();
}
}
private bool Exists(string Table, string find)
{
bool value = false;
if (Table == "PHYSICIAN")
{
DataSet ds = PharmacyDataTier.PhysicianInfoSearch(find);
if (ds != null && ds.Tables[0].Rows.Count > 0)
{
value = true;
}
}else if (Table == "PATIENT")
{
DataSet ds = PharmacyDataTier.PatientInfoSearch(find);
if (ds != null && ds.Tables[0].Rows.Count > 0)
{
value = true;
}
}else if (Table == "MEDICATION")
{
DataSet ds = PharmacyDataTier.MedicationInfoSearch(find);
if (ds != null && ds.Tables[0].Rows.Count > 0)
{
value = true;
}
}
else
{
throw new Exception("TableNotFound");
}
return value;
}
private void btnGO_Click_2(object sender, EventArgs e)
{
string RxNum_id = "";
int numRefills = 0;
int pastNumRefills = 0;
string PrescribedBy = "";
string PhysicianID = "";
string Medication_id = "";
string Patient_id = "";
bool hasFailed = false;
if (txtRxNum.Text.Length > 0 && txtRxNum.Text.Length <= 11)
{
RxNum_id = txtRxNum.Text;
}
if (txtPhysName.Text.Length > 0)
{
PrescribedBy = txtPhysName.Text;
}
else
{
epLocal.SetError(txtPhysName, "Must Enter a Value");
}
if (txtPatID.Text.Length > 0)
{
Patient_id = txtPatID.Text;
if (!Exists("PATIENT", Patient_id))
{
hasFailed = true;
epLocal.SetError(txtPatID, "Patient Does Not Exist");
}
}
if (txtMedID.Text.Length > 0)
{
Medication_id = txtMedID.Text;
if (!Exists("MEDICATION", Medication_id))
{
hasFailed = true;
epLocal.SetError(txtMedID, "Medication Does Not Exist");
}
}
if (txtPhysID.Text.Length > 0)
{
PhysicianID = txtPhysID.Text;
if (!Exists("PHYSICIAN", PhysicianID))
{
hasFailed = true;
epLocal.SetError(txtPhysID, "Physician Does Not Exist");
}
}
try
{
if (txtCompletedRefills.Text.Length > 0)
{
pastNumRefills = int.Parse(txtCompletedRefills.Text);
}
}
catch (Exception exception)
{
epLocal.SetError(txtCompletedRefills, "Invalid Value");
hasFailed = true;
}
try
{
if (txtMaxRefills.Text.Length > 0)
{
numRefills = int.Parse(txtMaxRefills.Text);
}
if (numRefills < 0)
{
throw new Exception();
}
}
catch (Exception exception)
{
epLocal.SetError(txtMaxRefills, "Invalid Value");
hasFailed = true;
}
}
private void txtMedID_TextChanged(object sender, EventArgs e)
{
@ -249,5 +395,6 @@ namespace Louis__Pharmacy_CNSA212_FP
{
}
}
}