示例#1
0
 private void button_delete2_Click(object sender, EventArgs e)
 {
     if (dataGridView2.SelectedRows != null)
     {
         int tt = Convert.ToInt32(dataGridView2.SelectedCells[0].RowIndex);
         Diploma.Image_blocks f = new Diploma.Image_blocks();
         int id = Convert.ToInt32(dataGridView2[0, tt].Value);
         f.Delete_image_blocks(id, Program.connection_str);
         MessageBox.Show("Удаление  успешно!");
         Load_image_blocks();
     }
 }
示例#2
0
        public void add_image_blocks()
        {
            Add_image_blоcks f = new Add_image_blоcks();

            if (f.ShowDialog() == DialogResult.OK)
            {
                File.Copy(f.label2.Text, "Image_blocks//" + Path.GetFileName(f.label2.Text), true);
                Diploma.Image_blocks i = new Diploma.Image_blocks();
                i.Add_image_blocks(f.textBox1.Text, Path.GetFileName(f.label2.Text), Convert.ToInt32(f.numericUpDown1.Value),
                                   Convert.ToInt32(f.numericUpDown2.Value), Convert.ToInt32(f.numericUpDown3.Value),
                                   Convert.ToInt32(f.numericUpDown4.Value), Program.Maquette_id, Program.connection_str);
                MessageBox.Show("Успешно добавлен!");
            }
            Load_image_blocks();
        }
示例#3
0
        public void Load_image_blocks()
        {
            dataGridView2.RowCount    = 1;
            dataGridView2[0, 0].Value = "";
            dataGridView2[1, 0].Value = "";
            Diploma.Image_blocks        f  = new Diploma.Image_blocks();
            List <Diploma.Image_blocks> tb = f.Select_image_blocks(Program.connection_str, Program.Maquette_id);

            if (tb.Count != 0)
            {
                dataGridView2.RowCount = tb.Count;
                for (int i = 0; i < tb.Count; i++)
                {
                    dataGridView2[0, i].Value = tb[i].id;
                    dataGridView2[1, i].Value = tb[i].Name_blocks;
                }
            }
        }
示例#4
0
        private void button_update2_Click(object sender, EventArgs e)
        {
            if (dataGridView2.SelectedRows != null)
            {
                Add_image_blоcks i     = new Add_image_blоcks();
                int tt                 = Convert.ToInt32(dataGridView2.SelectedCells[0].RowIndex);
                Diploma.Image_blocks f = new Diploma.Image_blocks();
                int id                 = Convert.ToInt32(dataGridView2[0, tt].Value);
                f = f.Select_image_blocks_id(id, Program.connection_str);
                i.textBox1.Text        = f.Name_blocks;
                i.numericUpDown1.Value = f.X;
                i.numericUpDown2.Value = f.Y;
                i.numericUpDown3.Value = f.Height;
                i.numericUpDown4.Value = f.Width;
                i.label2.Text          = f.Image_content;
                i.pictureBox1.Load("Image_blocks//" + f.Image_content);

                if (i.ShowDialog() == DialogResult.OK)
                {
                    try
                    {
                        File.Copy(i.label2.Text, "Image_blocks//" + Path.GetFileName(i.label2.Text));
                    }
                    catch
                    {
                    }
                    f.Update_image_blocks(f.id, i.textBox1.Text, Path.GetFileName(i.label2.Text),
                                          Convert.ToInt32(i.numericUpDown1.Value),
                                          Convert.ToInt32(i.numericUpDown2.Value), Convert.ToInt32(i.numericUpDown3.Value),
                                          Convert.ToInt32(i.numericUpDown4.Value), Program.connection_str);
                    MessageBox.Show("Редактирование успешно!");
                }

                Load_image_blocks();
            }
        }