This commit is contained in:
Adam McCane 2024-02-20 01:25:04 -05:00
commit e5f67232df
4 changed files with 113 additions and 108 deletions

View File

@ -1087,5 +1087,31 @@ namespace Louis__Pharmacy_CNSA212_FP
}
}
public static void FillComboBox(string table, string ValueMember, string displayMember, ComboBox myComboBox)
{
try
{
myConn.Open();
SqlCommand command = new SqlCommand("SELECT "+ValueMember+" FROM "+table, myConn);
SqlDataReader reader = command.ExecuteReader();
DataTable dt = new DataTable();
dt.Columns.Add(ValueMember, typeof(string));
dt.Load(reader);
myComboBox.ValueMember = ValueMember;
myComboBox.DisplayMember = displayMember;
myComboBox.DataSource = dt;
reader.Close();
myConn.Close();
}
catch (Exception ex)
{
MessageBox.Show("Error: " + ex.Message);
}
}
}
}

View File

@ -588,26 +588,26 @@ namespace Louis__Pharmacy_CNSA212_FP
this.cmuRx.ImageScalingSize = new System.Drawing.Size(20, 20);
this.cmuRx.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.cmuRxNew, this.cmuRxEdit, this.cmuRxDelete });
this.cmuRx.Name = "cmuRx";
this.cmuRx.Size = new System.Drawing.Size(153, 92);
this.cmuRx.Size = new System.Drawing.Size(108, 70);
//
// cmuRxNew
//
this.cmuRxNew.Name = "cmuRxNew";
this.cmuRxNew.Size = new System.Drawing.Size(152, 22);
this.cmuRxNew.Size = new System.Drawing.Size(107, 22);
this.cmuRxNew.Text = "New";
this.cmuRxNew.Click += new System.EventHandler(this.cmuRxNew_Click);
//
// cmuRxEdit
//
this.cmuRxEdit.Name = "cmuRxEdit";
this.cmuRxEdit.Size = new System.Drawing.Size(152, 22);
this.cmuRxEdit.Size = new System.Drawing.Size(107, 22);
this.cmuRxEdit.Text = "Edit";
this.cmuRxEdit.Click += new System.EventHandler(this.cmuRxEdit_Click);
//
// cmuRxDelete
//
this.cmuRxDelete.Name = "cmuRxDelete";
this.cmuRxDelete.Size = new System.Drawing.Size(152, 22);
this.cmuRxDelete.Size = new System.Drawing.Size(107, 22);
this.cmuRxDelete.Text = "Delete";
this.cmuRxDelete.Click += new System.EventHandler(this.cmuRxDelete_Click);
//

View File

