Пример #1
0
        public async void ListDemandesFonctions()
        {
            var requestCompetence = await HttpRequest.getRequest(App.Url + "api/LiaisonCompetences?filter[where][Id_Employe]=" + Settings.ActualUser.id_Employe);

            List <JSLiaisonCompetence> jSCompetence = JsonConvert.DeserializeObject <List <JSLiaisonCompetence> >(requestCompetence);

            ListCompetence = ObservableCollectionConvert.ObservableCollectionConvertion(jSCompetence);

            List <JSDemande> ListeDemande = new List <JSDemande>();

            foreach (var competence in ListCompetence)
            {
                var request = await HttpRequest.getRequest(App.Url + "api/Demandes?filter[include][Competence][intituleCompetences]&filter[where][id_tuteur]=null&filter[where][Id_Competence]=" + competence.id_Competence);

                List <JSDemande> jS = JsonConvert.DeserializeObject <List <JSDemande> >(request);
                var ListDemandeAdd  = ObservableCollectionConvert.ObservableCollectionConvertion(jS);
                ListeDemande.AddRange(ListDemandeAdd);
            }

            if (ListeDemande.Count() > 0)
            {
                foreach (var Demande in ListeDemande)
                {
                    var requestNomPrenom = await HttpRequest.getRequest(App.Url + "api/Employes?filter[where][Id_Employe]=" + Demande.id_Employe);

                    List <JSEmploye> jSEmploye = JsonConvert.DeserializeObject <List <JSEmploye> >(requestNomPrenom);
                    Demande.Employe = jSEmploye.First();
                }
            }

            ListDemandes.ItemsSource = ListeDemande;
        }
Пример #2
0
        public void Send(string Data)
        {
            try
            {
                var message = new JSMessage
                {
                    contenu       = Data,
                    date          = DateTime.Now,
                    id_Groupe     = Id_Groupe,
                    id_Expediteur = Settings.ActualUser.id_Employe,
                    Employe       = Settings.ActualUser
                };
                var val = JsonConvert.SerializeObject(message);
                socket.Emit("send", val);
                Messages.Add(message);
                ObMessages = ObservableCollectionConvert.ObservableCollectionConvertion(Messages);
                ListMessages.ItemsSource = ObMessages;

                ListMessages.ScrollTo(ObMessages.Last(), ScrollToPosition.End, true);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                socket.Disconnect();
            }
        }
Пример #3
0
        private async void SearchButton_Clicked(object sender, EventArgs e)
        {
            switch (SearchPicker.SelectedIndex)
            {
            case 0:
                SearchURL = App.Url + "api/IntituleCompetences?filter[include][competence]&filter[where][or][0][Intitule][like]=%" + SearchEntry.Text + "%";
                var req = await HttpRequest.getRequest(SearchURL);

                var val = JsonConvert.DeserializeObject <List <JSIntituleCompetence> >(req);
                SearchViewCompetence.ItemsSource = ObservableCollectionConvert.ObservableCollectionConvertion(val);
                break;

            case 1:
                SearchURL = App.Url + "api/Employes?filter[where][or][0][Nom][like]=%" + SearchEntry.Text + "%&filter[where][or][1][Prenom][like]=%" + SearchEntry.Text + "%";
                var req2 = await HttpRequest.getRequest(SearchURL);

                var val2 = JsonConvert.DeserializeObject <List <JSEmploye> >(req2);
                SearchViewEmploye.ItemsSource = ObservableCollectionConvert.ObservableCollectionConvertion(val2);
                break;

            case 2:
                SearchURL = App.Url + "api/Groupes?filter[include][competences]&filter[where][titre]=%" + SearchEntry.Text + "%";
                var req3 = await HttpRequest.getRequest(SearchURL);

                var val3 = JsonConvert.DeserializeObject <List <JSGroupe> >(req3);
                SearchViewGroupe.ItemsSource = ObservableCollectionConvert.ObservableCollectionConvertion(val3);
                break;

            default:
                break;
            }
        }
