Пример #1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var         item  = (sender as FrameworkElement).DataContext;
            int         index = ListViewUtilisateurs.Items.IndexOf(item);
            DataRowView row   = ListViewUtilisateurs.Items.GetItemAt(index) as DataRowView;



            ConfirmForm c = new ConfirmForm("Cette Dépense Sera Définitivement Supprimée, Voulez Vous Vraiment Continuer?");

            c.Owner      = dade;
            dade.Opacity = 0.5;
            dade.Effect  = new BlurEffect();
            if ((bool)c.ShowDialog())
            {
                cn.Open();
                cmd.Connection  = cn;
                cmd.CommandText = "delete from Depenses where IdDep = '" + row.Row[0].ToString() + "'";
                cmd.ExecuteNonQuery();
                cn.Close();

                messageContent.Text = "Bien Supprimée";
                animateBorder(borderMessage);

                BtnAjouter.Content   = "Ajouter";
                DepensesTextBox.Text = null;
                DateTimePicker.Text  = null;
                PrixTextBox.Text     = null;
                ListViewUtilisateurs.UnselectAll();
                loaded();
            }
            dade.Opacity = 1;
            dade.Effect  = null;
        }
        private void BtnRemove_Click(object sender, RoutedEventArgs e)
        {
            var         item  = (sender as FrameworkElement).DataContext;
            int         index = ListPayments.Items.IndexOf(item);
            DataRowView row   = ListPayments.Items.GetItemAt(index) as DataRowView;



            ConfirmForm c = new ConfirmForm("Cette Dépense Sera Définitivement Supprimée, Voulez Vous Vraiment Continuer?");

            c.Owner      = this;
            this.Opacity = 0.5;
            this.Effect  = new BlurEffect();
            if ((bool)c.ShowDialog())
            {
                cn.Open();
                cmd.Connection  = cn;
                cmd.CommandText = "delete from Payments where IdPayment = '" + row.Row[0].ToString() + "'";
                cmd.ExecuteNonQuery();
                cn.Close();

                messageContent.Text = "Paiement Bien Supprimée";
                animateBorder(borderMessage);

                ajouter.Content  = "Ajouter";
                NomTextBox.Text  = null;
                PrixTextBox.Text = null;
                ListPayments.UnselectAll();
                loaded();
            }
            coutItems();
            this.Opacity = 1;
            this.Effect  = null;
        }
Пример #3
0
        private void SupprimerClientModalBtn_Click(object sender, RoutedEventArgs e)
        {
            int         index = ListClient.SelectedIndex;
            DataRowView row   = ListClient.Items.GetItemAt(index) as DataRowView;
            int         id    = int.Parse(row.Row[0].ToString());

            ConfirmForm c = new ConfirmForm("Tout Paiement Lié À Ce Client Sera Supprimé, Voulez Vous Vraiment Continuer?");

            c.Owner      = dade;
            dade.Opacity = 0.5;
            dade.Effect  = new BlurEffect();
            if ((bool)c.ShowDialog())
            {
                cn.Open();
                cmd.Connection  = cn;
                cmd.CommandText = "delete from Clients where IdClient = '" + id + "'";
                cmd.ExecuteNonQuery();
                cn.Close();

                messageContent.Text = "Client Bien Supprimé";
                animateBorder(borderMessage);

                loaded();
            }
            dade.Opacity = 1;
            dade.Effect  = null;
        }
Пример #4
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var         item  = (sender as FrameworkElement).DataContext;
            int         index = ListViewSports.Items.IndexOf(item);
            DataRowView row   = ListViewSports.Items.GetItemAt(index) as DataRowView;



            ConfirmForm c = new ConfirmForm("Tout Utilisateur Ou Client Lié à Cet Sport Sera Supprimé, Voulez Vous Vraiment Continuer?");

            c.Owner      = dade;
            dade.Opacity = 0.5;
            dade.Effect  = new BlurEffect();
            if (ConnectedSport == row.Row[0].ToString())
            {
                messageContent.Text = "Vous Ne Pouvez Pas Supprimer Le Sport De Salle Connecté";
                animateBorder(borderMessage);
            }
            else
            {
                if ((bool)c.ShowDialog())
                {
                    cn.Open();
                    cmd.Connection = cn;

                    cmd.CommandText = "delete from Utilisateur where IdUser in (select u.IdUser from Utilisateur u join UtilisateurSportSalle us on u.IdUser = us.IdUser where us.IdType = '" + row.Row[0].ToString() + "')";
                    cmd.ExecuteNonQuery();

                    cmd.CommandText = "delete from Type_Sport where IdType = '" + row.Row[0].ToString() + "'";
                    cmd.ExecuteNonQuery();
                    cn.Close();

                    messageContent.Text = "Bien supprimé";
                    animateBorder(borderMessage);

                    BtnAjouter.Content           = "Ajouter";
                    SportName.Text               = null;
                    SportPrix.Text               = null;
                    SallesComboBox.SelectedIndex = -1;
                    ListViewSports.UnselectAll();
                    loaded();
                }
            }

            dade.Opacity = 1;
            dade.Effect  = null;
        }
Пример #5
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var         item  = (sender as FrameworkElement).DataContext;
            int         index = ListViewUtilisateurs.Items.IndexOf(item);
            DataRowView row   = ListViewUtilisateurs.Items.GetItemAt(index) as DataRowView;


            ConfirmForm c = new ConfirmForm("Cet Utilisateur Sera Définitivement Supprimé, Voulez-Vous Vraiment Continuer?");

            c.Owner      = dade;
            dade.Opacity = 0.5;
            dade.Effect  = new BlurEffect();
            if (iduser == row.Row[0].ToString())
            {
                messageContent.Text = "Vous Ne Pouvez Pas Supprimé L'utilisateur Connecté";
                animateBorder(borderMessage);
            }
            else
            {
                if ((bool)c.ShowDialog())
                {
                    cn.Open();
                    cmd.Connection  = cn;
                    cmd.CommandText = "delete from Utilisateur where IdUser = '******'";
                    cmd.ExecuteNonQuery();
                    cn.Close();

                    messageContent.Text = "Utilisateur Bien Supprimé";
                    animateBorder(borderMessage);

                    BtnAjouter.Content           = "Ajouter";
                    NomTextBox.Text              = null;
                    PrenomTextBox.Text           = null;
                    UserNameTextBox.Text         = null;
                    PassTextBox.Text             = null;
                    SportsComboBox.SelectedIndex = -1;
                    ch1.IsChecked = false;
                    ch2.IsChecked = false;
                    ListViewUtilisateurs.UnselectAll();
                    loaded();
                }
            }
            dade.Opacity = 1;
            dade.Effect  = null;
        }