@ -52,7 +52,6 @@ namespace Louis__Pharmacy_CNSA212_FP
this.txtHeightFt = new System.Windows.Forms.TextBox();
this.txtHeightIn = new System.Windows.Forms.TextBox();
this.txtDOB = new System.Windows.Forms.TextBox();
this.txtGender = new System.Windows.Forms.TextBox();
this.txtCity = new System.Windows.Forms.TextBox();
this.txtZip = new System.Windows.Forms.TextBox();
this.txtState = new System.Windows.Forms.TextBox();
@ -60,14 +59,14 @@ namespace Louis__Pharmacy_CNSA212_FP
this.lblDisPurpose = new System.Windows.Forms.Label();
this.btnGO = new System.Windows.Forms.Button();
this.btnClose = new System.Windows.Forms.Button();
this.cboGender = new System.Windows.Forms.ComboBox();
this.SuspendLayout();
//
// label1
//
this.label1.Location = new System.Drawing.Point(124, 111);
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label1.Location = new System.Drawing.Point(83, 72);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(150, 35);
this.label1.Size = new System.Drawing.Size(100, 23);
this.label1.TabIndex = 0;
this.label1.Text = "Patient ID:";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
@ -75,265 +74,244 @@ namespace Louis__Pharmacy_CNSA212_FP
//
// label2
//
this.label2.Location = new System.Drawing.Point(124, 146);
this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label2.Location = new System.Drawing.Point(83, 95);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(150, 35);
this.label2.Size = new System.Drawing.Size(100, 23);
this.label2.TabIndex = 1;
this.label2.Text = "First Name:";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// label3
//
this.label3.Location = new System.Drawing.Point(124, 182);
this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label3.Location = new System.Drawing.Point(83, 118);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(150, 35);
this.label3.Size = new System.Drawing.Size(100, 23);
this.label3.TabIndex = 2;
this.label3.Text = "Last Name:";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// label4
//
this.label4.Location = new System.Drawing.Point(124, 217);
this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label4.Location = new System.Drawing.Point(83, 141);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(150, 35);
this.label4.Size = new System.Drawing.Size(100, 23);
this.label4.TabIndex = 3;
this.label4.Text = "Middle Initial:";
this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// label5
//
this.label5.Location = new System.Drawing.Point(586, 111);
this.label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label5.Location = new System.Drawing.Point(391, 72);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(150, 35);
this.label5.Size = new System.Drawing.Size(100, 23);
this.label5.TabIndex = 4;
this.label5.Text = "City:";
this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// label6
//
this.label6.Location = new System.Drawing.Point(586, 146);
this.label6.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label6.Location = new System.Drawing.Point(391, 95);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(150, 35);
this.label6.Size = new System.Drawing.Size(100, 23);
this.label6.TabIndex = 5;
this.label6.Text = "Zip Code:";
this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// label7
//
this.label7.Location = new System.Drawing.Point(586, 182);
this.label7.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label7.Location = new System.Drawing.Point(391, 118);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(150, 35);
this.label7.Size = new System.Drawing.Size(100, 23);
this.label7.TabIndex = 6;
this.label7.Text = "State";
this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// label8
//
this.label8.Location = new System.Drawing.Point(124, 252);
this.label8.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label8.Location = new System.Drawing.Point(83, 164);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(150, 35);
this.label8.Size = new System.Drawing.Size(100, 23);
this.label8.TabIndex = 7;
this.label8.Text = "Weight (Lbs):";
this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// label9
//
this.label9.Location = new System.Drawing.Point(124, 288);
this.label9.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label9.Location = new System.Drawing.Point(83, 187);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(150, 35);
this.label9.Size = new System.Drawing.Size(100, 23);
this.label9.TabIndex = 8;
this.label9.Text = "Height (Ft):";
this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// label10
//
this.label10.Location = new System.Drawing.Point(124, 323);
this.label10.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label10.Location = new System.Drawing.Point(83, 210);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(150, 35);
this.label10.Size = new System.Drawing.Size(100, 23);
this.label10.TabIndex = 9;
this.label10.Text = "Height (in):";
this.label10.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// label11
//
this.label11.Location = new System.Drawing.Point(124, 358);
this.label11.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label11.Location = new System.Drawing.Point(83, 233);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(150, 35);
this.label11.Size = new System.Drawing.Size(100, 23);
this.label11.TabIndex = 10;
this.label11.Text = "Date of Birth:";
this.label11.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// label12
//
this.label12.Location = new System.Drawing.Point(586, 217);
this.label12.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label12.Location = new System.Drawing.Point(391, 141);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(150, 35);
this.label12.Size = new System.Drawing.Size(100, 23);
this.label12.TabIndex = 11;
this.label12.Text = "Phone Number:";
this.label12.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// label13
//
this.label13.Location = new System.Drawing.Point(124, 394);
this.label13.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label13.Location = new System.Drawing.Point(83, 256);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(150, 35);
this.label13.Size = new System.Drawing.Size(100, 23);
this.label13.TabIndex = 12;
this.label13.Text = "Gender (M/F):";
this.label13.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// txtPatientID
//
this.txtPatientID.Location = new System.Drawing.Point(284, 114);
this.txtPatientID.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.txtPatientID.Location = new System.Drawing.Point(189, 74);
this.txtPatientID.Name = "txtPatientID";
this.txtPatientID.Size = new System.Drawing.Size(148, 26);
this.txtPatientID.Size = new System.Drawing.Size(100, 20);
this.txtPatientID.TabIndex = 1;
//
// txtFname
//
this.txtFname.Location = new System.Drawing.Point(284, 149);
this.txtFname.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.txtFname.Location = new System.Drawing.Point(189, 97);
this.txtFname.Name = "txtFname";
this.txtFname.Size = new System.Drawing.Size(148, 26);
this.txtFname.Size = new System.Drawing.Size(100, 20);
this.txtFname.TabIndex = 2;
//
// txtLname
//
this.txtLname.Location = new System.Drawing.Point(284, 185);
this.txtLname.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.txtLname.Location = new System.Drawing.Point(189, 120);
this.txtLname.Name = "txtLname";
this.txtLname.Size = new System.Drawing.Size(148, 26);
this.txtLname.Size = new System.Drawing.Size(100, 20);
this.txtLname.TabIndex = 3;
//
// txtMidInit
//
this.txtMidInit.Location = new System.Drawing.Point(284, 220);
this.txtMidInit.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.txtMidInit.Location = new System.Drawing.Point(189, 143);
this.txtMidInit.Name = "txtMidInit";
this.txtMidInit.Size = new System.Drawing.Size(148, 26);
this.txtMidInit.Size = new System.Drawing.Size(100, 20);
this.txtMidInit.TabIndex = 4;
//
// txtWeight
//
this.txtWeight.Location = new System.Drawing.Point(284, 255);
this.txtWeight.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.txtWeight.Location = new System.Drawing.Point(189, 166);
this.txtWeight.Name = "txtWeight";
this.txtWeight.Size = new System.Drawing.Size(148, 26);
this.txtWeight.Size = new System.Drawing.Size(100, 20);
this.txtWeight.TabIndex = 5;
//
// txtHeightFt
//
this.txtHeightFt.Location = new System.Drawing.Point(284, 291);
this.txtHeightFt.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.txtHeightFt.Location = new System.Drawing.Point(189, 189);
this.txtHeightFt.Name = "txtHeightFt";
this.txtHeightFt.Size = new System.Drawing.Size(148, 26);
this.txtHeightFt.Size = new System.Drawing.Size(100, 20);
this.txtHeightFt.TabIndex = 6;
//
// txtHeightIn
//
this.txtHeightIn.Location = new System.Drawing.Point(284, 326);
this.txtHeightIn.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.txtHeightIn.Location = new System.Drawing.Point(189, 212);
this.txtHeightIn.Name = "txtHeightIn";
this.txtHeightIn.Size = new System.Drawing.Size(148, 26);
this.txtHeightIn.Size = new System.Drawing.Size(100, 20);
this.txtHeightIn.TabIndex = 7;
//
// txtDOB
//
this.txtDOB.Location = new System.Drawing.Point(284, 362);
this.txtDOB.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.txtDOB.Location = new System.Drawing.Point(189, 235);
this.txtDOB.Name = "txtDOB";
this.txtDOB.Size = new System.Drawing.Size(148, 26);
this.txtDOB.Size = new System.Drawing.Size(100, 20);
this.txtDOB.TabIndex = 8;
//
// txtGender
//
this.txtGender.Location = new System.Drawing.Point(284, 397);
this.txtGender.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.txtGender.Name = "txtGender";
this.txtGender.Size = new System.Drawing.Size(148, 26);
this.txtGender.TabIndex = 9;
//
// txtCity
//
this.txtCity.Location = new System.Drawing.Point(746, 114);
this.txtCity.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.txtCity.Location = new System.Drawing.Point(497, 74);
this.txtCity.Name = "txtCity";
this.txtCity.Size = new System.Drawing.Size(148, 26);
this.txtCity.Size = new System.Drawing.Size(100, 20);
this.txtCity.TabIndex = 10;
//
// txtZip
//
this.txtZip.Location = new System.Drawing.Point(746, 149);
this.txtZip.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.txtZip.Location = new System.Drawing.Point(497, 97);
this.txtZip.Name = "txtZip";
this.txtZip.Size = new System.Drawing.Size(148, 26);
this.txtZip.Size = new System.Drawing.Size(100, 20);
this.txtZip.TabIndex = 11;
//
// txtState
//
this.txtState.Location = new System.Drawing.Point(746, 185);
this.txtState.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.txtState.Location = new System.Drawing.Point(497, 120);
this.txtState.Name = "txtState";
this.txtState.Size = new System.Drawing.Size(148, 26);
this.txtState.Size = new System.Drawing.Size(100, 20);
this.txtState.TabIndex = 12;
//
// txtPhone
//
this.txtPhone.Location = new System.Drawing.Point(746, 220);
this.txtPhone.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.txtPhone.Location = new System.Drawing.Point(497, 143);
this.txtPhone.Name = "txtPhone";
this.txtPhone.Size = new System.Drawing.Size(148, 26);
this.txtPhone.Size = new System.Drawing.Size(100, 20);
this.txtPhone.TabIndex = 13;
//
// 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(309, 14);
this.lblDisPurpose.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lblDisPurpose.Location = new System.Drawing.Point(206, 9);
this.lblDisPurpose.Name = "lblDisPurpose";
this.lblDisPurpose.Size = new System.Drawing.Size(570, 55);
this.lblDisPurpose.Size = new System.Drawing.Size(380, 36);
this.lblDisPurpose.TabIndex = 26;
this.lblDisPurpose.Text = "Patient";
this.lblDisPurpose.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// btnGO
//
this.btnGO.Location = new System.Drawing.Point(832, 600);
this.btnGO.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.btnGO.Location = new System.Drawing.Point(555, 390);
this.btnGO.Name = "btnGO";
this.btnGO.Size = new System.Drawing.Size(112, 35);
this.btnGO.Size = new System.Drawing.Size(75, 23);
this.btnGO.TabIndex = 14;
this.btnGO.UseVisualStyleBackColor = true;
this.btnGO.Click += new System.EventHandler(this.btnGO_Click);
//
// btnClose
//
this.btnClose.Location = new System.Drawing.Point(1011, 600);
this.btnClose.Location = new System.Drawing.Point(674, 390);
this.btnClose.Margin = new System.Windows.Forms.Padding(2);
this.btnClose.Name = "btnClose";
this.btnClose.Size = new System.Drawing.Size(112, 35);
this.btnClose.Size = new System.Drawing.Size(75, 23);
this.btnClose.TabIndex = 15;
this.btnClose.Text = "Close";
this.btnClose.UseVisualStyleBackColor = true;
this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
//
// cboGender
//
this.cboGender.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.cboGender.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.cboGender.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cboGender.FormattingEnabled = true;
this.cboGender.Location = new System.Drawing.Point(189, 258);
this.cboGender.Name = "cboGender";
this.cboGender.Size = new System.Drawing.Size(100, 21);
this.cboGender.TabIndex = 27;
//
// frmPatient
//
this.AcceptButton = this.btnGO;
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1218, 743);
this.ClientSize = new System.Drawing.Size(812, 483);
this.Controls.Add(this.cboGender);
this.Controls.Add(this.btnClose);
this.Controls.Add(this.btnGO);
this.Controls.Add(this.lblDisPurpose);
@ -341,7 +319,6 @@ namespace Louis__Pharmacy_CNSA212_FP
this.Controls.Add(this.txtState);
this.Controls.Add(this.txtZip);
this.Controls.Add(this.txtCity);
this.Controls.Add(this.txtGender);
this.Controls.Add(this.txtDOB);
this.Controls.Add(this.txtHeightIn);
this.Controls.Add(this.txtHeightFt);
@ -363,7 +340,6 @@ 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(4, 5, 4, 5);
this.Name = "frmPatient";
this.Text = "frmPatientAdd";
this.Load += new System.EventHandler(this.frmPatientAdd_Load);
@ -371,6 +347,8 @@ namespace Louis__Pharmacy_CNSA212_FP
this.PerformLayout();
}
private System.Windows.Forms.ComboBox cboGender;
private System.Windows.Forms.Button btnClose;
private System.Windows.Forms.Button btnGO;
@ -383,7 +361,6 @@ namespace Louis__Pharmacy_CNSA212_FP
private System.Windows.Forms.TextBox txtHeightFt;
private System.Windows.Forms.TextBox txtHeightIn;
private System.Windows.Forms.TextBox txtDOB;
private System.Windows.Forms.TextBox txtGender;
private System.Windows.Forms.TextBox txtCity;
private System.Windows.Forms.TextBox txtZip;
private System.Windows.Forms.TextBox txtState;

