public static int DeleteFacilityAudit(FacilityAuditViewModel facilityAudit)
        {
            try
            {
                // Convert the view model object to a service proxy object.
                SP.FacilityAuditSvc.FacilityAudit request = facilityAudit.ToModel();

                // Call the service delete method.
                _facilityAuditClient.DeleteFacilityAudit(request);

                return 1;
            }
            catch (System.ServiceModel.FaultException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#2
0
        /// <summary>
        /// Converts a FacilityAudit service proxy object to a WebClient object.
        /// </summary>
        /// <param name="facilityAudit">FacilityAudit service proxy</param>
        /// <returns>FacilityAudit WebClient object to be used in the UI.</returns>
        public static VM.FacilityAuditViewModel ToViewModel(this SP.FacilityAuditSvc.FacilityAudit facilityAudit)
        {
            VM.FacilityAuditViewModel result = new VM.FacilityAuditViewModel()
            {
                FacilityAuditGuid = facilityAudit.FacilityAuditGuid,
                FacilityGuid = facilityAudit.FacilityGuid,
                FacilityID = facilityAudit.FacilityID,
                FacilityName = facilityAudit.FacilityName,
                Exerpt = facilityAudit.Exerpt,
                Description = facilityAudit.Description,
                Address = facilityAudit.Address,
                CityStateZipGuid = facilityAudit.CityStateZipGuid,
                PhoneNumber = facilityAudit.PhoneNumber,
                Email = facilityAudit.Email,
                Website = facilityAudit.Website,
                ClientGuid = facilityAudit.ClientGuid,
                ListingTypeGuid = facilityAudit.ListingTypeGuid,
                PublicPhotoFileUri = facilityAudit.PublicPhotoFileUri,
                DateModified = facilityAudit.DateModified,
            };

            return result;
        }
 public void RemoveFacilityAudit(FacilityAuditViewModel facilityAudit)
 {
     _facilityAuditVMs.Remove(facilityAudit);
 }
 public void AddFacilityAudit(FacilityAuditViewModel facilityAudit)
 {
     _facilityAuditVMs.Add(facilityAudit);
 }
        public static int InsertFacilityAudit(FacilityAuditViewModel facilityAudit)
        {
            if (null == facilityAudit)
            {
                throw new Exception("Cannot insert FacilityAudit. The facilityAudit object was null. Cannot be empty.");
            }

            try
            {
                // Convert the view model object to a service proxy object.
                SP.FacilityAuditSvc.FacilityAudit request = facilityAudit.ToModel();

                // Call the service insert method.
                _facilityAuditClient.InsertFacilityAudit(request);

                return 1;
            }
            catch (System.ServiceModel.FaultException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 public static FacilityAuditCollection GetFacilityAuditsForListingTypeByListingTypeGuid(Guid listingTypeGuid)
 {
     SP.FacilityAuditSvc.FacilityAudit[] facilityAudits = _facilityAuditClient.GetFacilityAuditsForListingTypeByListingTypeGuid(listingTypeGuid);
     FacilityAuditCollection result = new FacilityAuditCollection();
     foreach (SP.FacilityAuditSvc.FacilityAudit facilityAudit
         in facilityAudits)
     {
         FacilityAuditViewModel viewModel = new FacilityAuditViewModel(facilityAudit.FacilityAuditGuid, facilityAudit.FacilityGuid, facilityAudit.FacilityID, facilityAudit.FacilityName, facilityAudit.Exerpt, facilityAudit.Description, facilityAudit.Address, facilityAudit.CityStateZipGuid, facilityAudit.PhoneNumber, facilityAudit.Email, facilityAudit.Website, facilityAudit.ClientGuid, facilityAudit.ListingTypeGuid, facilityAudit.PublicPhotoFileUri, facilityAudit.DateModified);
         result.Add(viewModel);
     }
     return result;
 }