public object RemoveBed(int bedId, string dbPath) { //string tempIcuId=" "; //try //{ // foreach (Models.BedModel bedTemp in _occupancy.BedList.ToList()) // { // if (bedTemp.BedId == bedId) // { // tempIcuId = bedTemp.IcuId; // _occupancy.BedList.Remove(bedTemp); // } // } // _updateIcu.UpdateIcuAfterBedRemoval(tempIcuId); // return "bed removed"; //} //catch(Exception e) //{ // Console.WriteLine(e); // return "unable to remove"; //} var bedObj = new BedDbOps(dbPath); return(bedObj.DeleteBedFromDb(bedId)); }
public void AddBedToWrongDb() { var bedObj = new BedDbOps(@"C:\\"); var result = bedObj.AddBedToDb(new BedModel()); Assert.Equal(HttpStatusCode.InternalServerError, result); }
public object DischargePatient(string pid, string dbPath) { var bedId = GetBedIdFromPid(pid, dbPath); var patientDbObj = new PatientDbOps(dbPath); if (!patientDbObj.DeletePatientFromDatabase(pid).Equals(HttpStatusCode.OK)) { return(HttpStatusCode.InternalServerError); } var bedStatusObj = new BedDbOps(dbPath); return(bedStatusObj.ChangeBedStatusToVacant(bedId.ElementAt(0))); //if (PatientList.ContainsKey(pid)) //{ // PatientList.Remove(pid); // return "Discharged"; //} //else //{ //} //foreach (var patientTemp in PatientList.ToList().Where(patientTemp => patientTemp.Key == pid)) //{ // PatientList.Remove(patientTemp.Key); // return "Patient Discharged"; //} //return "Patient Not Found"; }
//return bool public object AddNewBedConfiguration(BedModel newBed, string dbPath) { //_occupancy.BedList.Add(newBed.BedId, newBed); //return "Bed Added Successfully"; var bedDbObj = new BedDbOps(dbPath); return(bedDbObj.AddBedToDb(newBed)); }
public void WhenBedStatusIsChangedToVacantOnWrongDbReturnError() { var dbObj = new BedDbOps(@"C:\\"); var result = dbObj.ChangeBedStatusToVacant(10); const HttpStatusCode expected = HttpStatusCode.InternalServerError; Assert.Equal(expected, result); }
//public static object AddNewBed(BedModel newBed) //{ // var filePath = DbOps.GetDbPath(); // var obj = new BedDbOps(filePath); // return obj.AddBedToDb(newBed); // //BedList.Add(newBed.BedId, newBed); //} //public List<PatientVital> Display() //{ // //return PatientVitalList; //} public bool IsBedFree(int bedId, string dbPath) { var bedStatusObj = new BedDbOps(dbPath); return(bedStatusObj.IsBedFree(bedId)); //foreach (var bedTemp in BedList.Where(bedTemp => bedTemp.Key == bedId)) //{ // return bedTemp.Value.BedStatus; //} //return "Does Not Exist"; }
//public OccupancyService GetInstanceOfOccupancyService() //{ // return this; //} //public OccupancyService() //{ // //InitPatientList(); // //InitIcuList(); // //InitBedList(); // //InitBedLayouts(); //} //public Dictionary<string, PatientModel> PatientList; //will get data from class having accessing db //public Dictionary<int, BedModel> BedList; //public Dictionary<string, IcuModel> IcuList; ////public List<PatientVital> PatientVitalList; //public List<string> BedLayouts; public object AddNewPatient(PatientModel newPatient, string dbPath) { var dbObj = new PatientDbOps(dbPath); if (!dbObj.AddPatientToDb(newPatient).Equals(HttpStatusCode.OK)) { return(HttpStatusCode.InternalServerError); } var bedStatusDbObj = new BedDbOps(dbPath); return(bedStatusDbObj.ChangeBedStatusToOccupied(newPatient.BedId)); }
public Dictionary <int, BedModel> GetBedDetails(string dbPath) { var bedsObj = new BedDbOps(dbPath); return(bedsObj.GetAllBedsFromDb()); }