private void panelEnregistrer_Click(object sender, EventArgs e)
        {
            bool res;

            res = ExistErreur();
            Entities.TypeDocument D = new Entities.TypeDocument();
            D = GetDataFromInterface();
            DAL.DALTypeDocument D1 = new DAL.DALTypeDocument();
            int nb = D1.ChechkKeyUnicity(D.Code);

            if (res == true)
            {
                AfficherErreurFr();
            }
            else
            {
                if (type == 1)   //ajout
                {
                    if (nb == 0) //n'existe pas
                    {
                        D1.InsertTypeDocumente(D);
                    }
                    else//existe
                    {
                        MessageBox.Show("Ce code existe déjà veuillez vérifier");
                    }
                }
                else// modif
                {
                    D1.UpdateTypeDocumente(id1, D);
                }
                this.Close();
            }
        }
Beispiel #2
0
        public void RaffraichirGrid()
        {
            DGVTypeDocument.Rows.Clear();
            DAL.DALTypeDocument D = new DAL.DALTypeDocument();
            dt = D.SelectAllTypeDocument();
            int taille = dt.Rows.Count;

            if (taille > 0)
            {
                for (int i = 0; i < taille; i++)
                {
                    DGVTypeDocument.Rows.Add(dt.Rows[i][1].ToString().Trim(), dt.Rows[i][2].ToString().Trim(), dt.Rows[i][3].ToString().Trim());
                }
            }
        }
        public FormTypeDocument(int type1, int id)
        {
            InitializeComponent();

            type = type1;
            id1  = id;
            CacherErreurFr();
            if (id != 0)
            {
                Entities.TypeDocument C1 = new Entities.TypeDocument();
                DAL.DALTypeDocument   D  = new DAL.DALTypeDocument();
                C1 = D.SelectById(id);
                BindDataToTheInterface(C1);
            }
        }
Beispiel #4
0
 private void btnSupprimer_Click(object sender, EventArgs e)
 {
     if (DGVTypeDocument.Rows.Count > 0)
     {
         int x1 = DGVTypeDocument.CurrentRow.Index;
         int id = int.Parse(dt.Rows[x1][0].ToString());
         DAL.DALTypeDocument D = new DAL.DALTypeDocument();
         int x = D.ChechkUsing(id);
         if (x == 0)
         {
             string DeleteTypeDocumentMsg = "Vous êtes sur le point de supprimer un Type Document.";
             DeleteTypeDocumentMsg += " Cliquez sur OK pour confirmer la suppression ou sur Annuler dans le cas contraire !!! ";
             DialogResult DeleteTypeDocumentDecision;
             DeleteTypeDocumentDecision = MessageBox.Show(DeleteTypeDocumentMsg, "Suppression d'un Type Document", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
             if (DeleteTypeDocumentDecision == DialogResult.OK)
             {
                 try
                 {
                     try
                     {
                         D.DeleteTypeDocumente(id);
                         RaffraichirGrid();
                     }
                     catch (Exception a)
                     {
                         MessageBox.Show(a.Message, "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                     }
                 }
                 catch (Exception a)
                 {
                     MessageBox.Show(a.Message, "Erreur de suppression", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             }
         }
         else
         {
             MessageBox.Show("Suppression impossible");
         }
     }
     else
     {
         MessageBox.Show("Aucun département sélectionnée!!");
     }
 }
        public GestionDocument(int id1, int mode1)
        {
            InitializeComponent();
            ID   = id1;
            MODE = mode1;

            if (MODE != 0)
            {
                panelModifDoc.Visible = true;
                button1.Enabled       = false;
                txtDocument.Enabled   = false;
                //int x = DGVDocument.CurrentRow.Index;
                //int IdDoc = int.Parse(dt.Rows[x][0].ToString());
                //DataTable dt1 = new DataTable();
                //DAL.DALDocuments d = new DAL.DALDocuments();
                //dt1 = d.SelectDocumentById(IdDoc);
                //cmbTypeDocument.SelectedValue = int.Parse(dt1.Rows[0][3].ToString());
                //txtNomFr.Text = dt1.Rows[0][4].ToString().Trim();
                //txtNomAr.Text = dt1.Rows[0][5].ToString().Trim();
                //txtCommentaire.Text = dt1.Rows[0][6].ToString().Trim();
                //txtDocument.Text = dt1.Rows[0][7].ToString().Trim();
            }

            else
            {
                panelModifDoc.Visible         = true;
                button1.Enabled               = true;
                txtDocument.Enabled           = true;
                cmbTypeDocument.SelectedIndex = -1;
                txtNomFr.Text       = "";
                txtNomAr.Text       = "";
                txtCommentaire.Text = "";
                txtDocument.Text    = "";
            }

            DataTable dt287 = new DataTable();

            DAL.DALTypeDocument t = new DAL.DALTypeDocument();
            dt287 = t.SelectAllTypeDocument();
            cmbTypeDocument.DataSource    = dt287;
            cmbTypeDocument.ValueMember   = "IdTypeDocument";
            cmbTypeDocument.DisplayMember = "Code";
        }
Beispiel #6
0
        //private void labelDocuments_Click(object sender, EventArgs e)
        //{
        //    GestionDocument frm = new GestionDocument(id);
        //   frm.ShowDialog();
        //}

        //000////document/////////

        public void RaffraichirGridDoc()
        {
            mode = 0;
            DAL.DALDocuments d = new DAL.DALDocuments();
            dt = d.SelectAllDocument(id);
            DGVDocument.Rows.Clear();

            DAL.DALTypeDocument   TDOC = new DAL.DALTypeDocument();
            Entities.TypeDocument doc  = new Entities.TypeDocument();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                doc = TDOC.SelectById(int.Parse(dt.Rows[i][2].ToString()));
                DGVDocument.Rows.Add(doc.LibelleFr.Trim(), dt.Rows[i][4].ToString().Trim(), "Voir");
            }

            DataTable dt200 = new DataTable();

            DAL.DALTypeDocument t = new DAL.DALTypeDocument();
            //dt200 = t.SelectAllTypeDocument();
            //cmbTypeDocument.DataSource = dt1;
            //cmbTypeDocument.ValueMember = "IdTypeDocument";
            //cmbTypeDocument.DisplayMember = "Code";
        }