private void btn_Update_Click(object sender, EventArgs e) { theather_Model = new Theather_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) { theatherCRUD = new Theather_CRUDService(); if (theatherCRUD.Update(theather_Model)) { MessageBox.Show("Data UPDATED !!"); this.Close(); } else { MessageBox.Show("Data FAILED UPDATED !!"); this.Close(); } } else { MessageBox.Show("Wrong Password !!"); } ((FrmEditTheather)f).displaydatagrid(); } }
private void dt_user_CellContentClick(object sender, DataGridViewCellEventArgs e) { theather_Id = dg_main.SelectedRows[0].Cells["theather_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) { theatherCRUD = new Theather_CRUDService(); if (theatherCRUD.GetDeleteByID(theather_Id)) { MessageBox.Show("Data DELETED !!"); } else { MessageBox.Show("Data FAILED TO DELETE !!"); } displaydatagrid(); } } else if (dg_main.Columns[e.ColumnIndex] == btnEdit) { ATB(); FrmUpdateTheather frmUpdateTheather = new FrmUpdateTheather(); frmUpdateTheather.ShowDialog(); } }
private void btn_Save_Click(object sender, EventArgs e) { try { if (PerformValidation(groupBox1)) { ATB(); theatherCRUD = new Theather_CRUDService(); if (theatherCRUD.Insert(theather_Model)) { MessageBox.Show("Data Saved"); displaydatagrid(); } else { MessageBox.Show("ERROR,Data Failed To Saved"); displaydatagrid(); } } } catch (Exception ex) { MessageBox.Show("ERROR!!! : " + ex.Message.ToString()); } }
public void displaydatagrid() { try { theatherCRUD = new Theather_CRUDService(); dt = theatherCRUD.get_AllTheather(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()); } }