Esempio n. 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            var imageItemsList          = (List <ImageItem>)listBox1.DataSource;
            DatabaseImageOperations ops = new DatabaseImageOperations();

            ops.InsertImages(ref imageItemsList);
        }
Esempio n. 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            var location = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Images");
            List <ImageItem> imageItemsList = (
                from file in Directory.GetFiles(location)
                select new ImageItem
            {
                Name = Path.GetFileName(file),
                Bytes = File.ReadAllBytes(file),
                Description = "Inserted from code sample"
            }
                ).ToList();

            DatabaseImageOperations ops = new DatabaseImageOperations();

            ops.InsertImages(imageItemsList);
        }