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();
            }
        }
        Entities.TypeDocument GetDataFromInterface()
        {
            Entities.TypeDocument d = new Entities.TypeDocument();
            d.Code      = txtCode.Text;
            d.LibelleFr = txtIntitule.Text;
            d.LibelleAr = txtIntitule1.Text;

            return(d);
        }
        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);
            }
        }
Ejemplo n.º 4
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";
        }
 void BindDataToTheInterface(Entities.TypeDocument d)
 {
     txtCode.Text      = d.Code.Trim();
     txtIntitule.Text  = d.LibelleFr.Trim();
     txtIntitule1.Text = d.LibelleAr.Trim();
 }