public PartientOfDay insertPartientOfDay(int PID) { var roomids = db.Rooms.Select(r => r.RoomID); var f = roomids.FirstOrDefault(); var min = new { Key = f, Count = db.PartientOfDays.Where(x => x.RoomID == f).Count() }; foreach (var q in roomids) { var patients = db.PartientOfDays.Where(x => x.RoomID == q).Count(); if (patients < min.Count) { min = new { Key = q, Count = patients } } ; } PartientOfDay pod = new PartientOfDay(); pod.PartientID = PID; pod.RoomID = min.Key; pod.Number = min.Count + 1; pod.Status = false; db.PartientOfDays.InsertOnSubmit(pod); db.SubmitChanges(); return(pod); }
public void updatePartientOfDay(PartientOfDay PartientOfDay) { var record = db.PartientOfDays.Where(x => x.PartientID == PartientOfDay.PartientID).FirstOrDefault(); record.Number = PartientOfDay.Number; record.RoomID = PartientOfDay.RoomID; db.SubmitChanges(); }
public bool updateParient(ePatientOfDay e) { try { PartientOfDay temp = new PartientOfDay(); temp.Number = e.Number; temp.PartientID = e.PatientID; temp.RoomID = e.RoomID; potdal.updatePartientOfDay(temp); return(true); } catch { return(false); } }
public ePatientOfDay insertPatientOfDay(int id) { try { ePatientOfDay temp = new ePatientOfDay(); PartientOfDay e = potdal.insertPartientOfDay(id); temp.Number = e.Number; temp.PatientID = e.PartientID; temp.RoomID = e.RoomID; temp.Room = getOneRoom(e.RoomID).Room; return(temp); } catch { return(null); } }
public List <ePatient> getPatientOfDaysByDoctorID(int DoctorID) { List <ePatient> ls = new List <ePatient>(); foreach (Patient record in potdal.getPatientOfDaysByDoctorID(DoctorID)) { ePatient temp = new ePatient(); temp.Address = record.Address; temp.FirstName = record.FirstName; temp.Gender = Convert.ToBoolean(record.Gender); temp.IdentifyCard = record.IdentifyCard; temp.LastName = record.LastName; temp.MiddleName = record.MiddleName; temp.PatientID = record.PatientID; temp.Phone = record.Phone; PartientOfDay pod = potdal.getOnePartientOfDay(record.PatientID); temp.Status = pod.Status.Value; ls.Add(temp); } return(ls); }
public List <ePatient> getAllPatient() { List <ePatient> ls = new List <ePatient>(); foreach (Patient record in patientdal.getAllPatient()) { ePatient temp = new ePatient(); temp.Address = record.Address; temp.FirstName = record.FirstName; temp.Gender = Convert.ToBoolean(record.Gender); temp.IdentifyCard = record.IdentifyCard; temp.LastName = record.LastName; temp.MiddleName = record.MiddleName; temp.PatientID = record.PatientID; temp.Phone = record.Phone; PartientOfDay pod = potdal.getOnePartientOfDay(temp.PatientID); temp.Number = pod == null ? 0 : pod.Number; temp.Room = pod == null ? "" : roomdal.getOneRoom(pod.RoomID).Room1; ls.Add(temp); } return(ls); }
public int insertExaminationResult(eExaminationResult e) { try { ExaminationResult temp = new ExaminationResult(); temp.Description = e.Description; temp.DispenserID = null; temp.DoctorID = e.DoctorID; temp.PatientID = e.PatientID; temp.Time = DateTime.Now; temp.Result = e.Result; int id = erdal.insertExaminationResult(temp); PartientOfDay pod = new PartientOfDay(); pod.PartientID = temp.PatientID; pod.Status = true; potdal.updatePartientOfDay(pod); return(id); } catch { return(0); } }