コード例 #1
0
ファイル: Main.cs プロジェクト: DoykFilt/dotsharp
        private void supprimerLarticleToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Articles article = new Articles();

            article.RefArticle = listView.Items[listView.SelectedIndices[0]].Text;

            DialogResult dr = MessageBox.Show("Voulez vous supprimer l'article " + article.RefArticle + " ? ", "Suppression article", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);

            if (dr == DialogResult.Yes)
            {
                article.deleteFromDB();
                listView.Items.Remove(listView.Items[listView.SelectedIndices[0]]);
                listView.Refresh();
            }
        }
コード例 #2
0
        public AddOrModifyArticle(Articles Article = null)
        {
            InitializeComponent();
            article = Article;
            updateComboMarque();
            updateComboFamille();

            if (article != null)
            {
                article              = Article;
                Text                 = "Modification d'un article";
                textBoxRef.Text      = article.RefArticle;
                textBoxRef.Enabled   = false;
                textBoxDescrip.Text  = article.Description;
                numericUpDown1.Value = (decimal)article.PrixHT;
                numericUpDown2.Value = article.Quantite;
            }
            else
            {
                Text = "Ajout d'un article";
            }
        }
コード例 #3
0
ファイル: Main.cs プロジェクト: DoykFilt/dotsharp
        private void listView_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                modificationArticle();
            }
            else if (e.KeyCode == Keys.Delete)
            {
                Articles article = new Articles();
                article.RefArticle = listView.Items[listView.SelectedIndices[0]].Text;

                DialogResult dr = MessageBox.Show("Voulez vous supprimer l'article " + article.RefArticle + " ? ", "Suppression article", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
                if (dr == DialogResult.Yes)
                {
                    article.deleteFromDB();
                    listView.Items.Remove(listView.Items[listView.SelectedIndices[0]]);
                    listView.Refresh();
                }
            }
            else if (e.KeyCode == Keys.F5)
            {
                refreshListView();
            }
        }