2024-01-31 12:05:11 -05:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
2024-02-14 18:21:17 -05:00
|
|
|
|
|
2024-01-31 12:05:11 -05:00
|
|
|
|
namespace Louis__Pharmacy_CNSA212_FP
|
|
|
|
|
{
|
2024-01-31 12:45:33 -05:00
|
|
|
|
public partial class frmInfo : Form
|
2024-01-31 12:05:11 -05:00
|
|
|
|
{
|
2024-02-14 18:21:17 -05:00
|
|
|
|
private ErrorProvider ep1 = new ErrorProvider();
|
|
|
|
|
|
2024-01-31 12:45:33 -05:00
|
|
|
|
public frmInfo()
|
2024-01-31 12:05:11 -05:00
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
}
|
2024-02-02 16:00:30 -05:00
|
|
|
|
|
|
|
|
|
private void frmInfo_Load(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
2024-02-14 19:27:21 -05:00
|
|
|
|
KeyPreview = true;
|
|
|
|
|
KeyDown += frmInfo_KeyDown;
|
2024-02-15 12:26:59 -05:00
|
|
|
|
|
|
|
|
|
cmuPatientEdit.Enabled = false;
|
|
|
|
|
cmuPatientDelete.Enabled = false;
|
|
|
|
|
|
2024-02-02 16:00:30 -05:00
|
|
|
|
}
|
2024-02-06 11:46:50 -05:00
|
|
|
|
|
2024-02-14 19:27:21 -05:00
|
|
|
|
private void frmInfo_KeyDown(object sender, KeyEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
// esc not funtional
|
|
|
|
|
if (e.KeyCode == Keys.Escape) // Check if the pressed key is Escape
|
|
|
|
|
{this.Close(); // Close the form
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (e.KeyCode == Keys.Enter){
|
|
|
|
|
btnPatientSearch_Click(sender, e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-06 11:46:50 -05:00
|
|
|
|
private void addUpdatePatientAndPhysicianToolStripMenuItem_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
2024-02-07 13:23:25 -05:00
|
|
|
|
|
|
|
|
|
private void pATIENTBindingNavigatorSaveItem_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
2024-02-14 18:21:17 -05:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btnPatientSearch_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
string fname = "";
|
|
|
|
|
string lname = "";
|
|
|
|
|
string id = "";
|
|
|
|
|
|
|
|
|
|
DataSet ds = new DataSet();
|
|
|
|
|
|
|
|
|
|
if (txtPatientFirst.Text.Length + txtPatientLast.Text.Length + txtPatientID.Text.Length > 0)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
fname = txtPatientFirst.Text;
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
lname = txtPatientLast.Text;
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
id = txtPatientID.Text;
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ds = PharmacyDataTier.PatientInfoSearch(id,lname,fname);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (ds.Tables[0].Rows.Count > 0) // There is a record.
|
|
|
|
|
{
|
|
|
|
|
dgvPatient.Visible = true;
|
|
|
|
|
// Get data source.
|
|
|
|
|
dgvPatient.DataSource = ds.Tables[0];
|
|
|
|
|
dgvPatient.AlternatingRowsDefaultCellStyle.BackColor = Color.LightGreen;
|
|
|
|
|
|
|
|
|
|
// Set the row and column header styles.
|
|
|
|
|
dgvPatient.ColumnHeadersDefaultCellStyle.ForeColor = Color.White;
|
|
|
|
|
dgvPatient.ColumnHeadersDefaultCellStyle.BackColor = Color.Green;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
dgvPatient.Visible = false; // Hide the DataGridView if no results are found.
|
|
|
|
|
MessageBox.Show("No records found.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception exception)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
ep1.SetError(btnPatientSearch, "Error Searching");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception exception)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
ep1.SetError(txtPatientID, "Invalid Value");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception exception)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
ep1.SetError(txtPatientLast, "Invalid Value");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception exception)
|
|
|
|
|
{
|
|
|
|
|
ep1.SetError(txtPatientFirst, "Invalid Value");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
2024-02-15 12:26:59 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cmuPatientEdit.Enabled = dgvPatient.Rows.Count > 0;
|
|
|
|
|
cmuPatientDelete.Enabled = dgvPatient.Rows.Count > 0;
|
2024-02-14 18:21:17 -05:00
|
|
|
|
|
|
|
|
|
|
2024-02-07 13:23:25 -05:00
|
|
|
|
}
|
2024-02-14 19:27:21 -05:00
|
|
|
|
|
|
|
|
|
private void btnPrescriptionSearch_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
string rxID = "";
|
|
|
|
|
string patientID = "";
|
|
|
|
|
|
|
|
|
|
DataSet ds = new DataSet();
|
|
|
|
|
|
|
|
|
|
if (txtPrescriptionPatID.Text.Length+txtRxNumber.Text.Length > 0)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
patientID = txtPrescriptionPatID.Text;
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
rxID = txtRxNumber.Text;
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ds = PharmacyDataTier.PrescriptionInfoSearch(rxID, patientID);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (ds.Tables[0].Rows.Count > 0) // There is a record.
|
|
|
|
|
{
|
|
|
|
|
dgvPrescription.Visible = true;
|
|
|
|
|
// Get data source.
|
|
|
|
|
dgvPrescription.DataSource = ds.Tables[0];
|
|
|
|
|
dgvPrescription.AlternatingRowsDefaultCellStyle.BackColor = Color.LightGreen;
|
|
|
|
|
|
|
|
|
|
// Set the row and column header styles.
|
|
|
|
|
dgvPrescription.ColumnHeadersDefaultCellStyle.ForeColor = Color.White;
|
|
|
|
|
dgvPrescription.ColumnHeadersDefaultCellStyle.BackColor = Color.Green;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
dgvPatient.Visible = false; // Hide the DataGridView if no results are found.
|
|
|
|
|
MessageBox.Show("No records found.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception exception)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
ep1.SetError(btnPrescriptionSearch, "Error Searching");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception exception)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
ep1.SetError(txtRxNumber, "Invalid Value");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception exception)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
ep1.SetError(txtPrescriptionPatID, "Invalid Value");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-02-14 19:43:07 -05:00
|
|
|
|
|
|
|
|
|
private void btnPhysicianSearch_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2024-02-15 12:26:59 -05:00
|
|
|
|
|
2024-02-14 19:43:07 -05:00
|
|
|
|
string fname = "";
|
|
|
|
|
string lname = "";
|
|
|
|
|
string phyID = "";;
|
|
|
|
|
|
|
|
|
|
DataSet ds = new DataSet();
|
|
|
|
|
|
|
|
|
|
if (txtPhysicianFirst.Text.Length+txtPhysicianLast.Text.Length+txtPhysicianID.Text.Length > 0)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
fname = txtPhysicianFirst.Text;
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
lname = txtPhysicianLast.Text;
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
phyID = txtPhysicianID.Text;
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ds = PharmacyDataTier.PhysicianInfoSearch(fname, lname, phyID);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (ds.Tables[0].Rows.Count > 0) // There is a record.
|
|
|
|
|
{
|
|
|
|
|
dgvPhysician.Visible = true;
|
|
|
|
|
// Get data source.
|
|
|
|
|
dgvPhysician.DataSource = ds.Tables[0];
|
|
|
|
|
dgvPhysician.AlternatingRowsDefaultCellStyle.BackColor = Color.LightGreen;
|
|
|
|
|
|
|
|
|
|
// Set the row and column header styles.
|
|
|
|
|
dgvPhysician.ColumnHeadersDefaultCellStyle.ForeColor = Color.White;
|
|
|
|
|
dgvPhysician.ColumnHeadersDefaultCellStyle.BackColor = Color.Green;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
dgvPatient.Visible = false; // Hide the DataGridView if no results are found.
|
|
|
|
|
MessageBox.Show("No records found.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception exception)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
ep1.SetError(btnPhysicianSearch, "Error Searching");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception exception)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
ep1.SetError(txtPhysicianID, "Invalid Value");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception exception)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
ep1.SetError(txtPhysicianLast, "Invalid Value");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception exception)
|
|
|
|
|
{
|
|
|
|
|
ep1.SetError(txtPhysicianFirst, "Invalid Value");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-15 12:26:59 -05:00
|
|
|
|
|
2024-02-14 19:43:07 -05:00
|
|
|
|
}
|
2024-02-15 08:55:05 -05:00
|
|
|
|
|
|
|
|
|
private void cmuPatientNew_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2024-02-15 12:26:59 -05:00
|
|
|
|
|
|
|
|
|
frmPatientAdd PatientAdd = new frmPatientAdd(true);
|
|
|
|
|
PatientAdd.MdiParent = MdiParent;
|
|
|
|
|
PatientAdd.StartPosition = FormStartPosition.CenterScreen;
|
|
|
|
|
PatientAdd.Show();
|
|
|
|
|
PatientAdd.Focus();
|
|
|
|
|
|
|
|
|
|
|
2024-02-15 08:55:05 -05:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void cmuPatientEdit_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2024-02-15 12:26:59 -05:00
|
|
|
|
if (dgvPatient.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
frmPatientAdd PatientAdd = new frmPatientAdd(false);
|
|
|
|
|
PatientAdd.MdiParent = MdiParent;
|
|
|
|
|
PatientAdd.StartPosition = FormStartPosition.CenterScreen;
|
|
|
|
|
PatientAdd.Show();
|
|
|
|
|
PatientAdd.Focus();
|
|
|
|
|
Console.WriteLine( dgvPatient.SelectedRows.Count);
|
|
|
|
|
DataGridViewRow row = dgvPatient.SelectedRows[1];
|
|
|
|
|
PatientAdd.FillPatient(row.Cells[0].Value.ToString().Trim());
|
|
|
|
|
}
|
2024-02-15 08:55:05 -05:00
|
|
|
|
}
|
2024-01-31 12:05:11 -05:00
|
|
|
|
}
|
|
|
|
|
}
|