Exemple #1
0
        private async void ActionGetData()
        {
            WSService ws     = new WSService();
            var       result = await ws.GetAllDevice();

            this.ComboBoxDevice = new ObservableCollection <Device>(result);
        }
Exemple #2
0
        public MainPage()
        {
            this.InitializeComponent();

            wsService = WSService.GetInstance();
            ActionGetData();
        }
        private async void getMontantDeviseValue()
        {
            double conversion = 0.0;
            bool   noValue    = string.IsNullOrEmpty(this.montant_euros_value.Text);
            bool   noTarget   = this.devise_value.SelectedValue == null;

            // if there is a problem
            if (noValue || noTarget)
            {
                string message = "";
                if (noValue)
                {
                    message = "A Euros value must be set";
                }
                else if (noTarget)
                {
                    message = "A target currency must be selected";
                }
                var messageDialog = new MessageDialog(message);
                messageDialog.Commands.Add(
                    new UICommand("Close")
                    );
                messageDialog.DefaultCommandIndex = 0;
                await messageDialog.ShowAsync();
            }
            else
            {
                double montantEuros = Convert.ToDouble(this.montant_euros_value.Text);
                string selectedId   = this.devise_value.SelectedValue.ToString();
                Devise deviseTo     = await WSService.getDeviseByIdAsync("devise/" + selectedId);

                conversion = WSService.getConversion(deviseTo, montantEuros);
            }
            this.montant_devise_value.DataContext = conversion;
        }
Exemple #4
0
        /// <summary>
        /// Récupère la liste des devises via le service connecté à l'API
        /// </summary>
        private async void ActionGetData()
        {
            WSService connection = WSService.GetInstance();
            var       result     = await connection.GetAllDevisesAsync("Devise");

            this.ComboBoxDevises = new ObservableCollection <Devise>(result);
        }
Exemple #5
0
 public AjouterCompteVM()
 {
     _wsService            = new WSService();
     AddedCompte           = new Compte();
     BtnClearCompteCommand = new RelayCommand(ClearCompte);
     BtnAddCompteCommand   = new RelayCommand(AddCompte);
 }
Exemple #6
0
        /// <summary>
        /// Récupère la liste des devises via l'API
        /// </summary>
        private async void ActionGetData()
        {
            WSService     wSService = WSService.GetInstance();
            List <Devise> devises   = await wSService.GetAllDevisesAsync("Devise");

            this.comboBox.DataContext = devises;
        }
Exemple #7
0
        public async void InitializeData()
        {
            WSService service = WSService.GetInstance();
            var       result  = await service.GetDevisesAsync();

            this.deviseBox.DataContext   = result.ToList();
            this.deviseBox.SelectedValue = 1;
        }
Exemple #8
0
 public VMAjouterCompte()
 {
     _bingService          = new BingService();
     _wsService            = new WSService();
     AddedCompte           = new Compte();
     BtnClearCompteCommand = new RelayCommand(ClearCompte);
     BtnAddCompteCommand   = new RelayCommand(AddCompte);
 }
        public VMCompte()
        {
            this.Mail = "*****@*****.**";

            _wsService            = new WSService();
            BtnSearchCompteByMail = new RelayCommand(SearchCompteByEmail);
            BtnClearCompteCommand = new RelayCommand(ClearCompte);
            BtnAddCompteCommand   = new RelayCommand(AddCompte);
        }
        public async void AlimData()
        {
            WSService ws   = new WSService();
            var       resu = await ws.GetAllDevice();

            this.CbDevise.DataContext       = resu;
            this.CbDevise.ItemsSource       = resu;
            this.CbDevise.SelectedValuePath = "Id";
            this.CbDevise.DisplayMemberPath = "Nom";
        }
Exemple #11
0
 public void CargarServicios()
 {
     List<Service> listService = new List<Service>();
     WSService wsservice = new WSService();
     listService = wsservice.ListService();
     this.service.DataSource = listService;
     this.service.DataValueField = "idService";
     this.service.DataTextField = "name";
     this.service.DataBind();
     this.service.Items.Insert(0, new ListItem("-- SELECCIONE EL SERVICIO --"));
 }
