Changeset a55ef91 for FarmatikoServices/Services
- Timestamp:
- 07/31/20 10:15:02 (4 years ago)
- Branches:
- master
- Children:
- d8fafb8
- Parents:
- 4e72684
- Location:
- FarmatikoServices/Services
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
FarmatikoServices/Services/HealthFacilityService.cs
r4e72684 ra55ef91 2 2 using FarmatikoData.FarmatikoRepoInterfaces; 3 3 using FarmatikoData.Models; 4 using System .Collections.Generic;4 using System; 5 5 using System.Linq; 6 6 … … 18 18 public void Add(HealthFacilities healthFacility) 19 19 { 20 _healthFacilityRepository.Add(healthFacility); 20 try 21 { 22 if (healthFacility != null) 23 _healthFacilityRepository.Add(healthFacility); 24 } 25 catch (Exception e) 26 { 27 e = new Exception("Can't Add health facility is null"); 28 throw e; 29 } 21 30 } 22 31 23 public I Enumerable<HealthFacilities> GetAll()32 public IQueryable<HealthFacilities> GetAll() 24 33 { 25 34 return _healthFacilityRepository.GetAll(); 26 35 } 36 37 public void Remove(HealthFacilities healthFacility) 38 { 39 try 40 { 41 if (healthFacility != null) 42 _healthFacilityRepository.Remove(healthFacility); 43 } 44 catch(Exception e) 45 { 46 e = new Exception("Can't Remove health facility is null"); 47 throw e; 48 } 49 } 27 50 } 28 51 } -
FarmatikoServices/Services/HealthcareWorkerService.cs
r4e72684 ra55ef91 1 using FarmatikoData.FarmatikoRepo; 2 using FarmatikoData.FarmatikoRepoInterfaces; 1 using FarmatikoData.FarmatikoRepoInterfaces; 3 2 using FarmatikoData.Models; 4 3 using FarmatikoServices.FarmatikoServiceInterfaces; 5 4 using System; 6 using System.Collections.Generic; 7 using System.Text; 5 using System.Linq; 8 6 9 7 namespace FarmatikoServices.Services … … 18 16 public void Add(HealthcareWorkers healthcareWorker) 19 17 { 20 _healthcareWorkerRepo.Add(healthcareWorker); 18 try 19 { 20 if (healthcareWorker != null) 21 _healthcareWorkerRepo.Add(healthcareWorker); 22 } 23 catch (Exception e) 24 { 25 e = new Exception("Can't Add healthcare worker is null"); 26 throw e; 27 } 21 28 } 22 29 23 public I Enumerable<HealthcareWorkers> GetAll()30 public IQueryable<HealthcareWorkers> GetAll() 24 31 { 25 32 return _healthcareWorkerRepo.GetAll(); 26 33 } 34 35 public void Remove(HealthcareWorkers healthcareWorker) 36 { 37 try 38 { 39 if (healthcareWorker != null) 40 _healthcareWorkerRepo.Remove(healthcareWorker); 41 } 42 catch (Exception e) 43 { 44 e = new Exception("Can't Remove healthcare worker is null"); 45 throw e; 46 } 47 } 27 48 } 28 49 } -
FarmatikoServices/Services/MedicineListService.cs
r4e72684 ra55ef91 2 2 using FarmatikoData.Models; 3 3 using FarmatikoServices.FarmatikoServiceInterfaces; 4 using System; 4 5 using System.Collections.Generic; 6 using System.Linq; 5 7 6 8 namespace FarmatikoServices.Services … … 14 16 } 15 17 16 public IEnumerable<MedicineList> GetAll() 18 public void Add(MedicineList medicineList) 19 { 20 try 21 { 22 if (medicineList != null) 23 _medicineListRepository.Add(medicineList); 24 } 25 catch (Exception e) 26 { 27 e = new Exception("Can't add the medicine list is null."); 28 throw e; 29 } 30 } 31 32 public IQueryable<MedicineList> GetAll() 17 33 { 18 34 return _medicineListRepository.GetAll(); … … 21 37 public ICollection<MedicineList> GetByManufacturer(string Manufacturer) 22 38 { 23 return _medicineListRepository.GetByManufacturer(Manufacturer); 39 try 40 { 41 if (Manufacturer != null) 42 { 43 44 return _medicineListRepository.GetByManufacturer(Manufacturer); 45 } 46 } 47 catch (Exception e) 48 { 49 e = new Exception("Can't get name of manufacturer is null"); 50 throw e; 51 } 52 return null; 24 53 } 25 54 26 55 public ICollection<MedicineList> GetByName(string Name) 27 56 { 28 if(Name != null)57 try 29 58 { 30 return _medicineListRepository.GetByName(Name); 59 if (Name != null) 60 { 61 return _medicineListRepository.GetByName(Name); 62 } 63 } 64 catch (Exception e) 65 { 66 e = new Exception("Can't get name is null"); 67 throw e; 31 68 } 32 69 return null; 33 70 } 34 71 35 public bool SetHasMedicine(MedicineList medicineList, bool HasMedicine)72 public void Remove(MedicineList medicineList) 36 73 { 37 if (medicineList != null)74 try 38 75 { 39 _medicineListRepository.SetHasMedicine(medicineList, HasMedicine);40 return true;76 if (medicineList != null) 77 _medicineListRepository.Remove(medicineList); 41 78 } 42 else return false; 79 catch (Exception e) 80 { 81 e = new Exception("Can't remove the medicine list is null."); 82 throw e; 83 } 43 84 } 44 85 } -
FarmatikoServices/Services/MedicineService.cs
r4e72684 ra55ef91 2 2 using FarmatikoData.Models; 3 3 using FarmatikoServices.FarmatikoServiceInterfaces; 4 using System; 4 5 using System.Collections.Generic; 6 using System.Linq; 5 7 6 8 namespace FarmatikoServices.Services … … 16 18 public void Add(Medicine medicine) 17 19 { 18 _medicineRepository.Add(medicine); 20 try 21 { 22 if (medicine != null) 23 _medicineRepository.Add(medicine); 24 } 25 catch (Exception e) 26 { 27 e = new Exception("Can't Add medicine is null"); 28 throw e; 29 } 19 30 } 20 31 21 public I Enumerable<Medicine> GetAll()32 public IQueryable<Medicine> GetAll() 22 33 { 23 34 return _medicineRepository.GetAll(); 24 35 } 25 36 26 public I Enumerable<Medicine> GetByManufacturer(string Manufacturer)37 public IQueryable<Medicine> GetByManufacturer(string Manufacturer) 27 38 { 28 return _medicineRepository.GetByManufacturer(Manufacturer); 39 try 40 { 41 if (Manufacturer != null) 42 return _medicineRepository.GetByManufacturer(Manufacturer); 43 } 44 catch (Exception e) 45 { 46 e = new Exception("Can't get, name of manufacturer is null"); 47 throw e; 48 } 49 50 return null; 29 51 } 30 52 31 public I Enumerable<Medicine> GetByName(string Name)53 public IQueryable<Medicine> GetByName(string Name) 32 54 { 33 return _medicineRepository.GetByName(Name); 55 try 56 { 57 if (Name != null) 58 return _medicineRepository.GetByName(Name); 59 } 60 catch (Exception e) 61 { 62 e = new Exception("Can't get, name is null"); 63 } 64 65 return null; 34 66 } 35 67 36 68 public void Remove(string Medicine) 37 69 { 38 _medicineRepository.Remove(Medicine); 70 try 71 { 72 if (Medicine != null) 73 _medicineRepository.Remove(Medicine); 74 } 75 catch (Exception e) 76 { 77 e = new Exception("Can't Add medicine is null"); 78 throw e; 79 } 39 80 } 40 81 } -
FarmatikoServices/Services/PandemicService.cs
r4e72684 ra55ef91 3 3 using FarmatikoServices.FarmatikoServiceInterfaces; 4 4 using System; 5 using System. Collections.Generic;5 using System.Linq; 6 6 7 7 namespace FarmatikoServices.Services … … 17 17 public void Add(Pandemic pandemic) 18 18 { 19 _pandemicRepository.Add(pandemic); 19 try 20 { 21 if (pandemic != null) 22 { 23 _pandemicRepository.Add(pandemic); 24 } 25 } 26 catch (Exception e) 27 { 28 e = new Exception("Can't add pandemic is null."); 29 throw e; 30 } 20 31 } 21 32 22 public I Enumerable<Pandemic> GetAll()33 public IQueryable<Pandemic> GetAll() 23 34 { 24 35 return _pandemicRepository.GetAll(); … … 27 38 public void Remove(Pandemic pandemic) 28 39 { 29 _pandemicRepository.Remove(pandemic); 40 try 41 { 42 if (pandemic != null) 43 _pandemicRepository.Remove(pandemic); 44 } 45 catch (Exception e) 46 { 47 e = new Exception("Can't remove, pandemic is null."); 48 } 30 49 } 31 50 } -
FarmatikoServices/Services/PharmacyHeadService.cs
r4e72684 ra55ef91 3 3 using FarmatikoServices.FarmatikoServiceInterfaces; 4 4 using System; 5 using System.Collections.Generic;6 5 using System.Linq; 7 using System.Text;8 6 9 7 namespace FarmatikoServices.Services … … 19 17 public void Add(PharmacyHead pharmacyHead) 20 18 { 21 if (pharmacyHead != null)19 try 22 20 { 23 _pharmacyHeadRepository.Add(pharmacyHead); 21 if (pharmacyHead != null) 22 { 23 _pharmacyHeadRepository.Add(pharmacyHead); 24 } 24 25 } 26 catch (Exception e) 27 { 28 e = new Exception("Can't add, pharmacy head is null."); 29 } 30 25 31 } 26 32 27 33 public IQueryable<PharmacyHead> GetAllPharmacies(string NameOfPharmacyHead) 28 34 { 29 if (NameOfPharmacyHead != null)35 if (NameOfPharmacyHead != null) 30 36 { 31 37 IQueryable<PharmacyHead> Pharmacy = _pharmacyHeadRepository.GetAllPharmacies(NameOfPharmacyHead); 32 38 if (Pharmacy != null) 33 {34 39 return Pharmacy; 35 }36 40 } 37 41 return null; … … 40 44 public IQueryable<PharmacyHead> GetPharmacyByName(string Name) 41 45 { 42 if (Name != null)46 if (Name != null) 43 47 { 44 48 IQueryable<PharmacyHead> PharmacyHead = _pharmacyHeadRepository.GetPharmacyByName(Name); … … 51 55 public IQueryable<MedicineList> GetPharmacyMedicines(string NameOfPharmacy) 52 56 { 53 if (NameOfPharmacy != null)57 if (NameOfPharmacy != null) 54 58 { 55 59 IQueryable<MedicineList> Medicines = _pharmacyHeadRepository.GetPharmacyMedicines(NameOfPharmacy); … … 62 66 public void Remove(PharmacyHead pharmacyHead, string Name) 63 67 { 64 if (pharmacyHead != null && Name != null)68 try 65 69 { 66 _pharmacyHeadRepository.Remove(pharmacyHead, Name); 70 if (Name != null) 71 { 72 _pharmacyHeadRepository.Remove(pharmacyHead, Name); 73 } 67 74 } 75 catch (Exception e) 76 { 77 e = new Exception("Can't remove, name of pharmacy head is null."); 78 } 79 68 80 } 69 81 } -
FarmatikoServices/Services/PharmacyService.cs
r4e72684 ra55ef91 2 2 using FarmatikoData.Models; 3 3 using FarmatikoServices.FarmatikoServiceInterfaces; 4 using System; 4 5 using System.Collections.Generic; 6 using System.Linq; 5 7 6 8 namespace FarmatikoServices.Services … … 15 17 public void Add(Pharmacy pharmacy) 16 18 { 17 if(pharmacy != null)19 try 18 20 { 19 _pharmacyRepository.Add(pharmacy); 21 if (pharmacy != null) 22 { 23 _pharmacyRepository.Add(pharmacy); 24 } 20 25 } 26 catch (Exception e) 27 { 28 e = new Exception("Can't add, pharmacy has null value."); 29 throw e; 30 } 31 21 32 } 22 33 23 public I Enumerable<Pharmacy> GetAll()34 public IQueryable<Pharmacy> GetAll() 24 35 { 25 36 return _pharmacyRepository.GetAll(); … … 33 44 public void Remove(Pharmacy pharmacy) 34 45 { 35 _pharmacyRepository.Remove(pharmacy); 46 try 47 { 48 if (pharmacy != null) 49 _pharmacyRepository.Remove(pharmacy); 50 } 51 catch (Exception e) 52 { 53 e = new Exception("Can't remove, pharmacy has null value."); 54 throw e; 55 } 36 56 } 37 57 38 58 public void UpdatePharmacy(Pharmacy pharmacy, string Name) 39 59 { 40 if(pharmacy != null && Name != null)60 try 41 61 { 42 _pharmacyRepository.UpdatePharmacy(pharmacy, Name); 62 if (pharmacy != null && Name != null) 63 { 64 _pharmacyRepository.UpdatePharmacy(pharmacy, Name); 65 } 43 66 } 67 catch (Exception e) 68 { 69 e = new Exception("Can not update pharmacy, has null value."); 70 throw e; 71 } 72 44 73 } 45 74 }
Note:
See TracChangeset
for help on using the changeset viewer.