예제 #1
0
        private void добавитьНовыйФорматToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Insert_format fo = new Insert_format();

            if (fo.ShowDialog() == DialogResult.OK)
            {
                Diploma.Format f = new Diploma.Format();
                bool           s = f.Add_format(fo.textBox1.Text, Convert.ToInt32(fo.numericUpDown1.Value), Convert.ToInt32(fo.numericUpDown2.Value),
                                                Program.connection_str);

                if (s)
                {
                    MessageBox.Show("Формат успешно добавлен!");
                    Load_format();
                }
                else
                {
                    int k = f.Select_format(Convert.ToInt32(fo.numericUpDown1.Value), Convert.ToInt32(fo.numericUpDown2.Value),
                                            Program.connection_str);
                    string d = f.Select_name_format(k,
                                                    Program.connection_str);
                    MessageBox.Show("Данный формат уже существует под именем " + d);
                }
            }
        }
예제 #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedRows != null)
            {
                Insert_format  i  = new Insert_format();
                int            tt = Convert.ToInt32(dataGridView1.SelectedCells[0].RowIndex);
                Diploma.Format f  = new Diploma.Format();
                int            id = Convert.ToInt32(dataGridView1[3, tt].Value);
                f = f.Select_format_id(id, Program.connection_str);
                i.textBox1.Text        = f.Name_format;
                i.numericUpDown1.Value = f.Width;
                i.numericUpDown2.Value = f.Height;
                if (i.ShowDialog() == DialogResult.OK)
                {
                    f.Update_format(f.id, i.textBox1.Text, Convert.ToInt32(i.numericUpDown2.Value), Convert.ToInt32(i.numericUpDown1.Value), Program.connection_str);
                    MessageBox.Show("Редактирование успешно!");
                }

                Load_Format();
            }
        }