Пример #4
0
        public async void GetAllComp()
        {
            var req = await HttpRequest.getRequest(App.Url + "api/IntituleCompetences?filter[include][competence]&filter[where][Id_Langue]=" + Settings.ActualLanguage);

            List <JSIntituleCompetence> jS = JsonConvert.DeserializeObject <List <JSIntituleCompetence> >(req);

            ListIntituleCompetence         = ObservableCollectionConvert.ObservableCollectionConvertion(jS);
            ListCompetenceXAML.ItemsSource = ListIntituleCompetence;
        }
Пример #5
0
        public async void ReqCompetenceProfil()
        {
            var req = await HttpRequest.getRequest(App.Url + "api/LiaisonCompetences?filter[include][competence][intituleCompetences]&filter[where][Id_Employe]=" + employe.id_Employe);

            List <JSLiaisonCompetence> jS = JsonConvert.DeserializeObject <List <JSLiaisonCompetence> >(req);

            ListCompetence           = ObservableCollectionConvert.ObservableCollectionConvertion(jS);
            ListViewComp.ItemsSource = ListCompetence;
        }
Пример #6
0
        public async void ReqGroupeProfil()
        {
            var req = await HttpRequest.getRequest(App.Url + "api/Membres?filter[include][groupe][competences][intituleCompetences]&filter[where][Id_Employe]=" + employe.id_Employe);

            List <JSMembre> jS = JsonConvert.DeserializeObject <List <JSMembre> >(req);

            ListGroupe             = ObservableCollectionConvert.ObservableCollectionConvertion(jS);
            CntPGroupe.ItemsSource = ListGroupe;
        }
Пример #7
0
        public async void requeteGroupe()
        {
            var request = await HttpRequest.getRequest(App.Url + "api/Membres?filter[include][groupe][competences][intituleCompetences]&filter[where][Id_Employe]=" + Settings.ActualUser.id_Employe);

            System.Diagnostics.Debug.WriteLine(request);
            var res = JsonConvert.DeserializeObject <List <JSMembre> >(request);

            Listgr            = res;
            Liste.ItemsSource = ObservableCollectionConvert.ObservableCollectionConvertion(Listgr);
        }
Пример #8
0
 private async void ListEmploye_ItemSelected(object sender, SelectedItemChangedEventArgs e)
 {
     if (groupe.Participant.Where(c => c.id_Employe == ((JSEmploye)ListEmploye.SelectedItem).id_Employe).Count() == 0)
     {
         groupe.Participant.Add(((JSEmploye)ListEmploye.SelectedItem));
         ListParticipant.ItemsSource = ObservableCollectionConvert.ObservableCollectionConvertion(groupe.Participant);
     }
     else
     {
         await DisplayAlert("Erreur", "La cible est déjâ ajoutée", "Ok");
     }
 }
Пример #9
0
        public async void CreateLsiteCompetence()
        {
            //partie nom/prenom
            var id_competence = competence.id_Competence;
            var req           = await HttpRequest.getRequest(App.Url + "api/LiaisonCompetences?filter[where][Id_Competence]=" + id_competence + "&filter[where][EstTutorant]=true&filter[include][employe][NotesTuteur]");

            List <JSLiaisonCompetence> jS = JsonConvert.DeserializeObject <List <JSLiaisonCompetence> >(req);

            foreach (var liaisonComp in jS)
            {
                try
                {
                    var reqNote = await HttpRequest.getRequest(App.Url + "api/Notes?filter[where][Id_Tuteur]=" + liaisonComp.id_Employe + "&filter[where][Id_Competence]=" + liaisonComp.id_Competence);

                    List <JSNote> jSNote   = JsonConvert.DeserializeObject <List <JSNote> >(reqNote);
                    var           moyenne  = 0;
                    var           compteur = 0;
                    if (jSNote.Count() > 0)
                    {
                        foreach (var Note in jSNote)
                        {
                            var noteMoyenne = (Note.note + Note.noteCommunication + Note.noteConnaissance + Note.notePedagogie + Note.noteRelationnel) / 5;
                            moyenne += noteMoyenne;
                            compteur++;
                        }
                        moyenne = moyenne / compteur;
                    }
                    else
                    {
                        moyenne = 0;
                    }
                    liaisonComp.note = moyenne;
                }
                catch
                {
                    liaisonComp.note = 0;
                }
                /* ListLiaisonCompetenceSelected.Remove(liaisonComp.Where(c => c.id_DuTuteur == Settings.ActualUser.id_Employe));*/
            }
            ListLiaisonCompetenceSelected = ObservableCollectionConvert.ObservableCollectionConvertion(jS);
            ListTuteurXAML.ItemsSource    = ListLiaisonCompetenceSelected;
        }
