Пример #1
0
 public void AddOfferingToFacility(Guid facilityGuid, Guid offeringGuid, bool isChecked)
 {
     try
     {
         BE.FacilityOffering joinRowToAdd = new BE.FacilityOffering(facilityGuid, offeringGuid, isChecked);
         BL.FacilityOfferingLogic joinLogic = new BL.FacilityOfferingLogic();
         joinLogic.InsertFacilityOffering(joinRowToAdd);
     }
     catch (Exception ex)
     {
         FC.FacilityOfferingFault fault = new FC.FacilityOfferingFault();
         fault.FacilityGuid = facilityGuid;
         fault.OfferingGuid = offeringGuid;
         fault.ErrorMessage = String.Format("Unable to insert offering '{0}' into facility '{1}'.",
             offeringGuid, facilityGuid);
         throw new FaultException<FC.FacilityOfferingFault>(fault,
             new FaultReason(ex.Message));
     }
 }
Пример #2
0
        private void SaveTypesOfCare(ListingViewModelEdit listing)
        {
            FacilityOfferingLogic fologic = new FacilityOfferingLogic();
            // offerings (types of care) processing
            listing.TypeOfCareList.ToList().ForEach(tc =>
            {
                var exists = fologic.GetFacilityOfferingByFacilityGuidOfferingGuid(listing.FacilityGuid, tc.TypeOfCareGuid);
                // checked but not present in database
                if (tc.Checked && exists == null)
                {
                    fologic.InsertFacilityOffering(tc.ToFacilityOffering(listing.FacilityGuid));
                }

                // not checked but present in database
                if (!tc.Checked && exists != null)
                {
                    fologic.DeleteFacilityOffering(tc.ToFacilityOffering(listing.FacilityGuid));
                }
            });
        }
Пример #3
0
 public void InsertFacilityOffering(DC.FacilityOffering request)
 {
     try
     {
         BL.FacilityOfferingLogic facilityOfferingLogic = new BL.FacilityOfferingLogic();
         BE.FacilityOffering entity = request.ToBusinessEntity();
         facilityOfferingLogic.InsertFacilityOffering(entity);
     }
     catch (BE.FacilityOfferingAlreadyExistsException ex)
     {
         FC.DefaultFaultContract fault = new FC.DefaultFaultContract();
         fault.ErrorMessage = String.Format("Unable to insert FacilityOffering data for FacilityGuid '{0}' and OfferingGuid '{1}'.",
             request.FacilityGuid.ToString(), request.OfferingGuid.ToString());
         throw new FaultException<FC.DefaultFaultContract>(fault,
             new FaultReason(ex.Message));
     }
 }