Esempio n. 1
0
 private void tabControl_Biens_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (tabControl_Biens.SelectedTab == tabPage1_Biens)
     {
         Nouvelle uc = new Nouvelle();
         uc.newBiens += (s1, e1) =>
         {
             reverse = true;
             run     = splitContainer1.Width;
             init();
             obj_biens = (Immo_Rale.Management.Biens)s1;
             annonce();
         };
         changeTab(tabPage1_Biens, uc);
     }
     else if (tabControl_Biens.SelectedTab == tabPage2_Biens)
     {
         Liste_bien uc = new Liste_bien();
         uc.BiensSelected += (s2, e1) =>
         {
             tabControl_Biens.SelectedTab = tabPage1_Biens;
             changeTab(tabPage1_Biens, new Nouvelle((Immo_Rale.Management.Biens)s2));
         };
         changeTab(tabPage2_Biens, uc);
     }
 }
Esempio n. 2
0
 public VueNouvelle()
 {
     WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
     Console.WriteLine("VueNouvelle");
     InitializeComponent();
     this.nouvelle = new Nouvelle();
 }
Esempio n. 3
0
        private void une_alerte()
        {
            //TODO : Mettre l'application en mode Mocks et aller chercher un joueur dans le Mock
            var mockRepo = new MockNouvellesRepository();

            _nouvelle = mockRepo.GetById(1).Result;
        }