Пример #10
0
        // Partie view liste demande
        public async void GetAllDemande()
        {
            var request = await HttpRequest.getRequest(App.Url + "api/Demandes?filter[include][Competence][intituleCompetences]&filter[where][Id_Employe]=" + Settings.ActualUser.id_Employe);

            List <JSDemande> jS = JsonConvert.DeserializeObject <List <JSDemande> >(request);

            ListDemande = ObservableCollectionConvert.ObservableCollectionConvertion(jS);
            foreach (var demande in ListDemande)
            {
                demande.Employe = Settings.ActualUser;
                var requestTuteur = await HttpRequest.getRequest(App.Url + "api/Employes?filter[where][Id_Employe]=" + demande.id_DuTuteur);

                List <JSEmploye> tuteur = JsonConvert.DeserializeObject <List <JSEmploye> >(requestTuteur);
                if (tuteur.Count > 0)
                {
                    demande.Tuteur = tuteur.First();
                }
            }
            ListDemandeXAML.ItemsSource = ListDemande;
        }
Пример #11
0
        private async void Log(int id_groupe)
        {
            var groupe = await HttpRequest.getRequest(App.Url + "api/Groupes?filter[where][Id_Groupe]=" + id_groupe);

            var message = await HttpRequest.getRequest(App.Url + "api/Messageries?filter[include][employe]&filter[where][Id_Groupe]=" + id_groupe + "&filter[limit]=10");

            Messages = JsonConvert.DeserializeObject <List <JSMessage> >(message);
            System.Diagnostics.Debug.WriteLine(message);
            Settings.ActualGroupe    = JsonConvert.DeserializeObject <List <JSGroupe> >(groupe).FirstOrDefault();
            ObMessages               = ObservableCollectionConvert.ObservableCollectionConvertion(Messages);
            ListMessages.ItemsSource = ObMessages;
            socket.Connect();
            var JSUser   = JsonConvert.SerializeObject(Settings.ActualUser);
            var JSGroupe = JsonConvert.SerializeObject(Settings.ActualGroupe);

            socket.Emit("nouv_client", JSUser, JSGroupe);
            socket.On("retour", (data) =>
            {
                Device.BeginInvokeOnMainThread(() =>
                {
                    System.Diagnostics.Debug.WriteLine(data.ToString());
                    JSMessage jSMessage = JsonConvert.DeserializeObject <JSMessage>(data.First().ToString());
                    Messages.Add(jSMessage);
                    ObMessages = ObservableCollectionConvert.ObservableCollectionConvertion(Messages);

                    ListMessages.ItemsSource = ObMessages;
                    ListMessages.ScrollTo(ObMessages.Last(), ScrollToPosition.End, false);
                });
            });
            socket.On("Error", (data) =>
            {
                socket.Emit("nouv_client", JSUser, JSGroupe);
                Device.BeginInvokeOnMainThread(() =>
                {
                    DisplayAlert("Erreur", "Renvoyer votre message", "ok");
                });
            });
        }
