Exemplo n.º 1
0
        public Enfant(Entities.Enfants enfants) : this(enfants.Dossier_ID)
        {
            CurrentChild = enfants;
            AssignChild(CurrentChild);

            // Create the ToolTip and associate with the Form container.
            ToolTip toolTip1 = new ToolTip();

            // Set up the delays for the ToolTip.
            toolTip1.AutoPopDelay = 5000;
            toolTip1.InitialDelay = 1000;
            toolTip1.ReshowDelay  = 500;
            // Force the ToolTip text to be displayed whether or not the form is active.
            toolTip1.ShowAlways = true;

            // Set up the ToolTip text for the Button and Checkbox.
            toolTip1.SetToolTip(this.pnlPicture, CurrentChild.Photo);
        }
Exemplo n.º 2
0
        private void AssignChild(Entities.Enfants enfants)
        {
            dtpNaissance.Value = enfants.Naissance.HasValue ? enfants.Naissance.Value : DateTime.Now;
            txtNom.Text        = enfants.Nom;
            txtPrenom.Text     = enfants.Prenom;
            var accueil = "";

            if (enfants.Accueil.HasValue)
            {
                accueil = enfants.Accueil.Value == true ? "Oui" : "Non";
            }
            cboStatut.Text   = accueil;
            cboSexe.Text     = enfants.Sexe;
            cboReferent.Text = enfants.Referent_ID;

            var title     = "enf";
            var path      = options.Path;
            var suffix    = CurrentDossierID + " " + title + " " + CurrentChild.Prenom;
            var jpg       = ".jpg";
            var png       = ".png";
            var finalPath = Path.Combine(path, suffix);

            if (File.Exists(finalPath + jpg))
            {
                Bitmap bmp = new Bitmap(finalPath + jpg);

                pnlPicture.BackgroundImage = bmp;
                CurrentChild.Photo         = finalPath + jpg;
            }
            else if (File.Exists(finalPath + png))
            {
                Bitmap bmp = new Bitmap(finalPath + png);

                pnlPicture.BackgroundImage = bmp;
                CurrentChild.Photo         = finalPath + png;
            }
            else if (File.Exists(CurrentChild.Photo))
            {
                Bitmap bmp = new Bitmap(CurrentChild.Photo);

                pnlPicture.BackgroundImage = bmp;
            }
        }
Exemplo n.º 3
0
        private Boolean Save()
        {
            DialogResult result;

            if (CurrentChild != null)
            {
                AssignValues();
                Connexion.connexionActionsEnfants.Update(CurrentChild);
                //Connexion.connexionActionsEnfants.ObjectContextUpdater();
                return(true);
            }

            if (string.IsNullOrWhiteSpace(txtNom.Text))
            {
                MessageBox.Show("Vous devez définir un nom pour pouvoir ajouter l'enfant",
                                "Attention",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(false);
            }

            if (string.IsNullOrWhiteSpace(txtPrenom.Text))
            {
                MessageBox.Show("Vous devez définir un prénom pour pouvoir ajouter l'enfant",
                                "Attention",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(false);
            }

            CurrentChild = new Entities.Enfants();
            AssignValues();
            Connexion.connexionActionsEnfants.Add(CurrentChild);
            //Connexion.connexionActionsEnfants.ObjectContextUpdater();

            OnChildAdded(new EventArgs());
            return(true);
        }
Exemplo n.º 4
0
 private void ChildAdded(object sender, Entities.Enfants e)
 {
     bsDataKids.Add(e);
 }