public void displaydatagrid() { try { promotion_CRUDService = new Promotion_CRUDService(); dt = promotion_CRUDService.get_AllPromotion(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()); } }
private void btn_Update_Click(object sender, EventArgs e) { Promotion_Model = new Promotion_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) { promotion_CRUDService = new Promotion_CRUDService(); if (promotion_CRUDService.Update(Promotion_Model)) { MessageBox.Show("Data UPDATED !!"); displaydatagrid(); } else { MessageBox.Show("Data FAILED UPDATED !!"); displaydatagrid(); } } } }