Exemple #12
0
        public RechercheCompteVM()
        {
            //alim pr test
            this.Mail = "*****@*****.**";

            // Fctn
            _wsService             = new WSService();
            BtnSearchCompteByMail  = new RelayCommand(SearchCompteByEmail);
            BtnClearCompteCommand  = new RelayCommand(ClearCompte);
            BtnModifyCompteCommand = new RelayCommand(ModifCompte);
            BtnAddCompteCommand    = new RelayCommand(RedirectToAddCompte);
        }
Exemple #13
0
        private async Task <List <ContaTipo> > TrazerContaTipos()
        {
            WSService ws         = new WSService();
            var       contaTipos = await ws.Get <List <ContaTipo> >(Constantes.SERVER_CONTATIPOS);

            if (contaTipos.GetType() == typeof(Response))
            {
                var response = (Response)contaTipos;
                Message.Erro((string)response.Data);
                return(null);
            }
            return(contaTipos as List <ContaTipo>);
        }
Exemple #14
0
        private async void ActionSave()
        {
            try
            {
                await WSBingMaps.FillCompteLocation(Compte);

                await WSService.CreateCompte(Compte);
                await ShowDialog($"Compte {Compte.Nom} (localisé {Compte.Latitude}/{Compte.Longitude}) créé !");
            }
            catch (Exception e)
            {
                await ShowDialog(e.Message);
            }
        }
        private async void ActionModifyCompteCommand()
        {
            WSService wsService = WSService.GetInstance();

            try
            {
                Compte = await wsService.PutCompteAsync(_cpt.CPT_ID, _cpt);
            }
            catch (Exception e)
            {
                var messageDialog = new MessageDialog("Pas de connexion au webService concerné");
                await messageDialog.ShowAsync();
            }
        }
Exemple #16
0
        private async Task <Cliente> GetCliente(Guid id_cliente)
        {
            WSService s      = new WSService();
            var       result = await s.Get <Cliente>(Constantes.SERVER_CLIENTES + id_cliente.ToString());

            if (result.GetType() == typeof(Response))
            {
                var response = (Response)result;
                Message.Erro((string)response.Data);
                return(null);
            }

            return(result as Cliente);
        }
        private async void ActionGetData()
        {
            try
            {
                var result = await WSService.GetInstance().GetAllDeviseAsync();

                this.ComboBoxDevises = new ObservableCollection <Devise>(result);
            }
            catch (Exception e)
            {
                MessageDialog dialog = new MessageDialog("Une erreur est survenu en essayant de recupérer les données du serveur");
                await dialog.ShowAsync();
            }
        }
        /// <summary>
        /// Change to convertissor page = go to DeviseEuros
        /// </summary>
        private async void ActionMailRecherche()
        {
            WSService wsService = WSService.GetInstance();

            try
            {
                Compte = await wsService.GetCompteMailAsync(_mailBoxRech);
            }
            catch (Exception e)
            {
                var messageDialog = new MessageDialog("Pas de connexion au webService concerné");
                await messageDialog.ShowAsync();
            }
        }
        private async void ActionGetData()
        {
            WSService Service = WSService.GetInstance();

            try
            {
                var result = await Service.GetAllDeviseAsync();

                this.CBDevise.DataContext = new List <Devise>(result);
            }
            catch (Exception e)
            {
                MessageDialog dialog = new MessageDialog("Une erreur est survenu en essayant de recupérer les données du serveur");
                await dialog.ShowAsync();
            }
        }
Exemple #20
0
        private async void abb_salvar_Click(object sender, RoutedEventArgs e)
        {
            if (!Edit)
            {
                if (contatos.Any())
                {
                    clienteViewModel.Cliente.Contatos = (from contato in contatos.ToList() select contato.ContaContato).ToList();
                }
                if (enderecos.Any())
                {
                    clienteViewModel.Cliente.Enderecos = (from endereco in enderecos.ToList() select endereco.ContaEndereco).ToList();
                }
            }

            WSService ws     = new WSService();
            var       result = await ws.Post(Constantes.SERVER_CLIENTES, clienteViewModel.Cliente);
        }
        /// <summary>
        /// Essaie de récupérer les devises dans un appel asynchrone
        /// Erreur deconnexion gérée par un try catch
        /// </summary>
        private async void ActionGetData()
        {
            WSService wsService = WSService.GetInstance();

            try
            {
                var result = await wsService.GetAllDevisesAsync();

                ComboBoxDevises = new ObservableCollection <Devise>(result);
            }
            catch (Exception e)
            {
                var messageDialog = new MessageDialog("Pas de connexion au webService concerné");
                await messageDialog.ShowAsync();

                Application.Current.Exit();
            }
        }
        private async void ActionGetData()
        {
            WSService wsService = WSService.GetInstance();

            try
            {
                var result = await wsService.GetAllDevisesAsync();

                ComboBoxDevises = new ObservableCollection <Devise>(result);
            }
            catch (Exception e)
            {
                var messageDialog = new MessageDialog("Pas de connexion au webService concerné");
                await messageDialog.ShowAsync();

                // IL FAUDRAIT FERMER L'APPLICATION
            }
        }
