Esempio n. 1
0
        public static int DeleteClient(ClientViewModel client)
        {
            try
            {
                // Convert the view model object to a service proxy object.
                SP.ClientSvc.Client request = client.ToModel();

                // Call the service delete method.
                _clientClient.DeleteClient(request);

                return 1;
            }
            catch (System.ServiceModel.FaultException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Converts a Client service proxy object to a WebClient object.
        /// </summary>
        /// <param name="client">Client service proxy</param>
        /// <returns>Client WebClient object to be used in the UI.</returns>
        public static VM.ClientViewModel ToViewModel(this SP.ClientSvc.Client client)
        {
            VM.ClientViewModel result = new VM.ClientViewModel()
            {
                ClientGuid = client.ClientGuid,
                ClientID = client.ClientID,
                ClientName = client.ClientName,
                PhoneNumber = client.PhoneNumber,
                Email = client.Email,
                Address = client.Address,
                CityStateZipGuid = client.CityStateZipGuid,
                PaymentInfoGuid = client.PaymentInfoGuid,
                FederatedID = client.FederatedID,
                FederatedKey = client.FederatedKey,
                FederatedIDProvider = client.FederatedIDProvider,
                Username = client.Username,
                HashedPassword = client.HashedPassword,
            };

            return result;
        }
 public void RemoveClient(ClientViewModel client)
 {
     _clientVMs.Remove(client);
 }
 public void AddClient(ClientViewModel client)
 {
     _clientVMs.Add(client);
 }
Esempio n. 5
0
        public static int InsertClient(ClientViewModel client)
        {
            if (null == client)
            {
                throw new Exception("Cannot insert Client. The client object was null. Cannot be empty.");
            }

            try
            {
                // Convert the view model object to a service proxy object.
                SP.ClientSvc.Client request = client.ToModel();

                // Call the service insert method.
                _clientClient.InsertClient(request);

                return 1;
            }
            catch (System.ServiceModel.FaultException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 6
0
 public static ClientCollection GetClientsForPaymentInfoByPaymentInfoGuid(Guid paymentInfoGuid)
 {
     SP.ClientSvc.Client[] clients = _clientClient.GetClientsForPaymentInfoByPaymentInfoGuid(paymentInfoGuid);
     ClientCollection result = new ClientCollection();
     foreach (SP.ClientSvc.Client client
         in clients)
     {
         ClientViewModel viewModel = new ClientViewModel(client.ClientGuid, client.ClientID, client.ClientName, client.PhoneNumber, client.Email, client.Address, client.CityStateZipGuid, client.PaymentInfoGuid, client.FederatedID, client.FederatedKey, client.FederatedIDProvider, client.Username, client.HashedPassword);
         result.Add(viewModel);
     }
     return result;
 }