Пример #12
0
        async private void Valider_Clicked(object sender, EventArgs e)
        {
            var temoin = 0;
            JSLiaisonCompetence LiaisonComp = ((JSLiaisonCompetence)ListTuteurXAML.SelectedItem);

            JSDemande demande = new JSDemande
            {
                id_Competence = LiaisonComp.id_Competence,
                id_DuTuteur   = LiaisonComp.id_Employe,
                id_Employe    = Settings.ActualUser.id_Employe
            };

            var reqDemande = await HttpRequest.getRequest(App.Url + "api/Demandes");

            List <JSDemande> jS  = JsonConvert.DeserializeObject <List <JSDemande> >(reqDemande);
            var ListDemandeCheck = ObservableCollectionConvert.ObservableCollectionConvertion(jS);

            foreach (var demandeCheck in ListDemandeCheck)
            {
                if (demande.id_Employe == demandeCheck.id_Employe && demande.id_Competence == demandeCheck.id_Competence)
                {
                    temoin = 1;
                }
            }
            System.Diagnostics.Debug.WriteLine(temoin);
            if (temoin == 0)
            {
                var req = await HttpRequest.postRequest(App.Url + "api/Demandes/", demande);

                await Navigation.PushAsync(new PageDemande());
            }
            else
            {
                var req = await HttpRequest.postRequest(App.Url + "api/Demandes/update?where[Id_Employe]=" + demande.id_Employe + "&[Id_Competence]=" + demande.id_Competence, demande);

                await Navigation.PushAsync(new PageDemande());
            }
        }
Пример #13
0
        public async void ListMesDemandesFonctions()
        {
            var requestDemande = await HttpRequest.getRequest(App.Url + "api/Demandes?filter[include][Competence][intituleCompetences]&filter[where][Id_DuTuteur]=" + Settings.ActualUser.id_Employe);

            List <JSDemande> jSCompetence = JsonConvert.DeserializeObject <List <JSDemande> >(requestDemande);

            ListeMesDemandes = ObservableCollectionConvert.ObservableCollectionConvertion(jSCompetence);
            System.Diagnostics.Debug.WriteLine(ListeMesDemandes.Count());
            if (ListeMesDemandes.Count() > 0)
            {
                System.Diagnostics.Debug.WriteLine(ListeMesDemandes);
                foreach (var demande in ListeMesDemandes)
                {
                    System.Diagnostics.Debug.WriteLine(demande.id_Employe);
                    var requestNomPrenom = await HttpRequest.getRequest(App.Url + "api/Employes?filter[where][Id_Employe]=" + demande.id_Employe);

                    System.Diagnostics.Debug.WriteLine(requestNomPrenom);
                    List <JSEmploye> jSEmploye = JsonConvert.DeserializeObject <List <JSEmploye> >(requestNomPrenom);
                    demande.Employe = jSEmploye.First();
                }
            }
            System.Diagnostics.Debug.WriteLine(ListeMesDemandes.Count());
            ListDemandeTutorat.ItemsSource = ListeMesDemandes;
        }
Пример #14
0
 private void ListParticipant_ItemSelected(object sender, SelectedItemChangedEventArgs e)
 {
     groupe.Participant.Remove(((JSEmploye)ListParticipant.SelectedItem));
     ListParticipant.ItemsSource = ObservableCollectionConvert.ObservableCollectionConvertion(groupe.Participant);
 }
