Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            DataFormDTO d = new DataFormDTO(this, dto.mainForm, dto.db,
                                            dto.userIdentity, dto.userData);

            TransmissionOperation form = new TransmissionOperation(d, FormUsage.Create, null);

            form.Show();
        }
Beispiel #2
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            int id = Convert.ToInt32(dataGridView1.CurrentRow.Cells["transmissionIdDataGridViewTextBoxColumn"].Value);

            ViewTransmissionCar t = dto.db.ViewTransmissionCars.SingleOrDefault(o => o.transmissionId == id);

            // update
            if (e.ColumnIndex == 4)
            {
                // в след. форму
                DataFormDTO d = new DataFormDTO(this, dto.mainForm, dto.db,
                                                dto.userIdentity, dto.userData);

                TransmissionOperation form = new TransmissionOperation(d, FormUsage.Update, t);
                form.Show();
            }

            // delete == 3
            if (e.ColumnIndex == 5)
            {
                // Запрашиваем подтверждение
                string message = "Точно хотите удалить?";
                string caption = "Y/n";
                var    result  = MessageBox.Show(message, caption,
                                                 MessageBoxButtons.YesNo,
                                                 MessageBoxIcon.Question);
                if (result == DialogResult.Yes)
                {
                    // deleting
                    if (crud.delete(t))
                    {
                        MessageBox.Show("Трансмиссия удалена!");
                        resetData();
                    }
                    else
                    {
                        MessageBox.Show("Что-то не так!!!");
                    }
                }
            }
        }
 public PickTransmission(TransmissionOperation caller, DbAppContext db)
 {
     this.db     = db;
     this.caller = caller;
     InitializeComponent();
 }