Esempio n. 1
0
 public void InsertRequest(string p_id, Request r)
 {
     if (r is Prescription)
     {
         PrescriptionMapper pm = new PrescriptionMapper();
         pm.InsertRequest(p_id, r);
     }
     else if (r is ExaminationRequest)
     {
         ExaminationRequestMapper erm = new ExaminationRequestMapper();
         erm.InsertRequest(p_id, r);
     }
     else if (r is SampleRequest)
     {
         SampleRequestMapper srm = new SampleRequestMapper();
         srm.InsertRequest(p_id, r);
     }
     else
     {
         throw new ApplicationException(ErrorMessages.Messages["REQ_type"]);
     }
 }
Esempio n. 2
0
 public IList<Request> SelectRequests(string p_id, string type = null)
 {
     switch (type)
     {
         case null:
             List<Request> pres = new PrescriptionMapper().SelectRequests(p_id);
             List<Request> exams = new ExaminationRequestMapper().SelectRequests(p_id);
             List<Request> samples = new SampleRequestMapper().SelectRequests(p_id);
             List<Request> all = new List<Request>();
             all.AddRange(pres);
             all.AddRange(exams);
             all.AddRange(samples);
             return all;
         case "prescription":
             return new PrescriptionMapper().SelectRequests(p_id);
         case "samplerequest":
             return new SampleRequestMapper().SelectRequests(p_id);
         case "examinationrequest":
             return new ExaminationRequestMapper().SelectRequests(p_id);
         default:
             throw new ApplicationException(ErrorMessages.Messages["REQ_type"]);
     }
 }