/*Function which takes two parameters * 1) The new lab to be inserted into the database * 2) The name of the patient to assign this lab to * The Pid is located first * Query is then executed to insert new lab and return the Scope_ID of the new lab * The Patient is then associated with the new Lab using connector table Patient_Lab */ public static void AddLab(Lab newLab, string Name) { LabTableAdapter taLabs = new LabTableAdapter(); PatientTableAdapter patientLookUp = new PatientTableAdapter(); int pid = (int)patientLookUp.GetPatientID(Name); int scope_id = Convert.ToInt32(taLabs.AddNewLabReturnScopeID(newLab.Weight, newLab.Doc_id, newLab.Date, newLab.Category, newLab.PatientType, newLab.Amount)); Patient_LabTableAdapter labPatientConnect = new Patient_LabTableAdapter(); labPatientConnect.InsertByPidLabID(pid, scope_id); }
public static void UnassignRoom(int roomNumber, string patientName) { PatientTableAdapter taPatient = new PatientTableAdapter(); int patient_id = (int)taPatient.GetPatientID(patientName); RoomTableAdapter taRoom = new RoomTableAdapter(); taRoom.UpdateRoomStatus("available", roomNumber); int room_id = (int)taRoom.GetRoomID(roomNumber); Patient_RoomTableAdapter taPatientRow = new Patient_RoomTableAdapter(); taPatientRow.UnassignRoom(patient_id, room_id); }
public static void AssignRoom(int roomNumber, string patientName) { PatientTableAdapter taPatient = new PatientTableAdapter(); int patient_id = (int)taPatient.GetPatientID(patientName); RoomTableAdapter taRoom = new RoomTableAdapter(); taRoom.UpdateRoomStatus("occupied", roomNumber); int room_id = (int)taRoom.GetRoomID(roomNumber); Patient_RoomTableAdapter taPatientRoom = new Patient_RoomTableAdapter(); taPatientRoom.InsertRoomByPidScopeID(patient_id, room_id); }
public static void AssignNewBill(Bill newBill, string Name) { PatientTableAdapter taBill = new PatientTableAdapter(); int pid = (int)taBill.GetPatientID(Name); BillTableAdapter taNewBill = new BillTableAdapter(); //Returns the Bill_id so that we may assign it in the Patient_Bill Connector Table. var ScopeID = taNewBill.AddBillReturnScopeID(newBill.PatientType, newBill.MedicineCharge, newBill.DoctorCharge, newBill.RoomCharge, newBill.OperationCharge, newBill.NursingCharge, newBill.LabCharge, newBill.BillTotal, newBill.InsuranceCarrier); //Add row to Patient_Bill table using PID and Bill_id taNewBill.InsertBillByPidScopeID(pid, Convert.ToInt32(ScopeID)); //Add Bill to our Bills list //Bills.Add(newBill); }
public static List <Lab> LabsByPatient(string Name) { PatientTableAdapter taPatient = new PatientTableAdapter(); int pid = Convert.ToInt32(taPatient.GetPatientID(Name)); LabTableAdapter taPatientLab = new LabTableAdapter(); List <Lab> patientLabs = new List <Lab>(); var dtLabs = taPatientLab.GetLabsByPid(pid); foreach (UltimateMedDB.Business.dsUltimateMedDB.LabRow labRow in dtLabs) { Lab currentLab = new Lab { Amount = labRow.Amount, Category = labRow.Category, Date = labRow.Date, Doc_id = labRow.Doc_id, PatientType = labRow.PatientType, Weight = labRow.Weight }; patientLabs.Add(currentLab); } return(patientLabs); }