コード例 #1
0
ファイル: FacilityOffering.cs プロジェクト: ankit-defacto/PSS
 public DC.FacilityOffering GetFacilityOfferingByFacilityGuidOfferingGuid(Guid facilityGuid, Guid offeringGuid)
 {
     try
     {
         BL.FacilityOfferingLogic facilityOfferingLogic = new BL.FacilityOfferingLogic();
         BE.FacilityOffering entity = facilityOfferingLogic.GetFacilityOfferingByFacilityGuidOfferingGuid(facilityGuid, offeringGuid);
         DC.FacilityOffering response = entity.ToDataContract();
         return response;
     }
     catch (BE.FacilityOfferingNotFoundException ex)
     {
         FC.FacilityOfferingFault fault = new FC.FacilityOfferingFault();
         fault.FacilityGuid = ex.FacilityGuid;
         fault.OfferingGuid = ex.OfferingGuid;
         fault.ErrorMessage = "FacilityOffering does not exsist in the database.";
         throw new FaultException<FC.FacilityOfferingFault>(fault,
             new FaultReason(ex.Message));
     }
     catch (Exception ex)
     {
         FC.FacilityOfferingFault fault = new FC.FacilityOfferingFault();
         fault.ErrorMessage = "Could not retrieve a specific FacilityOffering for unknown reasons.";
         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));
                }
            });
        }