Пример #15
0
        private async void ChargementData(bool modif)
        {
            var reqTuteur = await HttpRequest.getRequest(App.Url + "api/Membres?filter[include][employe]&filter[where][Id_Groupe]=" + groupe.id_Groupe);

            System.Diagnostics.Debug.WriteLine(reqTuteur);
            var res = JsonConvert.DeserializeObject <List <JSMembre> >(reqTuteur);

            var reqComp = await HttpRequest.getRequest(App.Url + "api/IntituleCompetences?filter[include][competence]&filter[where][Id_Langue]=" + Settings.ActualLanguage);

            ListComp = JsonConvert.DeserializeObject <List <JSIntituleCompetence> >(reqComp);

            var reqEmp = await HttpRequest.getRequest(App.Url + "api/Employes");

            ListEmp = JsonConvert.DeserializeObject <List <JSEmploye> >(reqEmp);
            if (res.Where(c => c.estTutorant == true).Count() != 0)
            {
                groupe.tuteur = res.Where(c => c.estTutorant == true).First().Employe;
            }
            var listp = new List <JSEmploye>();

            foreach (JSMembre m in res)
            {
                if (m.Employe != null)
                {
                    listp.Add(m.Employe);
                    listEmpInitial.Add(m.Employe);
                }
                else
                {
                    var reqManquant = await HttpRequest.getRequest(App.Url + "api/Employes/" + m.id_Employe);

                    var r = JsonConvert.DeserializeObject <JSEmploye>(reqManquant);

                    listp.Add(r);
                    listEmpInitial.Add(r);
                }
            }
            groupe.Participant = listp;

            Titre.Text      = groupe.titre;
            ModifTitre.Text = groupe.titre;

            if (!(groupe.Competence is null))
            {
                if (groupe.Competence.IntituleCompetences is null)
                {
                    var req = await HttpRequest.getRequest(App.Url + "api/IntituleCompetences?filter[where][Id_Langue]=" + Settings.ActualLanguage + "&filter[where][Id_Competence]=" + groupe.Competence.id_Competence);

                    var reqDes = JsonConvert.DeserializeObject <List <JSIntituleCompetence> >(req);
                    if (reqDes.Count > 0)
                    {
                        groupe.Competence.IntituleCompetences = reqDes;
                    }
                    else
                    {
                        var JSi = new JSIntituleCompetence
                        {
                            description = "description",
                            intitule    = "intitule",
                            id_Langue   = 2
                        };
                        groupe.Competence.IntituleCompetences = new List <JSIntituleCompetence>();
                        groupe.Competence.IntituleCompetences.Add(JSi);
                    }
                }
                //Competence
                if (groupe.Competence.IntituleCompetences.Where(c => c.id_Langue == Settings.ActualLanguage).ToList().Count > 0)
                {
                    Competence.Text         = groupe.Competence.IntituleCompetences.Where(c => c.id_Langue == Settings.ActualLanguage).First().intitule;
                    IntituleCompActuel.Text = groupe.Competence.IntituleCompetences.Where(c => c.id_Langue == Settings.ActualLanguage).First().intitule;
                    if (groupe.Competence.IntituleCompetences.Where(c => c.id_Langue == Settings.ActualLanguage).First().description != "")
                    {
                        DescriptionCompActuel.Text = groupe.Competence.IntituleCompetences.Where(c => c.id_Langue == Settings.ActualLanguage).First().description.ToString();
                    }
                    else
                    {
                        DescriptionCompActuel.Text = "Description";
                    }
                }
                else if (groupe.Competence.IntituleCompetences.ToList().Count > 0)
                {
                    Competence.Text         = groupe.Competence.IntituleCompetences.First().intitule;
                    IntituleCompActuel.Text = groupe.Competence.IntituleCompetences.First().intitule;
                    if (groupe.Competence.IntituleCompetences.First().description != "")
                    {
                        DescriptionCompActuel.Text = groupe.Competence.IntituleCompetences.First().description;
                    }
                    else
                    {
                        DescriptionCompActuel.Text = "Description";
                    }
                }
                else
                {
                    Competence.Text            = "Intitule";
                    IntituleCompActuel.Text    = "Intitule";
                    DescriptionCompActuel.Text = "Description";
                }
            }
            ModifCompetence.ItemsSource = ListComp;

            //Membre et Tuteur
            Tuteur.BindingContext            = groupe.tuteur;
            ListMembreVue.ItemsSource        = ObservableCollectionConvert.ObservableCollectionConvertion(groupe.Participant);
            ModifListParticipant.ItemsSource = ObservableCollectionConvert.ObservableCollectionConvertion(groupe.Participant);
            ListEmploye.ItemsSource          = ListEmp;

            if (modif == false)
            {
                AvecModif.IsVisible = false;
                SansModif.IsVisible = true;
            }
            else
            {
                AvecModif.IsVisible = true;
                SansModif.IsVisible = false;
            }
        }