Example #1
0
 private void AddToFavoris(object sender, RoutedEventArgs e)
 {
     if (!UserConnected.VerifyHabilitation("100_1xFVS"))
     {
         MessageHabilitation.MessageNoHabilitatePersonnalized("ajouter un élément à vos favoris !");
     }
     else
     {
         Favoris isFavoris = dataUtils.GetListFavoris().Find(x =>
                                                             (x.IdTarget == ec.Id) &&
                                                             (x.IdUser == UserConnected.GetUserConnected().Id) &&
                                                             (x.TypeTarget.Equals("ExtraitCode"))
                                                             );
         if (isFavoris != null)
         {
             dataUtils.RemoveFavoris(ec.Id, "ExtraitCode", UserConnected.GetUserConnected().Id);
             this.FavorisExtraitCodeIcon.Icon = FontAwesome.WPF.FontAwesomeIcon.HeartOutline;
         }
         else
         {
             dataUtils.AddFavoris(ec.Id, "ExtraitCode", UserConnected.GetUserConnected().Id);
             this.FavorisExtraitCodeIcon.Icon = FontAwesome.WPF.FontAwesomeIcon.Heart;
         }
     }
 }
Example #2
0
 private void ConfirmVote(int note)
 {
     if (!UserConnected.VerifyHabilitation("100_5xCD0"))
     {
         MessageHabilitation.MessageNoHabilitatePersonnalized("à noter un extrait de code !");
     }
     else
     {
         Vote ExistingVote = dataUtils.GetListVote().Find(x =>
                                                          (x.IdTarget == ec.Id) &&
                                                          (x.TypeTarget.Equals("ExtraitCode")) &&
                                                          (x.IdVoter == UserConnected.GetUserConnected().Id)
                                                          );
         if (ExistingVote == null)
         {
             dataUtils.AddVote(ec.Id, "ExtraitCode", UserConnected.GetUserConnected().Id, note);
         }
         else
         {
             ExistingVote.Note = note;
         }
         ec.CalculNote();
         this.ExtraitCode_Note.Text = ec.Note.ToString();
         DisplayTotalVote(dataUtils.GetListVote().Where(x => (x.IdTarget == ec.Id) && (x.TypeTarget.Equals("ExtraitCode"))).ToList().Count);
     }
 }
 private void AddNewConversation(object sender, RoutedEventArgs e)
 {
     if (!UserConnected.VerifyHabilitation("100_4xCVN"))
     {
         MessageHabilitation.MessageNoHabilitatePersonnalized("créer une nouvelle conversation !");
     }
     else
     {
         this.Body_Conversation.Children.Clear();
         this.Body_Conversation.Children.Add(new AddChat());
     }
 }
 private void ClickNewExtraitCode(object sender, MouseButtonEventArgs e)
 {
     if (!UserConnected.VerifyHabilitation("100_1xCD0"))
     {
         MessageHabilitation.MessageNoHabilitatePersonnalized("créer un nouvel extrait de code !");
     }
     else
     {
         this.Body_Extrait.Children.Remove(NoExtraitText);
         this.Body_Extrait.Children.Add(new AddExtraitCode());
     }
 }
Example #5
0
 private void SendComment(object sender, MouseButtonEventArgs e)
 {
     if (!UserConnected.VerifyHabilitation("100_1xCMT"))
     {
         MessageHabilitation.MessageNoHabilitatePersonnalized("ajouter un commentaire !");
     }
     else
     {
         if (this.AddComment.Text.Equals("") || this.AddComment.Text.Equals("Écrire un commentaire..."))
         {
             MessageBox.Show("Veuillez écrire un commentaire !", "Espi Community", MessageBoxButton.OK, MessageBoxImage.Error);
         }
         else
         {
             DateTime fullDate = DateTime.Now;
             String   date     = (fullDate.Day < 10 ? "0" + fullDate.Day.ToString() : fullDate.Day.ToString()) + "/" +
                                 (fullDate.Month < 10 ? "0" + fullDate.Month.ToString() : fullDate.Month.ToString()) + "/" +
                                 fullDate.Year.ToString();
             String hour = (fullDate.Hour < 10 ? "0" + fullDate.Hour.ToString() : fullDate.Hour.ToString()) + ":" +
                           (fullDate.Minute < 10 ? "0" + fullDate.Minute.ToString() : fullDate.Minute.ToString()) + ":" +
                           (fullDate.Second < 10 ? "0" + fullDate.Second.ToString() : fullDate.Second.ToString());
             String dateComment = date + " " + hour;
             if ((this.TextBlock_ReponseName.Text != null || !this.TextBlock_ReponseName.Text.Equals("")) &&
                 this.TextBlock_Reponse.Visibility == Visibility.Collapsed && this.TextBlock_ReponseName.Visibility == Visibility.Collapsed)
             {
                 dataUtils.AddComment(
                     UserConnected.GetUserConnected().Id,
                     UserConnected.GetUserConnected().Nom,
                     UserConnected.GetUserConnected().Prenom,
                     ec.Id,
                     "ExtraitCode",
                     this.AddComment.Text,
                     dateComment
                     );
             }
             else
             {
                 dataUtils.AddComment(
                     UserConnected.GetUserConnected().Id,
                     UserConnected.GetUserConnected().Nom,
                     UserConnected.GetUserConnected().Prenom,
                     IdCommentToResponse,
                     "Comment",
                     this.AddComment.Text,
                     dateComment
                     );
             }
             this.AddComment.Text = "Écrire un commentaire...";
             OrganizeListComment();
             this.ListComments.ItemsSource = _listItemComment;
         }
     }
 }
