public PatientDirInfo() { patientID = (id++).ToString(); fName = "Thomas"; mName = "Brandon"; lName = "Kibler"; gender = true; DOB = new DateTime(1976,9,12); strAddress = "314 Cumberland Drive"; city = "Huntsville"; state = "Alabama"; zip = "35803"; phoneNum1 = "2569199468"; phoneNum2 = ""; visitors = new List<Visitor>(); location = new HospLocation(); emerContact1 = new EmerContact(); emerContact2 = new EmerContact(); //emerContact1.name = ""; //emerContact1.phoneNum = ""; //emerContact2.name = ""; //emerContact2.phoneNum = ""; }
public PatientDirInfo() { visitors = new List<Visitor>(); location = new HospLocation(); emerContact1 = new EmerContact(); emerContact2 = new EmerContact(); }
public PatientDirInfo() { visitors = new List <Visitor>(); location = new HospLocation(); emerContact1 = new EmerContact(); emerContact2 = new EmerContact(); }
public PatientDirInfo() { patientID = (id++).ToString(); fName = "Thomas"; mName = "Brandon"; lName = "Kibler"; gender = true; DOB = new DateTime(1976, 9, 12); strAddress = "314 Cumberland Drive"; city = "Huntsville"; state = "Alabama"; zip = "35803"; phoneNum1 = "2569199468"; phoneNum2 = ""; visitors = new List <Visitor>(); location = new HospLocation(); emerContact1 = new EmerContact(); emerContact2 = new EmerContact(); //emerContact1.name = ""; //emerContact1.phoneNum = ""; //emerContact2.name = ""; //emerContact2.phoneNum = ""; }
/* *This function gets the max value of the key from the relevant tables *and sets the value of the above indexes to those values. */ public static void initValues() { string staffList = "SELECT max(Cast(staffID as int)) from Staff"; SqlCommand staffCmd = new SqlCommand(staffList, cnn); cnn.Open(); try { staffIndex = (int)staffCmd.ExecuteScalar(); } catch { staffIndex = 9999; } string drugList = " SELECT * from drugs"; SqlCommand cmd = new SqlCommand(drugList, cnn); SqlDataReader datardr = cmd.ExecuteReader(); while (datardr.Read()) { PIMS.Controller.Drug d = new PIMS.Controller.Drug(); d.name = datardr.GetValue(0).ToString(); d.cost = (int)datardr.GetValue(1); PIMS.Program.drugs.Add(d); } datardr.Close(); string locList = " SELECT * from location"; cmd = new SqlCommand(locList, cnn); datardr = cmd.ExecuteReader(); while (datardr.Read()) { HospLocation loc = new HospLocation(); loc.bedNum = Convert.ToInt32(datardr.GetValue(0).ToString()); loc.unit = datardr.GetValue(1).ToString(); loc.floor = Convert.ToInt32(datardr.GetValue(2).ToString()); loc.roomNum = Convert.ToInt32(datardr.GetValue(3).ToString()); loc.occupancy = (int)datardr.GetValue(4); PIMS.Program.locations.Add(loc); Console.WriteLine(loc.unit); } datardr.Close(); ////try ////{ string genericStr = "select max(idNum) from "; string statsStr = genericStr + "patientStats"; cmd = new SqlCommand(statsStr, cnn); try { statsIndex = (int)cmd.ExecuteScalar(); } catch (Exception ex) { statsIndex = 9999; } string idString = "Select max(patientID) from patient"; cmd = new SqlCommand(idString, cnn); try { patientIndex = (int)cmd.ExecuteScalar(); } catch (Exception ex) { patientIndex = 9999; } string billStr = genericStr + "charges"; cmd = new SqlCommand(billStr, cnn); try { billIndex = (int)cmd.ExecuteScalar(); } catch (Exception ex) { billIndex = 9999; } string drugStr = "Select max(drugID) from prescriptions"; cmd = new SqlCommand(drugStr, cnn); try { drugIndex = (int)cmd.ExecuteScalar(); } catch (Exception ex) { drugIndex = 9999; } string procStr = genericStr + "ScheduledProcedures"; cmd = new SqlCommand(procStr, cnn); procIndex = (int)cmd.ExecuteScalar(); try { procIndex = (int)cmd.ExecuteScalar(); } catch (Exception ex) { procIndex = 9999; } // cnn.Close(); // MessageBox.Show("statIndex= " + statsIndex + "\ndrugIndex = " + drugIndex + "\nprocIndex = " + procIndex + "\nbillIndex = " + billIndex + "\npatIndex = " + patientIndex); //} //catch (Exception ex) //{ // MessageBox.Show("Cannot connect to Database.\nPlease try again"); // System.Environment.Exit(0); //} }
/* Takes int bedid for the bed number being queried for * create a room object to return */ public static HospLocation buildHospital(int bedID) { if (cnn != null && cnn.State == System.Data.ConnectionState.Open) cnn.Close(); cnn.Open(); SqlCommand cmd = new SqlCommand("getLocations", cnn); SqlDataReader rdr; cmd.CommandType = System.Data.CommandType.StoredProcedure; HospLocation current = new HospLocation(); current.bedNum = bedID; cmd.Parameters.AddWithValue("@bedNum", bedID); //Create a SqlParameter object to hold the output parameter value SqlParameter units = new SqlParameter(); units.ParameterName = "@unit"; units.SqlDbType = System.Data.SqlDbType.VarChar; units.Size = 15; units.Direction = System.Data.ParameterDirection.Output; units.Value = current.unit; cmd.Parameters.Add(units); SqlParameter floorN = new SqlParameter(); floorN.ParameterName = "@floorNum"; floorN.SqlDbType = System.Data.SqlDbType.Int; floorN.Direction = System.Data.ParameterDirection.Output; floorN.Value = current.floor; cmd.Parameters.Add(floorN); SqlParameter roomN = new SqlParameter(); roomN.ParameterName = "@roomNum"; roomN.SqlDbType = System.Data.SqlDbType.Int; roomN.Direction = System.Data.ParameterDirection.Output; roomN.Value = current.roomNum; cmd.Parameters.Add(roomN); SqlParameter occup = new SqlParameter(); occup.ParameterName = "@occupants"; occup.SqlDbType = System.Data.SqlDbType.Int; occup.Direction = System.Data.ParameterDirection.Output; occup.Value = current.occupancy; cmd.Parameters.Add(occup); rdr = cmd.ExecuteReader(); current.unit = Convert.ToString(units.Value); current.floor = Convert.ToInt32(floorN.Value); current.roomNum = Convert.ToInt32(roomN.Value); current.occupancy = Convert.ToInt32(occup.Value); cmd.Parameters.Clear(); rdr.Close(); cnn.Close(); return current; }