2024-02-14 17:40:16 -05:00
|
|
|
|
using System;
|
|
|
|
|
using System.Configuration;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using System.Data.SqlClient;
|
2024-02-14 19:43:07 -05:00
|
|
|
|
using System.Runtime.Versioning;
|
2024-02-14 17:40:16 -05:00
|
|
|
|
|
|
|
|
|
namespace Louis__Pharmacy_CNSA212_FP
|
2024-02-14 17:35:35 -05:00
|
|
|
|
{
|
|
|
|
|
public class PharmacyDataTier
|
|
|
|
|
{
|
2024-02-14 17:40:16 -05:00
|
|
|
|
|
|
|
|
|
static String connString = ConfigurationManager.ConnectionStrings["ConnString"].ConnectionString;
|
|
|
|
|
static SqlConnection myConn = new SqlConnection(connString);
|
|
|
|
|
static System.Data.SqlClient.SqlCommand cmdString = new System.Data.SqlClient.SqlCommand();
|
2024-02-16 13:57:58 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void UpdatePatient(
|
|
|
|
|
string Patient_id,
|
|
|
|
|
string FirstName,
|
|
|
|
|
string LastName,
|
|
|
|
|
string MiddleIntials,
|
|
|
|
|
int lbs,
|
|
|
|
|
int Height_feet,
|
|
|
|
|
int Height_inches,
|
|
|
|
|
DateTime DOB,
|
|
|
|
|
string Gender,
|
|
|
|
|
string City,
|
|
|
|
|
Int16 Zip,
|
|
|
|
|
string UsState,
|
|
|
|
|
string PhoneNumber)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
myConn.Open();
|
|
|
|
|
|
|
|
|
|
cmdString.Parameters.Clear();
|
|
|
|
|
|
|
|
|
|
cmdString.Connection = myConn;
|
|
|
|
|
cmdString.CommandType = CommandType.StoredProcedure;
|
|
|
|
|
cmdString.CommandTimeout = 1500;
|
|
|
|
|
|
|
|
|
|
cmdString.CommandText = "UpdatePatient";
|
|
|
|
|
|
|
|
|
|
cmdString.Parameters.Add("@Patient_id", SqlDbType.VarChar, 8).Value = Patient_id;
|
|
|
|
|
cmdString.Parameters.Add("@FirstName", SqlDbType.VarChar, 30).Value = FirstName;
|
|
|
|
|
cmdString.Parameters.Add("@LastName", SqlDbType.VarChar, 30).Value = LastName;
|
|
|
|
|
cmdString.Parameters.Add("@MiddleIntials", SqlDbType.VarChar).Value = MiddleIntials;
|
|
|
|
|
cmdString.Parameters.Add("@lbs", SqlDbType.Int).Value = lbs;
|
|
|
|
|
cmdString.Parameters.Add("@Height_feet", SqlDbType.Int).Value = Height_feet;
|
|
|
|
|
cmdString.Parameters.Add("@Height_inches", SqlDbType.Int).Value = Height_inches;
|
|
|
|
|
cmdString.Parameters.Add("@DOB", SqlDbType.DateTime).Value = DOB;
|
|
|
|
|
cmdString.Parameters.Add("@Gender", SqlDbType.Char).Value = Gender;
|
|
|
|
|
cmdString.Parameters.Add("@City", SqlDbType.VarChar, 30).Value = City;
|
|
|
|
|
cmdString.Parameters.Add("@Zip", SqlDbType.SmallInt).Value = Zip;
|
|
|
|
|
cmdString.Parameters.Add("@UsState", SqlDbType.Char, 2).Value = UsState;
|
|
|
|
|
cmdString.Parameters.Add("@PhoneNumber", SqlDbType.Char,14).Value = PhoneNumber;
|
|
|
|
|
|
|
|
|
|
cmdString.ExecuteNonQuery();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentException(ex.Message);
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
myConn.Close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-14 17:35:35 -05:00
|
|
|
|
|
2024-02-16 16:08:18 -05:00
|
|
|
|
public static void CreatePatient(
|
|
|
|
|
string Patient_id,
|
|
|
|
|
string FirstName,
|
|
|
|
|
string LastName,
|
|
|
|
|
string MiddleIntials,
|
|
|
|
|
int lbs,
|
|
|
|
|
int Height_feet,
|
|
|
|
|
int Height_inches,
|
|
|
|
|
DateTime DOB,
|
|
|
|
|
string Gender,
|
|
|
|
|
string City,
|
|
|
|
|
Int16 Zip,
|
|
|
|
|
string UsState,
|
|
|
|
|
string PhoneNumber)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
myConn.Open();
|
|
|
|
|
|
|
|
|
|
cmdString.Parameters.Clear();
|
|
|
|
|
|
|
|
|
|
cmdString.Connection = myConn;
|
|
|
|
|
cmdString.CommandType = CommandType.StoredProcedure;
|
|
|
|
|
cmdString.CommandTimeout = 1500;
|
|
|
|
|
|
|
|
|
|
cmdString.CommandText = "CreatePatient";
|
|
|
|
|
|
|
|
|
|
cmdString.Parameters.Add("@Patient_id", SqlDbType.VarChar, 8).Value = Patient_id;
|
|
|
|
|
cmdString.Parameters.Add("@FirstName", SqlDbType.VarChar, 30).Value = FirstName;
|
|
|
|
|
cmdString.Parameters.Add("@LastName", SqlDbType.VarChar, 30).Value = LastName;
|
|
|
|
|
cmdString.Parameters.Add("@MiddleIntials", SqlDbType.VarChar).Value = MiddleIntials;
|
|
|
|
|
cmdString.Parameters.Add("@lbs", SqlDbType.Int).Value = lbs;
|
|
|
|
|
cmdString.Parameters.Add("@Height_feet", SqlDbType.Int).Value = Height_feet;
|
|
|
|
|
cmdString.Parameters.Add("@Height_inches", SqlDbType.Int).Value = Height_inches;
|
|
|
|
|
cmdString.Parameters.Add("@DOB", SqlDbType.DateTime).Value = DOB;
|
|
|
|
|
cmdString.Parameters.Add("@Gender", SqlDbType.Char).Value = Gender;
|
|
|
|
|
cmdString.Parameters.Add("@City", SqlDbType.VarChar, 30).Value = City;
|
|
|
|
|
cmdString.Parameters.Add("@Zip", SqlDbType.SmallInt).Value = Zip;
|
|
|
|
|
cmdString.Parameters.Add("@UsState", SqlDbType.Char, 2).Value = UsState;
|
|
|
|
|
cmdString.Parameters.Add("@PhoneNumber", SqlDbType.Char,14).Value = PhoneNumber;
|
|
|
|
|
|
|
|
|
|
cmdString.ExecuteNonQuery();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentException(ex.Message);
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
myConn.Close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
2024-02-19 11:56:51 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void CreatePhysician(
|
|
|
|
|
string Physician_id,
|
|
|
|
|
string FirstName,
|
|
|
|
|
string LastName,
|
|
|
|
|
string MiddleInit,
|
|
|
|
|
DateTime DOB,
|
|
|
|
|
string Gender,
|
|
|
|
|
string City,
|
|
|
|
|
Int16 Zip,
|
|
|
|
|
string UsState,
|
|
|
|
|
string PhoneNumber,
|
|
|
|
|
string Speciality)
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
myConn.Open();
|
|
|
|
|
|
|
|
|
|
cmdString.Parameters.Clear();
|
|
|
|
|
|
|
|
|
|
cmdString.Connection = myConn;
|
|
|
|
|
cmdString.CommandType = CommandType.StoredProcedure;
|
|
|
|
|
cmdString.CommandTimeout = 1500;
|
|
|
|
|
|
|
|
|
|
cmdString.CommandText = "CreatePhysician";
|
|
|
|
|
|
|
|
|
|
cmdString.Parameters.Add("@Physician_id", SqlDbType.VarChar, 8).Value = Physician_id;
|
|
|
|
|
cmdString.Parameters.Add("@FirstName", SqlDbType.VarChar, 30).Value = FirstName;
|
|
|
|
|
cmdString.Parameters.Add("@LastName", SqlDbType.VarChar, 30).Value = LastName;
|
|
|
|
|
cmdString.Parameters.Add("@MiddleIntials", SqlDbType.VarChar).Value = MiddleInit;
|
|
|
|
|
cmdString.Parameters.Add("@DOB", SqlDbType.DateTime).Value = DOB;
|
|
|
|
|
cmdString.Parameters.Add("@Gender", SqlDbType.Char).Value = Gender;
|
2024-02-19 13:38:27 -05:00
|
|
|
|
cmdString.Parameters.Add("@City", SqlDbType.VarChar, 30).Value = City;
|
|
|
|
|
cmdString.Parameters.Add("@Zip", SqlDbType.SmallInt).Value = Zip;
|
|
|
|
|
cmdString.Parameters.Add("@UsState", SqlDbType.VarChar, 2).Value = UsState;
|
|
|
|
|
cmdString.Parameters.Add("@PhoneNumber", SqlDbType.VarChar, 14).Value = PhoneNumber;
|
|
|
|
|
cmdString.Parameters.Add("@Speciality", SqlDbType.VarChar, 100).Value = Speciality;
|
|
|
|
|
|
|
|
|
|
cmdString.ExecuteNonQuery();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentException(ex.Message);
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
myConn.Close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void UpdatePhysician(
|
|
|
|
|
string Physician_id,
|
|
|
|
|
string FirstName,
|
|
|
|
|
string LastName,
|
|
|
|
|
string MiddleInit,
|
|
|
|
|
DateTime DOB,
|
|
|
|
|
string Gender,
|
|
|
|
|
string City,
|
|
|
|
|
Int16 Zip,
|
|
|
|
|
string UsState,
|
|
|
|
|
string PhoneNumber,
|
|
|
|
|
string Speciality)
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
myConn.Open();
|
|
|
|
|
|
|
|
|
|
cmdString.Parameters.Clear();
|
|
|
|
|
|
|
|
|
|
cmdString.Connection = myConn;
|
|
|
|
|
cmdString.CommandType = CommandType.StoredProcedure;
|
|
|
|
|
cmdString.CommandTimeout = 1500;
|
|
|
|
|
|
|
|
|
|
cmdString.CommandText = "UpdatePhysician";
|
|
|
|
|
|
|
|
|
|
cmdString.Parameters.Add("@Physician_id", SqlDbType.VarChar, 8).Value = Physician_id;
|
|
|
|
|
cmdString.Parameters.Add("@FirstName", SqlDbType.VarChar, 30).Value = FirstName;
|
|
|
|
|
cmdString.Parameters.Add("@LastName", SqlDbType.VarChar, 30).Value = LastName;
|
|
|
|
|
cmdString.Parameters.Add("@MiddleIntials", SqlDbType.VarChar).Value = MiddleInit;
|
|
|
|
|
cmdString.Parameters.Add("@DOB", SqlDbType.DateTime).Value = DOB;
|
|
|
|
|
cmdString.Parameters.Add("@Gender", SqlDbType.Char).Value = Gender;
|
2024-02-19 11:56:51 -05:00
|
|
|
|
cmdString.Parameters.Add("@City", SqlDbType.VarChar, 30).Value = City;
|
|
|
|
|
cmdString.Parameters.Add("@Zip", SqlDbType.SmallInt).Value = Zip;
|
|
|
|
|
cmdString.Parameters.Add("@UsState", SqlDbType.VarChar, 2).Value = UsState;
|
|
|
|
|
cmdString.Parameters.Add("@PhoneNumber", SqlDbType.VarChar, 14).Value = PhoneNumber;
|
|
|
|
|
cmdString.Parameters.Add("@Speciality", SqlDbType.VarChar, 100).Value = Speciality;
|
|
|
|
|
|
|
|
|
|
cmdString.ExecuteNonQuery();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentException(ex.Message);
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
myConn.Close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
2024-02-19 21:24:58 -05:00
|
|
|
|
|
|
|
|
|
public static void UpdateMedication(
|
|
|
|
|
string Medication_id,
|
|
|
|
|
string MedicationName,
|
|
|
|
|
string IntakeMethod,
|
|
|
|
|
string Frequency,
|
|
|
|
|
string Dosage,
|
|
|
|
|
string Purpose,
|
|
|
|
|
string RxNum)
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
myConn.Open();
|
|
|
|
|
|
|
|
|
|
cmdString.Parameters.Clear();
|
|
|
|
|
|
|
|
|
|
cmdString.Connection = myConn;
|
|
|
|
|
cmdString.CommandType = CommandType.StoredProcedure;
|
|
|
|
|
cmdString.CommandTimeout = 1500;
|
|
|
|
|
|
|
|
|
|
cmdString.CommandText = "UpdateMedication";
|
|
|
|
|
|
|
|
|
|
cmdString.Parameters.Add("@Medication_id", SqlDbType.VarChar, 7).Value = Medication_id;
|
|
|
|
|
cmdString.Parameters.Add("@MedicationName", SqlDbType.VarChar,60).Value = MedicationName;
|
|
|
|
|
cmdString.Parameters.Add("@IntakeMethod", SqlDbType.VarChar,30).Value =IntakeMethod ;
|
|
|
|
|
cmdString.Parameters.Add("@Frequency", SqlDbType.VarChar,30).Value =Frequency ;
|
|
|
|
|
cmdString.Parameters.Add("@Dosage", SqlDbType.VarChar,30).Value = Dosage;
|
|
|
|
|
cmdString.Parameters.Add("@Purpose", SqlDbType.VarChar,100).Value = Purpose;
|
|
|
|
|
cmdString.Parameters.Add("@RxNum", SqlDbType.VarChar,30).Value = RxNum;
|
|
|
|
|
|
|
|
|
|
cmdString.ExecuteNonQuery();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentException(ex.Message);
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
myConn.Close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void CreateMedication(
|
|
|
|
|
string Medication_id,
|
|
|
|
|
string MedicationName,
|
|
|
|
|
string IntakeMethod,
|
|
|
|
|
string Frequency,
|
|
|
|
|
string Dosage,
|
|
|
|
|
string Purpose,
|
|
|
|
|
string RxNum)
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
myConn.Open();
|
|
|
|
|
|
|
|
|
|
cmdString.Parameters.Clear();
|
|
|
|
|
|
|
|
|
|
cmdString.Connection = myConn;
|
|
|
|
|
cmdString.CommandType = CommandType.StoredProcedure;
|
|
|
|
|
cmdString.CommandTimeout = 1500;
|
|
|
|
|
|
|
|
|
|
cmdString.CommandText = "CreateMedication";
|
|
|
|
|
|
|
|
|
|
cmdString.Parameters.Add("@Medication_id", SqlDbType.VarChar, 7).Value = Medication_id;
|
|
|
|
|
cmdString.Parameters.Add("@MedicationName", SqlDbType.VarChar,60).Value = MedicationName;
|
|
|
|
|
cmdString.Parameters.Add("@IntakeMethod", SqlDbType.VarChar,30).Value =IntakeMethod ;
|
|
|
|
|
cmdString.Parameters.Add("@Frequency", SqlDbType.VarChar,30).Value =Frequency ;
|
|
|
|
|
cmdString.Parameters.Add("@Dosage", SqlDbType.VarChar,30).Value = Dosage;
|
|
|
|
|
cmdString.Parameters.Add("@Purpose", SqlDbType.VarChar,100).Value = Purpose;
|
|
|
|
|
cmdString.Parameters.Add("@RxNum", SqlDbType.VarChar,30).Value = RxNum;
|
|
|
|
|
|
|
|
|
|
cmdString.ExecuteNonQuery();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentException(ex.Message);
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
myConn.Close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
2024-02-16 16:08:18 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void DeletePatient(string Patient_id)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
// open connection
|
|
|
|
|
myConn.Open();
|
|
|
|
|
//clear any parameters
|
|
|
|
|
cmdString.Parameters.Clear();
|
|
|
|
|
// command
|
|
|
|
|
cmdString.Connection = myConn;
|
|
|
|
|
cmdString.CommandType = CommandType.StoredProcedure;
|
|
|
|
|
cmdString.CommandTimeout = 1500;
|
|
|
|
|
cmdString.CommandText = "DeletePatient";
|
|
|
|
|
// Define input parameter
|
|
|
|
|
cmdString.Parameters.Add("@Patient_id", SqlDbType.VarChar, 8).Value = Patient_id;
|
|
|
|
|
|
|
|
|
|
cmdString.ExecuteNonQuery();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentException(ex.Message);
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
myConn.Close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-19 13:11:10 -05:00
|
|
|
|
public static void DeletePhysician(string Physician_id)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
// open connection
|
|
|
|
|
myConn.Open();
|
|
|
|
|
//clear any parameters
|
|
|
|
|
cmdString.Parameters.Clear();
|
|
|
|
|
// command
|
|
|
|
|
cmdString.Connection = myConn;
|
|
|
|
|
cmdString.CommandType = CommandType.StoredProcedure;
|
|
|
|
|
cmdString.CommandTimeout = 1500;
|
|
|
|
|
cmdString.CommandText = "DeletePhysician";
|
|
|
|
|
// Define input parameter
|
|
|
|
|
cmdString.Parameters.Add("@Physician_id", SqlDbType.VarChar, 8).Value = Physician_id;
|
|
|
|
|
|
|
|
|
|
cmdString.ExecuteNonQuery();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentException(ex.Message);
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
myConn.Close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-19 21:24:58 -05:00
|
|
|
|
public static void DeleteMedication(string medID)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
// open connection
|
|
|
|
|
myConn.Open();
|
|
|
|
|
//clear any parameters
|
|
|
|
|
cmdString.Parameters.Clear();
|
|
|
|
|
// command
|
|
|
|
|
cmdString.Connection = myConn;
|
|
|
|
|
cmdString.CommandType = CommandType.StoredProcedure;
|
|
|
|
|
cmdString.CommandTimeout = 1500;
|
|
|
|
|
cmdString.CommandText = "DeleteMedication";
|
|
|
|
|
// Define input parameter
|
|
|
|
|
cmdString.Parameters.Add("@MedID", SqlDbType.VarChar, 7).Value = medID;
|
|
|
|
|
|
|
|
|
|
cmdString.ExecuteNonQuery();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentException(ex.Message);
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
myConn.Close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-16 16:08:18 -05:00
|
|
|
|
|
2024-02-14 17:35:35 -05:00
|
|
|
|
|
2024-02-14 18:21:17 -05:00
|
|
|
|
public static DataSet PatientInfoSearch(string id, string lname, string fname)
|
2024-02-14 17:40:16 -05:00
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
// open connection
|
|
|
|
|
myConn.Open();
|
|
|
|
|
//clear any parameters
|
|
|
|
|
cmdString.Parameters.Clear();
|
|
|
|
|
// command
|
|
|
|
|
cmdString.Connection = myConn;
|
|
|
|
|
cmdString.CommandType = CommandType.StoredProcedure;
|
|
|
|
|
cmdString.CommandTimeout = 1500;
|
2024-02-16 11:32:00 -05:00
|
|
|
|
cmdString.CommandText = "SearchPatients";
|
2024-02-14 17:40:16 -05:00
|
|
|
|
// Define input parameter
|
2024-02-16 11:32:00 -05:00
|
|
|
|
cmdString.Parameters.Add("@ID", SqlDbType.VarChar, 8).Value = id;
|
2024-02-14 18:21:17 -05:00
|
|
|
|
cmdString.Parameters.Add("@lname", SqlDbType.VarChar, 30).Value = lname;
|
|
|
|
|
cmdString.Parameters.Add("@fname", SqlDbType.VarChar, 30).Value = fname;
|
2024-02-14 17:40:16 -05:00
|
|
|
|
// 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();
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-02-15 12:04:26 -05:00
|
|
|
|
|
|
|
|
|
public static DataSet PatientInfoSearch(string id)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
// open connection
|
|
|
|
|
myConn.Open();
|
|
|
|
|
//clear any parameters
|
|
|
|
|
cmdString.Parameters.Clear();
|
|
|
|
|
// command
|
|
|
|
|
cmdString.Connection = myConn;
|
|
|
|
|
cmdString.CommandType = CommandType.StoredProcedure;
|
|
|
|
|
cmdString.CommandTimeout = 1500;
|
2024-02-16 11:32:00 -05:00
|
|
|
|
cmdString.CommandText = "SearchPatients";
|
2024-02-15 12:04:26 -05:00
|
|
|
|
// Define input parameter
|
2024-02-16 11:32:00 -05:00
|
|
|
|
cmdString.Parameters.Add("@ID", SqlDbType.VarChar, 8).Value = id;
|
|
|
|
|
cmdString.Parameters.Add("@lname", SqlDbType.VarChar, 30).Value = "";
|
|
|
|
|
cmdString.Parameters.Add("@fname", SqlDbType.VarChar, 30).Value = "";
|
2024-02-15 12:04:26 -05:00
|
|
|
|
// 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();
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-02-14 17:40:16 -05:00
|
|
|
|
|
2024-02-14 19:27:21 -05:00
|
|
|
|
|
|
|
|
|
public static DataSet PrescriptionInfoSearch(string rxID, string patientID)
|
|
|
|
|
{
|
|
|
|
|
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 = patientID;
|
|
|
|
|
// 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();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-14 17:40:16 -05:00
|
|
|
|
|
2024-02-14 19:43:07 -05:00
|
|
|
|
public static DataSet PhysicianInfoSearch(string fname,string lname, string phyID)
|
2024-02-14 17:40:16 -05:00
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
2024-02-19 10:47:16 -05:00
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
// open connection
|
|
|
|
|
myConn.Open();
|
|
|
|
|
//clear any parameters
|
|
|
|
|
cmdString.Parameters.Clear();
|
|
|
|
|
// command
|
|
|
|
|
cmdString.Connection = myConn;
|
|
|
|
|
cmdString.CommandType = CommandType.StoredProcedure;
|
|
|
|
|
cmdString.CommandTimeout = 1500;
|
|
|
|
|
cmdString.CommandText = "PhysicianInfoSearch";
|
|
|
|
|
// Define input parameter
|
|
|
|
|
cmdString.Parameters.Add("@fname", SqlDbType.VarChar, 11).Value = fname;
|
|
|
|
|
cmdString.Parameters.Add("@lname", SqlDbType.VarChar, 8).Value = lname;
|
|
|
|
|
cmdString.Parameters.Add("@phyID", SqlDbType.VarChar, 8).Value = phyID;
|
|
|
|
|
// adapter and dataset
|
|
|
|
|
SqlDataAdapter aAdapter = new SqlDataAdapter();
|
|
|
|
|
aAdapter.SelectCommand = cmdString;
|
|
|
|
|
DataSet aDataSet = new DataSet();
|
2024-02-14 17:40:16 -05:00
|
|
|
|
|
2024-02-19 10:47:16 -05:00
|
|
|
|
// fill adapter
|
|
|
|
|
aAdapter.Fill(aDataSet);
|
2024-02-14 17:40:16 -05:00
|
|
|
|
|
2024-02-19 10:47:16 -05:00
|
|
|
|
// return dataSet
|
|
|
|
|
return aDataSet;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentException(ex.Message);
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
myConn.Close();
|
|
|
|
|
}
|
2024-02-14 17:40:16 -05:00
|
|
|
|
}
|
2024-02-15 12:04:26 -05:00
|
|
|
|
|
2024-02-19 10:47:16 -05:00
|
|
|
|
|
|
|
|
|
public static DataSet PhysicianInfoSearch(string phyID)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
// open connection
|
|
|
|
|
myConn.Open();
|
|
|
|
|
//clear any parameters
|
|
|
|
|
cmdString.Parameters.Clear();
|
|
|
|
|
// command
|
|
|
|
|
cmdString.Connection = myConn;
|
|
|
|
|
cmdString.CommandType = CommandType.StoredProcedure;
|
|
|
|
|
cmdString.CommandTimeout = 1500;
|
|
|
|
|
cmdString.CommandText = "PhysicianInfoSearch";
|
|
|
|
|
// Define input parameter
|
|
|
|
|
cmdString.Parameters.Add("@fname", SqlDbType.VarChar, 11).Value = "";
|
|
|
|
|
cmdString.Parameters.Add("@lname", SqlDbType.VarChar, 8).Value = "";
|
|
|
|
|
cmdString.Parameters.Add("@phyID", SqlDbType.VarChar, 8).Value = phyID;
|
|
|
|
|
// 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();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-19 21:24:58 -05:00
|
|
|
|
public static DataSet MedicationInfoSearch(string medID, string medicationName)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
// open connection
|
|
|
|
|
myConn.Open();
|
|
|
|
|
//clear any parameters
|
|
|
|
|
cmdString.Parameters.Clear();
|
|
|
|
|
// command
|
|
|
|
|
cmdString.Connection = myConn;
|
|
|
|
|
cmdString.CommandType = CommandType.StoredProcedure;
|
|
|
|
|
cmdString.CommandTimeout = 1500;
|
|
|
|
|
cmdString.CommandText = "MedicationInfoSearch";
|
|
|
|
|
// Define input parameter
|
|
|
|
|
cmdString.Parameters.Add("@Medication_id", SqlDbType.VarChar, 7).Value = medID;
|
|
|
|
|
cmdString.Parameters.Add("@MedicationName", SqlDbType.VarChar, 60).Value = medicationName;
|
|
|
|
|
// 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 static DataSet MedicationInfoSearch(string medID)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
// open connection
|
|
|
|
|
myConn.Open();
|
|
|
|
|
//clear any parameters
|
|
|
|
|
cmdString.Parameters.Clear();
|
|
|
|
|
// command
|
|
|
|
|
cmdString.Connection = myConn;
|
|
|
|
|
cmdString.CommandType = CommandType.StoredProcedure;
|
|
|
|
|
cmdString.CommandTimeout = 1500;
|
|
|
|
|
cmdString.CommandText = "MedicationInfoSearch";
|
|
|
|
|
// Define input parameter
|
|
|
|
|
cmdString.Parameters.Add("@Medication_id", SqlDbType.VarChar, 7).Value = medID;
|
|
|
|
|
cmdString.Parameters.Add("@MedicationName", SqlDbType.VarChar, 60).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();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-19 10:47:16 -05:00
|
|
|
|
|
2024-02-15 12:04:26 -05:00
|
|
|
|
public static double GetNextPatientID()
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
// open connection
|
|
|
|
|
myConn.Open();
|
|
|
|
|
//clear any parameters
|
|
|
|
|
cmdString.Parameters.Clear();
|
|
|
|
|
// command
|
|
|
|
|
cmdString.Connection = myConn;
|
|
|
|
|
cmdString.CommandType = CommandType.StoredProcedure;
|
|
|
|
|
cmdString.CommandTimeout = 1500;
|
|
|
|
|
cmdString.CommandText = "GetNextPatientID";
|
|
|
|
|
// Define input parameter
|
|
|
|
|
cmdString.Parameters.Add("@TableName", SqlDbType.NVarChar, 128).Value = "PATIENT";
|
|
|
|
|
|
|
|
|
|
object result = cmdString.ExecuteScalar();
|
|
|
|
|
double value = 0;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
value = Convert.ToDouble(result);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch(Exception e)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("Error Getting next Patient ID","ERROR",MessageBoxButtons.OK);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// return dataSet
|
|
|
|
|
return value;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentException(ex.Message);
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
myConn.Close();
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-02-19 10:47:16 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static double GetNextPhysicianID()
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
// open connection
|
|
|
|
|
myConn.Open();
|
|
|
|
|
//clear any parameters
|
|
|
|
|
cmdString.Parameters.Clear();
|
|
|
|
|
// command
|
|
|
|
|
cmdString.Connection = myConn;
|
|
|
|
|
cmdString.CommandType = CommandType.StoredProcedure;
|
|
|
|
|
cmdString.CommandTimeout = 1500;
|
|
|
|
|
cmdString.CommandText = "GetNextPhysicianID";
|
|
|
|
|
|
|
|
|
|
object result = cmdString.ExecuteScalar();
|
|
|
|
|
double value = 0;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
value = Convert.ToDouble(result);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch(Exception e)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("Error Getting next Patient ID","ERROR",MessageBoxButtons.OK);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2024-02-19 21:24:58 -05:00
|
|
|
|
// return dataSet
|
|
|
|
|
return value;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentException(ex.Message);
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
myConn.Close();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static double GetNextMedicationID()
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
// open connection
|
|
|
|
|
myConn.Open();
|
|
|
|
|
//clear any parameters
|
|
|
|
|
cmdString.Parameters.Clear();
|
|
|
|
|
// command
|
|
|
|
|
cmdString.Connection = myConn;
|
|
|
|
|
cmdString.CommandType = CommandType.StoredProcedure;
|
|
|
|
|
cmdString.CommandTimeout = 1500;
|
|
|
|
|
cmdString.CommandText = "GetNextMedicationID";
|
|
|
|
|
|
|
|
|
|
object result = cmdString.ExecuteScalar();
|
|
|
|
|
double value = 0;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
value = Convert.ToDouble(result);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch(Exception e)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("Error Getting next Patient ID","ERROR",MessageBoxButtons.OK);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2024-02-19 10:47:16 -05:00
|
|
|
|
// return dataSet
|
|
|
|
|
return value;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentException(ex.Message);
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
myConn.Close();
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-02-16 12:41:14 -05:00
|
|
|
|
|
|
|
|
|
public static DataSet RefillSearch(DateTime date, string id)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
// open connection
|
|
|
|
|
myConn.Open();
|
|
|
|
|
//clear any parameters
|
|
|
|
|
cmdString.Parameters.Clear();
|
|
|
|
|
// command
|
|
|
|
|
cmdString.Connection = myConn;
|
|
|
|
|
cmdString.CommandType = CommandType.StoredProcedure;
|
|
|
|
|
cmdString.CommandTimeout = 1500;
|
|
|
|
|
cmdString.CommandText = "SearchRefills";
|
|
|
|
|
// Define input parameter
|
|
|
|
|
cmdString.Parameters.Add("@date", SqlDbType.Date).Value = date;
|
2024-02-17 00:22:25 -05:00
|
|
|
|
cmdString.Parameters.Add("@ID", SqlDbType.VarChar, 10).Value = id;
|
2024-02-16 12:41:14 -05:00
|
|
|
|
// 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();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-16 18:23:41 -05:00
|
|
|
|
public static DataSet RefillSearch(string id)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
// open connection
|
|
|
|
|
myConn.Open();
|
|
|
|
|
//clear any parameters
|
|
|
|
|
cmdString.Parameters.Clear();
|
|
|
|
|
// command
|
|
|
|
|
cmdString.Connection = myConn;
|
|
|
|
|
cmdString.CommandType = CommandType.StoredProcedure;
|
|
|
|
|
cmdString.CommandTimeout = 1500;
|
2024-02-17 00:22:25 -05:00
|
|
|
|
cmdString.CommandText = "SearchRefills2";
|
2024-02-16 18:23:41 -05:00
|
|
|
|
// Define input parameter
|
2024-02-17 00:22:25 -05:00
|
|
|
|
cmdString.Parameters.Add("@ID", SqlDbType.VarChar, 10).Value = id;
|
|
|
|
|
//cmdString.Parameters.Add("@date", SqlDbType.Date).Value = "";
|
2024-02-16 18:23:41 -05:00
|
|
|
|
// 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 static double GetNextRefillID()
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
// open connection
|
|
|
|
|
myConn.Open();
|
|
|
|
|
//clear any parameters
|
|
|
|
|
cmdString.Parameters.Clear();
|
|
|
|
|
// command
|
|
|
|
|
cmdString.Connection = myConn;
|
|
|
|
|
cmdString.CommandType = CommandType.StoredProcedure;
|
|
|
|
|
cmdString.CommandTimeout = 1500;
|
|
|
|
|
cmdString.CommandText = "GetNextRefillID";
|
|
|
|
|
// Define input parameter
|
|
|
|
|
cmdString.Parameters.Add("@TableName", SqlDbType.NVarChar, 128).Value = "Refill";
|
|
|
|
|
|
|
|
|
|
object result = cmdString.ExecuteScalar();
|
|
|
|
|
double value = 0;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
value = Convert.ToDouble(result);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("Error Getting next Refill ID", "ERROR", MessageBoxButtons.OK);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// return dataSet
|
|
|
|
|
return value;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentException(ex.Message);
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
myConn.Close();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-16 18:41:12 -05:00
|
|
|
|
public static void AddRefill(string refillID, DateTime date, string patientID, string medicationID, string rxNum)
|
2024-02-16 18:23:41 -05:00
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
myConn.Open();
|
|
|
|
|
|
|
|
|
|
cmdString.Parameters.Clear();
|
|
|
|
|
|
|
|
|
|
cmdString.Connection = myConn;
|
|
|
|
|
cmdString.CommandType = CommandType.StoredProcedure;
|
|
|
|
|
cmdString.CommandTimeout = 1500;
|
|
|
|
|
|
|
|
|
|
cmdString.CommandText = "AddNewRefill";
|
|
|
|
|
|
|
|
|
|
cmdString.Parameters.Add("@refillID", SqlDbType.Char, 10).Value = refillID;
|
|
|
|
|
cmdString.Parameters.Add("@date", SqlDbType.Date).Value = date;
|
|
|
|
|
cmdString.Parameters.Add("@patientID", SqlDbType.VarChar, 8).Value = patientID;
|
|
|
|
|
cmdString.Parameters.Add("@medicationID", SqlDbType.VarChar, 7).Value = medicationID;
|
|
|
|
|
cmdString.Parameters.Add("@rxNum", SqlDbType.VarChar, 11).Value = rxNum;
|
|
|
|
|
|
2024-02-16 18:41:12 -05:00
|
|
|
|
cmdString.ExecuteNonQuery();
|
2024-02-16 18:23:41 -05:00
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentException(ex.Message);
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
myConn.Close();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-16 18:41:12 -05:00
|
|
|
|
public static void UpdateRefill(string refillID, DateTime date, string patientID, string medicationID, string rxNum)
|
2024-02-16 18:23:41 -05:00
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
myConn.Open();
|
|
|
|
|
|
|
|
|
|
cmdString.Parameters.Clear();
|
|
|
|
|
|
|
|
|
|
cmdString.Connection = myConn;
|
|
|
|
|
cmdString.CommandType = CommandType.StoredProcedure;
|
|
|
|
|
cmdString.CommandTimeout = 1500;
|
|
|
|
|
|
|
|
|
|
cmdString.CommandText = "UpdateRefills";
|
|
|
|
|
|
|
|
|
|
cmdString.Parameters.Add("@refillID", SqlDbType.Char, 10).Value = refillID;
|
|
|
|
|
cmdString.Parameters.Add("@date", SqlDbType.Date).Value = date;
|
|
|
|
|
cmdString.Parameters.Add("@patientID", SqlDbType.VarChar, 8).Value = patientID;
|
|
|
|
|
cmdString.Parameters.Add("@medicationID", SqlDbType.VarChar, 7).Value = medicationID;
|
|
|
|
|
cmdString.Parameters.Add("@rxNum", SqlDbType.VarChar, 11).Value = rxNum;
|
|
|
|
|
|
2024-02-16 18:41:12 -05:00
|
|
|
|
cmdString.ExecuteNonQuery();
|
2024-02-16 18:23:41 -05:00
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentException(ex.Message);
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
myConn.Close();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-19 12:24:56 -05:00
|
|
|
|
public static void DeleteRefill(string Refill_id)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
// open connection
|
|
|
|
|
myConn.Open();
|
|
|
|
|
//clear any parameters
|
|
|
|
|
cmdString.Parameters.Clear();
|
|
|
|
|
// command
|
|
|
|
|
cmdString.Connection = myConn;
|
|
|
|
|
cmdString.CommandType = CommandType.StoredProcedure;
|
|
|
|
|
cmdString.CommandTimeout = 1500;
|
|
|
|
|
cmdString.CommandText = "DeleteRefill";
|
|
|
|
|
// Define input parameter
|
|
|
|
|
cmdString.Parameters.Add("@Refill_id", SqlDbType.Char, 10).Value = Refill_id;
|
|
|
|
|
|
|
|
|
|
cmdString.ExecuteNonQuery();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentException(ex.Message);
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
myConn.Close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-19 21:47:48 -05:00
|
|
|
|
public static void PastRefills(string rxNum)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
myConn.Open();
|
|
|
|
|
|
|
|
|
|
cmdString.Parameters.Clear();
|
|
|
|
|
|
|
|
|
|
cmdString.Connection = myConn;
|
|
|
|
|
cmdString.CommandType = CommandType.StoredProcedure;
|
|
|
|
|
cmdString.CommandTimeout = 1500;
|
|
|
|
|
|
|
|
|
|
cmdString.CommandText = "PastRefills";
|
|
|
|
|
|
|
|
|
|
cmdString.Parameters.Add("@Prescription_id", SqlDbType.VarChar, 11).Value = rxNum;
|
|
|
|
|
|
|
|
|
|
cmdString.ExecuteNonQuery();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentException(ex.Message);
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
myConn.Close();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-14 17:35:35 -05:00
|
|
|
|
}
|
|
|
|
|
}
|