private void btn_Update_Click(object sender, EventArgs e) { cinema_Model = new Cinema_Model(); if (PerformValidation(groupBox1)) { ATB(); bool DialogDel = MessageBox.Show("Are you sure to EDIT this Data", "EDIT", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes; if (DialogDel) { CinemaCRUD = new Cinema_CRUD_Service(); if (CinemaCRUD.Update(cinema_Model)) { MessageBox.Show("Data UPDATED !!"); this.Close(); } else { MessageBox.Show("Data FAILED UPDATED !!"); this.Close(); } } else { } ((FrmEditCinema)f).displaydatagrid(); } }
private void btn_Save_Click(object sender, EventArgs e) { try { if (PerformValidation(groupBox1)) { ATB(); CinemaCRUD = new Cinema_CRUD_Service(); if (CinemaCRUD.Insert(cinema_Model)) { MessageBox.Show("Data Saved"); displaydatagrid(); } else { MessageBox.Show("ERROR,Data Failed To Saved"); displaydatagrid(); } } } catch (Exception ex) { MessageBox.Show("ERROR!!! : " + ex.Message.ToString()); } }
private void dt_user_CellContentClick(object sender, DataGridViewCellEventArgs e) { Cinema_Id = dg_main.SelectedRows[0].Cells["Cinema_Id"].Value.ToString(); if (dg_main.Columns[e.ColumnIndex] == btnDelete) { bool DialogDel = MessageBox.Show("Are you sure to delete this Data", "DELETE", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes; if (DialogDel) { CinemaCRUD = new Cinema_CRUD_Service(); if (CinemaCRUD.GetDeleteByID(Cinema_Id)) { MessageBox.Show("Data DELETED !!"); } else { MessageBox.Show("Data FAILED TO DELETE !!"); } displaydatagrid(); } } else if (dg_main.Columns[e.ColumnIndex] == btnEdit) { ATB(); FrmUpdateCinema frmUpdateCinema = new FrmUpdateCinema(); frmUpdateCinema.ShowDialog(); } }
public void displaydatagrid() { try { CinemaCRUD = new Cinema_CRUD_Service(); dt = CinemaCRUD.get_AllCinemas(dt); dg_main.DataSource = null; dg_main.DataSource = dt; dg_main.AllowUserToAddRows = false; dg_main.ReadOnly = true; } catch (Exception ex) { MessageBox.Show("ERROR!!! : " + ex.Message.ToString()); } }