Ejemplo n.º 1
0
        /// <summary>
        /// Loads the projets.
        /// </summary>
        private void LoadProjets()
        {
            using (var context = new AVosSouhaits.AVSouhaitsDBEntities())
            {
                // Query for all blogs with names starting with B
                var projet = (from b in context.Projets
                              orderby b.DateDuMariage
                              select b).ToList();

                ObservableCollection<ProjetAmelio> projs2 = new ObservableCollection<ProjetAmelio>();

                projet.ForEach(x => projs2.Add(new ProjetAmelio(x)));

                this.SetValue(ProjetsPage.DataListProperty, projs2);
            }
        }
Ejemplo n.º 2
0
        public NewComposant(int idComposant)
        {
            InitializeComponent();

            if (idComposant > -1)
            {
                using (var context = new AVosSouhaits.AVSouhaitsDBEntities())
                {
                    // Query for all blogs with names starting with B
                    var composant = (from b in context.Composants
                                  where b.IdComposant == idComposant
                                  select b).FirstOrDefault();

                    LayoutRoot.DataContext = composant;
                }
            }
        }
Ejemplo n.º 3
0
        public NewProject(int idProjet)
        {
            this.InitializeComponent();

            expand.Visibility = System.Windows.Visibility.Visible;

            if (idProjet > -1)
            {
                using (var context = new AVosSouhaits.AVSouhaitsDBEntities())
                {
                    // Query for all blogs with names starting with B
                    var projet = (from b in context.Projets
                                  where b.IdProjet == idProjet
                                  select b).FirstOrDefault();

                    LayoutRoot.DataContext = new ProjetAmelio(projet);
                }
            }
            else
            {
                expand.IsExpanded = true;
                LayoutRoot.DataContext = new ProjetAmelio();
            }
        }
Ejemplo n.º 4
0
        private void Button_save_Click(object sender, RoutedEventArgs e)
        {
            //string saveFolderpath = @".\ContactImages\";

            string filepath = tbPathImage.Text;

            //FileInfo fi = new FileInfo(filepath);

            //string finename = Guid.NewGuid().ToString() + fi.Extension;

            //if (!Directory.Exists(saveFolderpath))
            //{
            //    Directory.CreateDirectory(saveFolderpath);
            //}

            //System.IO.File.Copy(filepath, saveFolderpath + finename, true);

            imgSrc.Source = null;

            using (var context = new AVosSouhaits.AVSouhaitsDBEntities())
            {
                Composant compo = new Composant();

                //if (idProjet.Text != string.Empty)
                //{
                //    long idProj = long.Parse(idProjet.Text);

                //    projet = (from b in context.Projets
                //              where b.IdProjet == idProj
                //              select b).FirstOrDefault();
                //}
                //else
                //{
                context.Composants.Add(compo);
                //}

                compo.Nom = tbName.Text;
                compo.Note = tbNote.Text;
                compo.UrlPhoto = "urlPicture";
                compo.Image = ConvertImage(filepath);
                context.SaveChanges();
            }
        }
Ejemplo n.º 5
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Projet projet = new Projet();

            using (var context = new AVosSouhaits.AVSouhaitsDBEntities())
            {
                if (idProjet.Text != string.Empty)
                {
                    long idProj = long.Parse(idProjet.Text);

                    projet = (from b in context.Projets
                              where b.IdProjet == idProj
                              select b).FirstOrDefault();
                }
                else
                {
                    context.Projets.Add(projet);
                }

                projet.Civilite1 = long.Parse(CbCivi1.SelectedValue.ToString());
                projet.Nom1 = nom1.Text;
                projet.Prenom1 = prenom1.Text;
                projet.Civilite2 = long.Parse(CbCivi2.SelectedValue.ToString());
                projet.Nom2 = nom2.Text;
                projet.Prenom2 = prenom2.Text;
                projet.Telephone = telephone.Text;
                projet.Ville = ville.Text;
                projet.Email = email.Text;
                projet.Adresse = adresse.Text;
                projet.CodePostal = codepostal.Text;
                projet.Budget = long.Parse(budget.Text);
                projet.DateDuMariage = DateTime.Parse(dateDuMarriage.Text);

                context.SaveChanges();
            }

            expand.IsExpanded = false;
        }
        /// <summary>
        /// Loads the composants.
        /// </summary>
        private void LoadComposants()
        {
            using (var context = new AVosSouhaits.AVSouhaitsDBEntities())
            {
                DateTime now = DateTime.Now;

                ObservableCollection<LineOfComponent> linesOfComponent = new ObservableCollection<LineOfComponent>();

                // Query for all blogs with names starting with B
                var compos = (from b in context.Composants
                              orderby b.Nom
                              select b).ToList();

                Parallel.For(0, compos.Count / 4, i =>
                    {
                        int value = i * 4;

                        LineOfComponent line = new LineOfComponent();

                        line.compo1 = compos[value];

                        if (value + 1 < compos.Count)
                        {
                            line.compo2 = compos[value + 1];
                        }

                        if (value + 2 < compos.Count)
                        {
                            line.compo3 = compos[value + 2];
                        }

                        if (value + 3 < compos.Count)
                        {
                            line.compo4 = compos[value + 3];
                        }

                        linesOfComponent.Add(line);
                    });

                TimeSpan ts = DateTime.Now - now;

                this.SetValue(Administration.DataListProperty, linesOfComponent);
            }
        }