Example #6
0
 private void ApprouveExtraitCode(object sender, MouseButtonEventArgs e)
 {
     if (!UserConnected.VerifyHabilitation("100_6xCD0"))
     {
         MessageHabilitation.MessageNoHabilitatePersonnalized("approuver l'extrait de code !");
     }
     else
     {
         if (_listApprouvedUser.Contains(UserConnected.GetUserConnected()))
         {
             _listApprouvedUser.Remove(UserConnected.GetUserConnected());
         }
     }
 }
Example #7
0
 private void DeleteExtraitCode(object sender, RoutedEventArgs e)
 {
     if (!UserConnected.VerifyHabilitation("100_4xCD0"))
     {
         MessageHabilitation.MessageNoHabilitatePersonnalized("supprimer l'extrait de code !");
     }
     else
     {
         dataUtils.RemoveExtraitCode(ec.Id);
         TextBlock NoExtraitText = new TextBlock
         {
             Text                = "Aucun extrait à afficher...",
             Foreground          = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#515151")),
             VerticalAlignment   = VerticalAlignment.Center,
             HorizontalAlignment = HorizontalAlignment.Center,
             Name                = "NoExtraitText"
         };
         ((ListView)((Grid)((Grid)((Grid)this.Parent).Parent).Children[0]).Children[3]).ItemsSource = dataUtils.GetListExtraitsCode().Cast <ExtraitCode>().OrderBy(x => x.Date_Creation).ToList();
         ((Grid)this.Parent).Children.Add(NoExtraitText);
         ((Grid)this.Parent).Children.Remove(this);
     }
 }
Example #8
0
 private void DeleteConversation(object sender, MouseButtonEventArgs e)
 {
     if (!UserConnected.VerifyHabilitation("100_4xCVN"))
     {
         MessageHabilitation.MessageNoHabilitatePersonnalized("supprimer la conversation !");
     }
     else
     {
         dataUtils.DeleteMessages(dataUtils.GetMessagesOfConversation(conv.Id));
         dataUtils.DeleteConversation(conv.Id);
         TextBlock NoChatText = new TextBlock
         {
             Text                = "Aucun message à afficher...",
             Foreground          = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#515151")),
             VerticalAlignment   = VerticalAlignment.Center,
             HorizontalAlignment = HorizontalAlignment.Center,
             Name                = "NoChatText"
         };
         ReOrganiseLastMessageInContactList();
         ((Grid)this.Parent).Children.Add(NoChatText);
         ((Grid)this.Parent).Children.Remove(this);
     }
 }
Example #9
0
        private void ChangePage(object sender, RoutedEventArgs e)
        {
            string tagUid = String.Empty;

            if (e.Source is ImageAwesome awesome)
            {
                tagUid = awesome.Tag.ToString();
            }
            else if (e.Source is TextBlock block)
            {
                tagUid = block.Tag.ToString();
            }

            switch (tagUid)
            {
            case "PageProfil":
                ContentArea.Content = new Profil.Profil();
                break;

            case "PageAccueil":

                break;

            case "PageMessagerie":
                ContentArea.Content = new MessagerieHome();
                break;

            case "PageAide":
                ContentArea.Content = new Aide();
                break;

            case "PageDocumentation":
                ContentArea.Content = new Communaute.Documentation.Doc();
                break;

            case "PageCode":
                ContentArea.Content = new ExtraitCodeHome();
                break;

            case "PageIdees":

                break;

            case "PageIDEs":

                break;

            case "PageRecherche":

                break;

            case "PageFavoris":

                break;

            case "PageAdministration":
                List <int> idRoles = UserConnected.GetUserConnected().GetIdRoles();
                if (idRoles.Contains(5) || idRoles.Contains(4) || idRoles.Contains(3) || idRoles.Contains(2) || idRoles.Contains(1))
                {
                    if (UserConnected.VerifyHabilitations())
                    {
                        ContentArea.Content = new Administration.Administration();
                    }
                    else
                    {
                        MessageHabilitation.MessageNoHabilitate();
                    }
                }
                else
                {
                    MessageHabilitation.MessageNoHabilitate();
                }
                break;

            case "PageParametres":

                break;
            }
        }