Exemple #23
0
        private async void ActionCreateAccount()
        {
            WSService wsService = WSService.GetInstance();

            try
            {
                _cptNew.CPT_PWD = PasswordChp;
                await wsService.PostCompteAsync(_cptNew);

                var messageDialog = new MessageDialog("Nouvel utilisateur ajouté");
                await messageDialog.ShowAsync();
            }
            catch (Exception e)
            {
                var messageDialog = new MessageDialog("Pas de connexion au webService concerné");
                await messageDialog.ShowAsync();
            }
        }
Exemple #24
0
        private async void ActionSave()
        {
            if (Compte == null)
            {
                await ShowDialog("Veuillez sélectionner un compte");

                return;
            }
            try
            {
                await WSService.UpdateCompte(Compte);
                await ShowDialog($"Compte {Compte.Nom} modifié !");
            }
            catch (Exception ex)
            {
                await ShowDialog(ex.Message);
            }
        }
Exemple #25
0
        private async void ActionSearch()
        {
            // TODO Check that `Search` is a valid email address
            if (Search.Length == 0)
            {
                await ShowDialog("Veuillez entrez une adresse e-mail valide");

                return;
            }
            var compte = await WSService.GetCompteByEmail(Search);

            if (compte == null)
            {
                await ShowDialog("Compte introuvable");

                return;
            }
            Compte = compte;
        }
Exemple #26
0
        private async void b_login_Click(object sender, RoutedEventArgs e)
        {
            LoginViewModel login = new LoginViewModel {
                Login = "******", Senha = "adm123*"
            };
            WSService ws     = new WSService();
            var       result = await ws.Login(login);

            if (result.GetType() == typeof(Response))
            {
                var           response = ((Response)result);
                MessageDialog msg      = new MessageDialog(response.Data.ToString());
                await msg.ShowAsync();

                return;
            }
            MessageDialog msgOk = new MessageDialog("Ok");
            await msgOk.ShowAsync();
        }
Exemple #27
0
        protected void BtnInsert_Click(object sender, EventArgs e)
        {
            //// REGISTRANDO PACIENTE
            Service objService = GetValues();
            // ACCEDIENDO AL WEB SERVICE
            WSService wsservice = new WSService();
            bool      response  = wsservice.InsertService(objService);

            if (response)
            {
                this.divSuccess.Visible = true;
                this.TextSuccess.Text   = "¡Servicio creado con éxito!";
                this.txtName.Text       = string.Empty;
            }
            else
            {
                this.divError.Visible = true;
                this.TextError.Text   = "¡El servicio no fue creado!";
            }
        }
Exemple #28
0
        protected async void ActionSearch()
        {
            String    email      = Convert.ToString(_valeurEmail);
            WSService connection = WSService.GetInstance();

            try
            {
                var result = await connection.GetCompteByEmailAsync("Comptes/GetCompteByEmail/" + email);

                if (result.Nom == null)
                {
                    this.MessageBox("Aucun compte correspondant n'a été trouvé");
                }
                else
                {
                    this.ValeurCompteNom = result.Nom;
                }
            }
            catch (HttpRequestException e)
            {
                this.MessageBox("La connexion à la base de donnée à échoué");
            }
        }
 private async void ActionGetData()
 {
     CompteSearch = await WSService.getCompteByMailAsync(_compteSearch.CPT_MEL);
 }
 private async void ActionUpdateData()
 {
     await WSService.updateCompte(_compteSearch);
 }