private void btnSave_Click(object sender, EventArgs e) { try { if (db.SaveChanges() > 0) { MainScreen parent = (MainScreen)this.Parent.Parent.Parent.Parent; parent.ShowMessageInStatusBar("تم حفظ اليانات", 9000); // MessageBox.Show("Saved"); } } catch (Exception ex) { ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null); } }
private void btnSave_Click(object sender, EventArgs e) { try { MainScreen parent = (MainScreen)this.Parent.Parent.Parent.Parent; if (db.SaveChanges() > 0) { parent.ShowMessageInStatusBar("تم حفظ اليانات", 9000); } else { parent.ShowMessageInStatusBar("لا يوجد تغيير في البيانات يحتاج لحفظ", 9000); } } catch (Exception ex) { ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null); } }
private void gridView1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Delete)// && e.Modifiers == Keys.Control) { if (MessageBox.Show("Delete row?", "Confirmation", MessageBoxButtons.YesNo) != DialogResult.Yes) { return; } DataAccess.Item currentRow = (DataAccess.Item)gridView1.GetFocusedRow(); //GridView view = sender as GridView; db.Items.Remove(currentRow); if (db.SaveChanges() > 0) { MainScreen parent = (MainScreen)this.Parent.Parent.Parent.Parent; parent.ShowMessageInStatusBar("Item Deleted", 9000); } } }