Exemple #1
0
        public ContactEditForm(ContactsListForm owner, bool update, int id = 0)
        {
            _owner            = owner;
            _id               = id;
            contactUpdateMode = update;
            FormClosed       += new FormClosedEventHandler(ContactEditForm_FormClosed);

            InitializeComponent();

            /* Combobox Catégories */
            var dsCategorie = new List <CategorieContact>();
            CategorieContact categorieVide = new CategorieContact();

            categorieVide.Nom = "";
            dsCategorie.Add(categorieVide);
            foreach (CategorieContact categorie in utils.AllCategoriesContactsActives())
            {
                if (categorie.Actif == true)
                {
                    dsCategorie.Add(categorie);
                }
            }
            CbxType.DataSource    = dsCategorie;
            CbxType.DisplayMember = "FullName";
            CbxType.ValueMember   = "FullName";

            /* Combobox Pays */
            var  dsPays   = new List <Pays>();
            Pays paysVide = new Pays();

            paysVide.Nom = "";
            dsPays.Add(paysVide);
            foreach (Pays pays in utils.AllPaysActives())
            {
                if (pays.Actif == true)
                {
                    dsPays.Add(pays);
                }
            }
            CbxPays.DataSource    = dsPays;
            CbxPays.DisplayMember = "FullName";
            CbxPays.ValueMember   = "FullName";

            switch (contactUpdateMode)
            {
            /* Mode création */
            case false:
                NewContact();
                break;

            /* Mode mise à jour */
            case true:
                LoadContact();
                break;
            }
        }
Exemple #2
0
 private void OuvreAnnuaire()
 {
     if (Application.OpenForms["ContactsListForm"] == null)
     {
         if (contactsListForm.IsDisposed == true)
         {
             ContactsListForm contactsListForm = new ContactsListForm();
             contactsListForm.MdiParent = this;
             contactsListForm.Show();
             this.LayoutMdi(MdiLayout.TileHorizontal);
         }
         else
         {
             contactsListForm.MdiParent = this;
             contactsListForm.Show();
             this.LayoutMdi(MdiLayout.TileHorizontal);
         }
     }
     else
     {
         contactsListForm.Activate();
     }
 }