Ejemplo n.º 1
0
        private async void ConfirmModif_Clicked(object sender, EventArgs e)
        {
            groupe.titre = ModifTitre.Text;
            var req = await HttpRequest.postRequest(App.Url + "api/Groupes/update?where[Id_Groupe]=" + groupe.id_Groupe, groupe);

            foreach (JSEmploye emp in listEmpInitial)
            {
                System.Diagnostics.Debug.WriteLine(groupe.Participant.Count());
                System.Diagnostics.Debug.WriteLine(listEmpInitial.Count());

                if (groupe.Participant.Where(c => c.id_Employe == emp.id_Employe).Count() == 0)
                {
                    System.Diagnostics.Debug.WriteLine("une différence Delete :" + emp.id_Employe + " :: " + groupe.Participant.Where(c => c.id_Employe == emp.id_Employe).Count());
                    var reqDelete = await HttpRequest.deleteRequest(App.Url + "api/Membres?where[Id_Groupe]=" + groupe.id_Groupe + "&where[Id_Employe]=" + emp.id_Employe);
                }
            }
            foreach (JSEmploye emp2 in groupe.Participant)
            {
                if (listEmpInitial.Where(c => c.id_Employe == emp2.id_Employe).Count() == 0)
                {
                    System.Diagnostics.Debug.WriteLine("une différence Add :" + emp2.id_Employe + " :: " + groupe.Participant.Where(c => c.id_Employe == emp2.id_Employe).Count());
                    var ObjEmp = new JSMembre
                    {
                        id_Employe  = emp2.id_Employe,
                        id_Groupe   = groupe.id_Groupe.Value,
                        estTutorant = false
                    };
                    var reqAdd = await HttpRequest.postRequest(App.Url + "api/Membres", ObjEmp);
                }
            }
            System.Diagnostics.Debug.Write(req);
            ActualStatus = false;
            ChargementData(ActualStatus);
        }
Ejemplo n.º 2
0
        private async void Confirm_Clicked(object sender, EventArgs e)
        {
            groupe.titre        = Titre.Text;
            groupe.dateReunion  = DateReunion.Date;
            groupe.dateCreation = DateTime.Now;
            groupe.id_Groupe    = null;
            var req = await HttpRequest.postRequest(App.Url + "api/Groupes", groupe);

            var req2 = await HttpRequest.getRequest(App.Url + "api/Groupes?filter[limit]=1&filter[order]=Id_Groupe%20DESC");

            var res = JsonConvert.DeserializeObject <List <JSGroupe> >(req2);

            System.Diagnostics.Debug.WriteLine(req2);
            foreach (JSEmploye emp2 in groupe.Participant)
            {
                if (listEmpInitial.Where(c => c.id_Employe == emp2.id_Employe).Count() == 0)
                {
                    var ObjEmp = new JSMembre
                    {
                        id_Employe  = emp2.id_Employe,
                        id_Groupe   = res.First().id_Groupe.Value,
                        estTutorant = false
                    };
                    var reqAdd = await HttpRequest.postRequest(App.Url + "api/Membres", ObjEmp);
                }
            }
            var ObjEmp2 = new JSMembre
            {
                id_Employe  = Settings.ActualUser.id_Employe,
                id_Groupe   = res.First().id_Groupe.Value,
                estTutorant = true
            };
            var reqAdd2 = await HttpRequest.postRequest(App.Url + "api/Membres", ObjEmp2);

            await Navigation.PushModalAsync(new Profil());
        }