private void button3_Click_1(object sender, EventArgs e) { if (dataAll.SelectedRows.Count == 0) { return; } switch (table) { case Tables.Movie: Movie movie = dataAll.SelectedRows[0].DataBoundItem as Movie; // вытаскиваем фильм из таблицы if (movie == null) { return; } Forms.AddMovie editMovie = new Forms.AddMovie(movie); editMovie.Show(); break; case Tables.Client: FormsClient.EditClient editClient = new FormsClient.EditClient(); editClient.Show(); break; case Tables.Employee: EditEmployee.editEmployee = true; AddEmployee addEmployee = new AddEmployee(); int idEmployee = Convert.ToInt16(dataAll[0, dataAll.CurrentCell.RowIndex].Value); EditEmployee.idEmployee = idEmployee; addEmployee.Show(); break; case Tables.Disk: EditMovieDisk.check = true; int idDisk = Convert.ToInt16(dataAll[0, dataAll.CurrentCell.RowIndex].Value); Disk disk = My.Disks.Where(k => k.Id == idDisk).FirstOrDefault(); EditMovieDisk.disk = disk; Forms.AddDisk addDIsk = new Forms.AddDisk(); addDIsk.Show(); break; default: DialogResult result = MessageBox.Show( "В процессе разработки!", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification); break; } }
private void button1_Click(object sender, EventArgs e) { switch (table) { case Tables.Movie: Forms.AddMovie addMovie = new Forms.AddMovie(null); addMovie.Show(); break; case Tables.Disk: Forms.AddDisk addDisk = new Forms.AddDisk(); addDisk.Show(); break; case Tables.Client: FormsClient.AddClient addClient = new FormsClient.AddClient(); addClient.Show(); break; case Tables.Employee: EditEmployee.editEmployee = false; AddEmployee formEmployee = new AddEmployee(); formEmployee.Show(); break; case Tables.Order: FormsOrder.AddOrder addOrder = new FormsOrder.AddOrder(); addOrder.Show(); break; default: DialogResult result = MessageBox.Show( "В процессе разработки!", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification); break; } }
private void button3_Click(object sender, EventArgs e) { Forms.AddDisk addDisk = new Forms.AddDisk(); addDisk.Show(); }