made cmuPrescription Edit pull data
This commit is contained in:
parent
1334430e94
commit
f716bf0e54
@ -531,6 +531,45 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
}
|
||||
}
|
||||
|
||||
public static DataSet PrescriptionInfoSearch(string rxID)
|
||||
{
|
||||
try
|
||||
{
|
||||
// open connection
|
||||
myConn.Open();
|
||||
//clear any parameters
|
||||
cmdString.Parameters.Clear();
|
||||
// command
|
||||
cmdString.Connection = myConn;
|
||||
cmdString.CommandType = CommandType.StoredProcedure;
|
||||
cmdString.CommandTimeout = 1500;
|
||||
cmdString.CommandText = "PerscriptionInfoSearch";
|
||||
// Define input parameter
|
||||
cmdString.Parameters.Add("@rxID", SqlDbType.VarChar, 11).Value = rxID;
|
||||
cmdString.Parameters.Add("@patientID", SqlDbType.VarChar, 8).Value = "%";
|
||||
cmdString.Parameters.Add("@physicianID", SqlDbType.VarChar, 8).Value = "%";
|
||||
cmdString.Parameters.Add("@medID", SqlDbType.VarChar, 8).Value = "%";
|
||||
// adapter and dataset
|
||||
SqlDataAdapter aAdapter = new SqlDataAdapter();
|
||||
aAdapter.SelectCommand = cmdString;
|
||||
DataSet aDataSet = new DataSet();
|
||||
|
||||
// fill adapter
|
||||
aAdapter.Fill(aDataSet);
|
||||
|
||||
// return dataSet
|
||||
return aDataSet;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new ArgumentException(ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
myConn.Close();
|
||||
}
|
||||
}
|
||||
|
||||
public DataSet NumberofRefills(string rxID)
|
||||
{
|
||||
try
|
||||
|
4
Louis'-Pharmacy_CNSA212-FP/frmInfo.Designer.cs
generated
4
Louis'-Pharmacy_CNSA212-FP/frmInfo.Designer.cs
generated
@ -968,19 +968,21 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
// dgvRx
|
||||
//
|
||||
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.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);
|
||||
//
|
||||
// cmuPrescription
|
||||
//
|
||||
this.cmuPrescription.ImageScalingSize = new System.Drawing.Size(20, 20);
|
||||
this.cmuPrescription.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.cmuPrescriptionNew, this.cmuPrescriptionEdit, this.cmuPrescriptionDelete, this.cmuPrescriptionRefillThis, this.cmuPrescriptionViewRefills });
|
||||
this.cmuPrescription.Name = "cmuPrescription";
|
||||
this.cmuPrescription.Size = new System.Drawing.Size(244, 136);
|
||||
this.cmuPrescription.Size = new System.Drawing.Size(244, 114);
|
||||
//
|
||||
// cmuPrescriptionNew
|
||||
//
|
||||
|
@ -53,6 +53,7 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
private bool physicianIsActive;
|
||||
private bool patientIsActive;
|
||||
private bool medicationIsActive;
|
||||
private bool prescriptionIsActive;
|
||||
private void frmInfoTabChange(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
@ -61,6 +62,7 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
patientIsActive = false;
|
||||
physicianIsActive = false;
|
||||
medicationIsActive = false;
|
||||
prescriptionIsActive = false;
|
||||
|
||||
|
||||
if (tbcInfo.SelectedIndex == 0)
|
||||
@ -75,6 +77,10 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
{
|
||||
physicianIsActive = true;
|
||||
}
|
||||
else if (tbcInfo.SelectedIndex == 3)
|
||||
{
|
||||
prescriptionIsActive = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -108,6 +114,10 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
{
|
||||
cmuMedicationDelete_Click(sender, e);
|
||||
}
|
||||
if (prescriptionIsActive && e.KeyCode == Keys.Delete)
|
||||
{
|
||||
cmuPrescriptionDelete_Click(sender, e);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -123,6 +133,17 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
cmuPatientEdit_Click(sender,e);
|
||||
}
|
||||
|
||||
// if data grid view is not focused, run the search function
|
||||
if (e.KeyCode == Keys.Enter && prescriptionIsActive && !dgvPrescription.Focused)
|
||||
{
|
||||
btnPatientSearch_Click(sender,e);
|
||||
}
|
||||
// if data grid view is focused, run the edit function
|
||||
else if (e.KeyCode == Keys.Enter && prescriptionIsActive && dgvPrescription.Focused)
|
||||
{
|
||||
cmuPrescriptionEdit_Click(sender,e);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// if data grid view is not focused, run the search function
|
||||
@ -246,36 +267,36 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
// {
|
||||
// string medID = "";
|
||||
// string medicationName = "";
|
||||
|
||||
|
||||
//
|
||||
//
|
||||
// if (txtPrescriptionPatID.Text.Length+txtRxNumber.Text.Length > 0)
|
||||
// {
|
||||
|
||||
|
||||
//
|
||||
//
|
||||
// try
|
||||
// {
|
||||
|
||||
//
|
||||
// medicationName = txtPrescriptionPatID.Text;
|
||||
|
||||
//
|
||||
// try
|
||||
// {
|
||||
|
||||
//
|
||||
// medID = txtRxNumber.Text;
|
||||
|
||||
//
|
||||
// try
|
||||
// {
|
||||
|
||||
|
||||
//
|
||||
//
|
||||
// ds = PharmacyDataTier.MedicationInfoSearch(medID,medicationName);
|
||||
|
||||
|
||||
//
|
||||
//
|
||||
// if (ds.Tables[0].Rows.Count > 0) // There is a record.
|
||||
// {
|
||||
// dgvRx.Visible = true;
|
||||
// // Get data source.
|
||||
// dgvRx.DataSource = ds.Tables[0];
|
||||
// dgvRx.AlternatingRowsDefaultCellStyle.BackColor = Color.LightGreen;
|
||||
|
||||
//
|
||||
// // Set the row and column header styles.
|
||||
// dgvRx.ColumnHeadersDefaultCellStyle.ForeColor = Color.White;
|
||||
// dgvRx.ColumnHeadersDefaultCellStyle.BackColor = Color.Green;
|
||||
@ -285,40 +306,40 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
// dgvPatient.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(txtRxNumber, "Invalid Value");
|
||||
|
||||
//
|
||||
// }
|
||||
|
||||
//
|
||||
// }
|
||||
// catch (Exception exception)
|
||||
// {
|
||||
|
||||
//
|
||||
// ep1.SetError(txtPrescriptionPatID, "Invalid Value");
|
||||
|
||||
//
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
//
|
||||
//
|
||||
// cmuMedicationEdit.Enabled = dgvRx.Rows.Count > 0;
|
||||
// cmuMedicationDelete.Enabled = dgvRx.Rows.Count > 0;
|
||||
|
||||
//
|
||||
// dgvRx.Focus();
|
||||
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
@ -624,6 +645,24 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
private void cmuPrescriptionEdit_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
if (dgvRx.Rows.Count > 0)
|
||||
{
|
||||
|
||||
dgvRx.DataSource = ds.Tables[0];
|
||||
// Console.WriteLine( dgvPatient.SelectedRows.Count);
|
||||
DataGridViewRow row = new DataGridViewRow();
|
||||
row = dgvRx.SelectedRows[0];
|
||||
string prescID = "";
|
||||
prescID = (row.Cells[0].Value).ToString();
|
||||
frmPrescription PrescriptionAdd = new frmPrescription(this, false);
|
||||
PrescriptionAdd.MdiParent = MdiParent;
|
||||
PrescriptionAdd.StartPosition = FormStartPosition.CenterScreen;
|
||||
PrescriptionAdd.Show();
|
||||
PrescriptionAdd.Focus();
|
||||
PrescriptionAdd.FillPrescription(prescID);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void cmuPrescriptionDelete_Click(object sender, EventArgs e)
|
||||
@ -639,7 +678,7 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
string patID = "";
|
||||
|
||||
|
||||
if (txtRxPatientID.Text.Length + txtRxNumber.Text.Length > 0)
|
||||
if (txtRxPatientID.Text.Length + txtRxPrescriptionID.Text.Length + txtRxPhysicianID.Text.Length + txtRxMedicationID.Text.Length> 0)
|
||||
{
|
||||
|
||||
try
|
||||
@ -706,5 +745,10 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void dgvRx_CellContentClick(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -65,6 +65,20 @@ namespace Louis__Pharmacy_CNSA212_FP
|
||||
txtCompletedRefills.Text = ds.Tables[0].Rows[0]["Completed_refills"].ToString();
|
||||
txtMaxRefills.Text = ds.Tables[0].Rows[0]["Max_refills"].ToString();
|
||||
}
|
||||
public void FillPrescription(string rxNum)
|
||||
{
|
||||
var ds = new DataSet();
|
||||
var data = new PharmacyDataTier();
|
||||
|
||||
ds = PharmacyDataTier.PrescriptionInfoSearch(rxNum);
|
||||
txtRxNum.Text = ds.Tables[0].Rows[0]["RxNum_id"].ToString();
|
||||
txtPatID.Text = ds.Tables[0].Rows[0]["Patient_id"].ToString();
|
||||
txtMedID.Text = ds.Tables[0].Rows[0]["Medication_id"].ToString();
|
||||
txtPhysName.Text = ds.Tables[0].Rows[0]["PrescribedBy"].ToString();
|
||||
txtPhysID.Text = ds.Tables[0].Rows[0]["Physician_id"].ToString();
|
||||
txtCompletedRefills.Text = ds.Tables[0].Rows[0]["pastNumRefills"].ToString();
|
||||
txtMaxRefills.Text = ds.Tables[0].Rows[0]["numRefills"].ToString();
|
||||
}
|
||||
|
||||
private void btnCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user