コード例 #1
0
        public static int UpdateFacility(FacilityViewModel facility)
        {
            try
            {
                // Convert the view model object to a service proxy object.
                SP.FacilitySvc.Facility request = facility.ToModel();

                // Call the service update method.
                _facilityClient.UpdateFacility(request);

                return 1;
            }
            catch (System.ServiceModel.FaultException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #2
0
        public static int InsertFacility(FacilityViewModel facility)
        {
            if (null == facility)
            {
                throw new Exception("Cannot insert Facility. The facility object was null. Cannot be empty.");
            }

            try
            {
                // Convert the view model object to a service proxy object.
                SP.FacilitySvc.Facility request = facility.ToModel();

                // Call the service insert method.
                _facilityClient.InsertFacility(request);

                return 1;
            }
            catch (System.ServiceModel.FaultException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #3
0
 public static FacilityCollection GetFacilitiesForListingTypeByListingTypeGuid(Guid listingTypeGuid)
 {
     SP.FacilitySvc.Facility[] facilities = _facilityClient.GetFacilitiesForListingTypeByListingTypeGuid(listingTypeGuid);
     FacilityCollection result = new FacilityCollection();
     foreach (SP.FacilitySvc.Facility facility
         in facilities)
     {
         FacilityViewModel viewModel = new FacilityViewModel(facility.FacilityGuid, facility.FacilityID, facility.FacilityName, facility.Exerpt, facility.Description, facility.Address, facility.CityStateZipGuid, facility.PhoneNumber, facility.Email, facility.Website, facility.ClientGuid, facility.ListingTypeGuid, facility.PublicPhotoFileUri);
         result.Add(viewModel);
     }
     return result;
 }
コード例 #4
0
 public void RemoveFacility(FacilityViewModel facility)
 {
     _facilityVMs.Remove(facility);
 }
コード例 #5
0
 public void AddFacility(FacilityViewModel facility)
 {
     _facilityVMs.Add(facility);
 }
コード例 #6
0
ファイル: ClientAssembler.cs プロジェクト: ankit-defacto/PSS
        /// <summary>
        /// Converts a Facility service proxy object to a WebClient object.
        /// </summary>
        /// <param name="facility">Facility service proxy</param>
        /// <returns>Facility WebClient object to be used in the UI.</returns>
        public static VM.FacilityViewModel ToViewModel(this SP.FacilitySvc.Facility facility)
        {
            VM.FacilityViewModel result = new VM.FacilityViewModel()
            {
                FacilityGuid = facility.FacilityGuid,
                FacilityID = facility.FacilityID,
                FacilityName = facility.FacilityName,
                Exerpt = facility.Exerpt,
                Description = facility.Description,
                Address = facility.Address,
                CityStateZipGuid = facility.CityStateZipGuid,
                PhoneNumber = facility.PhoneNumber,
                Email = facility.Email,
                Website = facility.Website,
                ClientGuid = facility.ClientGuid,
                ListingTypeGuid = facility.ListingTypeGuid,
                PublicPhotoFileUri = facility.PublicPhotoFileUri,
            };

            return result;
        }