View File

@ -57,6 +57,8 @@ namespace Louis__Pharmacy_CNSA212_FP
var nextID = PharmacyDataTier.GetNextPatientID();
txtPatientID.Text = nextID.ToString();
}
PharmacyDataTier.FillComboBox("GENDER","*","GenderValue",cboGender);
}
public void FillPatient(string patID)
@ -73,7 +75,7 @@ namespace Louis__Pharmacy_CNSA212_FP
txtHeightFt.Text = ds.Tables[0].Rows[0]["Height_feet"].ToString();
txtHeightIn.Text = ds.Tables[0].Rows[0]["Height_inches"].ToString();
txtDOB.Text = ds.Tables[0].Rows[0]["DOB"].ToString();
txtGender.Text = ds.Tables[0].Rows[0]["Gender"].ToString();
cboGender.Text = ds.Tables[0].Rows[0]["Gender"].ToString();
txtCity.Text = ds.Tables[0].Rows[0]["City"].ToString();
txtZip.Text = ds.Tables[0].Rows[0]["Zip"].ToString();
txtState.Text = ds.Tables[0].Rows[0]["UsState"].ToString();
@ -117,7 +119,7 @@ namespace Louis__Pharmacy_CNSA212_FP
DOB = DateTime.Parse(txtDOB.Text);
try
{
Gender = txtGender.Text;
Gender = cboGender.Text;
try
{
Zip = short.Parse(txtZip.Text);
@ -204,7 +206,7 @@ namespace Louis__Pharmacy_CNSA212_FP
if (Gender.Length > 1)
{
epLocal.SetError(txtGender, "Error");
epLocal.SetError(cboGender, "Error");
throw new Exception();
}
@ -253,7 +255,7 @@ namespace Louis__Pharmacy_CNSA212_FP
}
catch (Exception ex)
{
epLocal.SetError(txtGender, "Invalid Value");
epLocal.SetError(cboGender, "Invalid Value");
}
}
catch (Exception ex)
@ -290,7 +292,7 @@ namespace Louis__Pharmacy_CNSA212_FP
DOB = DateTime.Parse(txtDOB.Text);
try
{
Gender = txtGender.Text;
Gender = cboGender.Text;
try
{
Zip = short.Parse(txtZip.Text);
@ -377,7 +379,7 @@ namespace Louis__Pharmacy_CNSA212_FP
if (Gender.Length > 1)
{
epLocal.SetError(txtGender, "Error");
epLocal.SetError(cboGender, "Error");
throw new Exception();
}
@ -426,7 +428,7 @@ namespace Louis__Pharmacy_CNSA212_FP
}
catch (Exception ex)
{
epLocal.SetError(txtGender, "Invalid Value");
epLocal.SetError(cboGender, "Invalid Value");
}
}
catch (Exception ex)