private void ClearAndSelect(ClientInfoGrid clientSelection)
        {
            foreach (var client in LstClients)
            {
                client.IsSelected = false;
            }

            if (clientSelection != null)
            {
                clientSelection.IsSelected = true;
            }
            else if (LstClients.Count > 0)
            {
                LstClients[0].IsSelected = true;
            }
        }
        private void DoRemoveClient(MessageDialogResult result, ClientInfoGrid clInfo)
        {
            if (result != MessageDialogResult.Affirmative)
            {
                return;
            }

            var relClientPhone = new ClientPhoneModel
            {
                ClientId      = clInfo.ClientInfo.ClientId ?? SharedConstants.NULL_ID_VALUE,
                ClientPhoneId = clInfo.ClientInfo.PrimaryPhone.PhoneId
            };

            _client.ExecutionProxy
            .ExecuteRequest <ClientPhoneModel, ClientPhoneModel, ResponseMessageData <bool>, ResponseMessageData <bool> >
                (relClientPhone, TransferDto.SameType, SharedConstants.Server.CLIENT_HUB,
                SharedConstants.Server.REMOVE_REL_PHONECLIENT_CLIENT_HUB_METHOD, TransferDto.SameType)
            .Subscribe(x => OnRemoveDone(x, clInfo), OnRemoveError);
        }
Ejemplo n.º 3
0
        public void Fill(ClientInfoGrid clInfo)
        {
            RxApp.MainThreadScheduler.Schedule(_ =>
            {
                ClientPreId            = clInfo.ClientPreId;
                ClientId               = clInfo.ClientInfo.ClientId;
                FirstName              = clInfo.ClientInfo.FirstName;
                LastName               = clInfo.ClientInfo.LastName;
                Email                  = clInfo.ClientInfo.Email;
                Company                = clInfo.ClientInfo.Company;
                CompanyId              = clInfo.ClientInfo.CompanyId;
                CompanySearchVm.IsDone = SharedConstants.Client.IS_TRUE;
                CompanySearchVm.Search = clInfo.ClientInfo.Company;

                SecondPhone          = clInfo.ClientInfo.SecondPhone;
                SecondPhoneVm.Search = SecondPhone != null ? SecondPhone.Phone : String.Empty;
                SecondPhoneVm.IsDone = SharedConstants.Client.IS_TRUE;

                BirthDate   = clInfo.ClientInfo.BirthDate;
                LoyaltyCode = clInfo.ClientInfo.LoyaltyCode;
            });
        }
        private void OnRemoveDone(IStale <ResponseMessageData <bool> > obj, ClientInfoGrid clInfo)
        {
            if (obj.IsStale)
            {
                OnRemoveError(Resources.Network.ResNetwork.ERROR_NETWORK_DOWN);
                return;
            }

            if (obj.Data.IsSuccess == false)
            {
                OnRemoveError(obj.Data.Message);
                return;
            }

            RxApp.MainThreadScheduler.Schedule(_ =>
            {
                var client = LstClients.FirstOrDefault(e => e.ClientPreId == clInfo.ClientPreId);
                if (client != null)
                {
                    LstClients.Remove(client);
                }
            });
        }
 public void OnClientChanged(ClientInfoGrid obj)
 {
     OnClientChanged(obj, true);
 }
        private void OnClientSaved(IStale <ResponseMessageData <ClientInfoModel> > obj, ClientInfoGrid clientInfoModel)
        {
            if (obj.IsStale)
            {
                OnClientSavedError(Resources.Network.ResNetwork.ERROR_NETWORK_DOWN, clientInfoModel);
                return;
            }

            if (obj.Data.IsSuccess == false)
            {
                OnClientSavedError(obj.Data.Message, clientInfoModel);
                return;
            }

            var modelSaved = obj.Data.Data;

            clientInfoModel.ClientInfo.ClientId    = modelSaved.ClientId;
            clientInfoModel.ClientInfo.SecondPhone = modelSaved.SecondPhone;
            clientInfoModel.ClientInfo.CompanyId   = modelSaved.CompanyId;
            clientInfoModel.Status = SharedConstants.Client.RECORD_SAVED;
            OnClientChanged(clientInfoModel);
        }
 private void OnClientSavedError(String msgError, ClientInfoGrid clientInfoModel)
 {
     clientInfoModel.Message = msgError;
     clientInfoModel.Status  = SharedConstants.Client.RECORD_ERROR_SAVED;
     OnClientChanged(clientInfoModel);
 }
 private void OnClientSavedError(Exception exception, ClientInfoGrid clientInfoModel)
 {
     OnClientSavedError(exception.Message, clientInfoModel);
 }