Esempio n. 4
0
        public async Task <IActionResult> Edit(int id, [Bind("Titre,Texte,Lien,Status,Id")] Nouvelle nouvelle)
        {
            if (id != nouvelle.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    await _repository.Update(nouvelle);
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!NouvelleExists(nouvelle.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(nouvelle));
        }
Esempio n. 5
0
        private async void Une_nouvelle()
        {
            var mockRepo = new MockNouvellesRepository();
            var nouvelle = await mockRepo.GetAll();

            _nouvelle = nouvelle.First();
        }
Esempio n. 6
0
        public NouvelleIndex(Nouvelle e)
        {
            this.actif = e.actif; this.description = e.description; this.titre = e.titre; this.id = e.id;
            UtilisateurServiceAPI usa = new UtilisateurServiceAPI();

            this.createur     = usa.Donner(e.idCreateur).nomAffichage();
            this.dateCreation = e.dateCreation;
        }
Esempio n. 7
0
        public void montrerNouvelles(List <Nouvelle> listeNouvelles)
        {
            // il faut partir au 7em element car les 6 premier ne sont pas des nouvelles
            Nouvelle new1 = listeNouvelles[7];

            this.news.Text = this.news.Text + new1.name;
            Console.WriteLine("Nouvelle ajouter dans la TextBox");
        }
Esempio n. 8
0
        public ActionResult Details(int id)
        {
            NouvelleServiceAPI rsa = new NouvelleServiceAPI();
            Nouvelle           r   = rsa.Donner(id);
            NouvelleDetails    rd  = new NouvelleDetails(r);

            return(View(rd));
        }
Esempio n. 9
0
 public static cl.Nouvelle VersClient(this Nouvelle e)
 {
     if (e == null)
     {
         return(null);
     }
     return(new cl.Nouvelle {
         actif = e.actif, description = e.description, id = e.id, titre = e.titre, dateCreation = e.dateCreation, idCreateur = e.idCreateur
     });
 }
Esempio n. 10
0
 public static gl.Nouvelle VersGlobal(this Nouvelle e)
 {
     if (e == null)
     {
         return(null);
     }
     return(new gl.Nouvelle {
         id = e.id, description = e.description, titre = e.titre, actif = e.actif ? 1 : 0, idcreateur = e.idCreateur, datecreation = e.dateCreation
     });
 }
Esempio n. 11
0
        public async Task <IActionResult> Create([Bind("Titre,Texte,Lien,Status,Id")] Nouvelle nouvelle)
        {
            if (ModelState.IsValid)
            {
                await _repository.Add(nouvelle);

                return(RedirectToAction(nameof(Index)));
            }
            return(View(nouvelle));
        }
Esempio n. 12
0
        private bool NouvelleExists(int id)
        {
            Nouvelle nouvelle = _repository.GetById(id).Result;

            if (nouvelle == null)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Esempio n. 13
0
        public async void Test_Create_ShouldAddNewProjectTorepo()
        {
            //Arrange
            var nouvelle = new Nouvelle()
            {
                Title = "Any_title", Text_Desc = "Any_desc"
            };

            //Act
            await _nouvelleController.Create(nouvelle);

            //Assert
            Assert.Equal(nouvelle, _mockRepo._nouvelles.LastOrDefault());
        }
        public int Creer(Nouvelle e)
        {
            string              contenuJson = JsonConvert.SerializeObject(e, Formatting.Indented);
            StringContent       contenu     = new StringContent(contenuJson, Encoding.UTF8, "application/json");
            HttpResponseMessage reponse     = _client.PostAsync($"Nouvelle/Creer/", contenu).Result;

            if (!reponse.IsSuccessStatusCode)
            {
                throw new Exception("Echec de la réception de données.");
            }
            return(Convert.ToInt32((reponse.Content.ReadAsStringAsync().Result)));

            throw new NotImplementedException();
        }
Esempio n. 15
0
        public async Task <IActionResult> Edit(int id, [Bind("Title,Text_Desc,Link_Media,Status,Id")] Nouvelle nouvelle)
        {
            if (id != nouvelle.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                await _nouvelleRepository.Update(nouvelle);

                return(RedirectToAction(nameof(Index)));
            }
            return(View(nouvelle));
        }
Esempio n. 16
0
        public async void Test_Edit_WhenNouvelleIsEditted_ShouldChangeNouvelle()
        {
            //Arrange
            var nouvelle = new Nouvelle()
            {
                Id = 0, Title = "Any_title", Text_Desc = "Any_desc"
            };
            var firstNouvelle = _mockRepo._nouvelles.First();

            //Act
            await _nouvelleController.Edit(firstNouvelle.Id, nouvelle);

            //Assert
            Assert.Equal(nouvelle.Title, firstNouvelle.Title);
            Assert.Equal(nouvelle.Text_Desc, firstNouvelle.Text_Desc);
        }
        public bool Modifier(int id, Nouvelle e)
        {
            string              contenuJson = JsonConvert.SerializeObject(e, Formatting.Indented);
            StringContent       contenu     = new StringContent(contenuJson, Encoding.UTF8, "application/json");
            HttpResponseMessage reponse     = _client.PutAsync($"Nouvelle/Modifier/{id}", contenu).Result;

            if (!reponse.IsSuccessStatusCode)
            {
                throw new Exception("Echec de la réception de données.");
            }
            var x = reponse.Content.ReadAsStringAsync().Result;

            return(bool.Parse(x));

            throw new NotImplementedException();
        }
Esempio n. 18
0
        public async void Test_Create_NewNouvelle_ShouldAddToRepoLength()
        {
            //Arrange
            var nouvelle = new Nouvelle()
            {
                Title = "Any_title", Text_Desc = "Any_desc"
            };
            var firstLength = _mockRepo._nouvelles.Count();

            //Act
            await _nouvelleController.Create(nouvelle);

            //Assert
            var secondLength = _mockRepo._nouvelles.Count();

            Assert.NotEqual(firstLength, secondLength);
        }
Esempio n. 19
0
        public void montrerNouvelle(List <Nouvelle> listeNouvelles)
        {
            // il faut partir au 7em element car les 6 premier ne sont pas des nouvelles
            Nouvelle new1 = listeNouvelles[7];

            this.nouvelle1.Text = new1.name;

            Nouvelle new2 = listeNouvelles[8];

            this.nouvelle2.Text = new2.name;

            Nouvelle new3 = listeNouvelles[9];

            this.nouvelle3.Text = new3.name;

            Nouvelle new4 = listeNouvelles[10];

            this.nouvelle4.Text = new4.name;

            Nouvelle new5 = listeNouvelles[11];

            this.nouvelle5.Text = new5.name;

            Nouvelle new6 = listeNouvelles[12];

            this.nouvelle6.Text = new6.name;

            Nouvelle new7 = listeNouvelles[13];

            this.nouvelle7.Text = new7.name;

            Nouvelle new8 = listeNouvelles[14];

            this.nouvelle8.Text = new8.name;

            Nouvelle new9 = listeNouvelles[15];

            this.nouvelle9.Text = new9.name;

            Nouvelle new10 = listeNouvelles[16];

            this.nouvelle10.Text = new10.name;

            Console.WriteLine("Nouvelles ajouter dans les TextBox");
        }
Esempio n. 20
0
        private void bt_Biens_Click(object sender, EventArgs e)
        {
            Nouvelle uc = new Nouvelle();

            uc.newBiens += (s1, e1) =>
            {
                reverse = true;
                run     = splitContainer1.Width;
                init();
                obj_biens = (Immo_Rale.Management.Biens)s1;
                annonce();
            };
            changeTab(tabPage1_Biens, uc);
            tabControl_Biens.SelectedIndex = 0;
            tabControl_Biens.Visible       = true;
            tabControl_Acheteur.Visible    = false;
            tabControl_Agent.Visible       = false;
        }
Esempio n. 21
0
    public Nouvelle newsToNouvelle(News news)
    {
        Nouvelle nouvelle = new Nouvelle();

        nouvelle.id            = news.id;
        nouvelle.cric          = news.cric;
        nouvelle.dt            = news.dt;
        nouvelle.titre         = news.title;
        nouvelle.texte         = news.text;
        nouvelle.url_texte     = news.url_text;
        nouvelle.photo         = news.photo;
        nouvelle.categorie     = news.category;
        nouvelle.tag1          = news.tag1;
        nouvelle.tag2          = news.tag2;
        nouvelle.nom_club      = news.club_name;
        nouvelle.visible       = news.visible;
        nouvelle.PhotoString64 = news.PhotoString64;
        nouvelle.urlNouvelle   = news.urlNews;
        nouvelle.type_club     = news.club_type;

        return(nouvelle);
    }
Esempio n. 22
0
        public int Creer(Nouvelle e)
        {
            NouvelleService us = new NouvelleService();

            return(us.Creer(e.VersClient()));
        }
Esempio n. 23
0
        public bool Modifier(int id, Nouvelle e)
        {
            NouvelleService us = new NouvelleService();

            return(us.Modifier(id, e.VersClient()));
        }
Esempio n. 24
0
 public NouvelleDetails(Nouvelle e)
 {
     this.description = e.description; this.titre = e.titre; this.id = e.id;
 }
Esempio n. 25
0
 public NouvelleCreation(Nouvelle e)
 {
     this.description = e.description; this.titre = e.titre; this.dateCreation = e.dateCreation; this.idCreateur = e.idCreateur;
 }