private void bindingNavigatorDeleteItem_Click(object sender, EventArgs e) { if (AirSegBindingSource.Current == null) { return; } GridViewAirSeg.CloseEditor(); if (MessageBox.Show("Are you sure you want to delete?", "CONFIRM", MessageBoxButtons.YesNo) == DialogResult.Yes) { modified = false; newRec = false; AirSegBindingSource.RemoveCurrent(); errorProvider1.Clear(); context.SaveChanges(); panelControlStatus.Visible = true; LabelStatus.Text = "Record Deleted"; rowStatusDelete = new Timer(); rowStatusDelete.Interval = 3000; rowStatusDelete.Start(); rowStatusDelete.Tick += new EventHandler(TimedEventDelete); } lockGrid(true); ImageComboBoxEditAir.Focus(); currentVal = ImageComboBoxEditAir.Text; modified = false; newRec = false; }
private void aIRSEGBindingNavigatorSaveItem_Click(object sender, EventArgs e) { if (AirSegBindingSource.Current == null) { return; } GridViewAirSeg.CloseEditor(); ImageComboBoxEditAir.Focus(); //bindingNavigatorPositionItem.Focus();//trigger field leave event bool temp = newRec; if (checkForms()) { lockGrid(true); panelControlStatus.Visible = true; LabelStatus.Text = "Record Saved"; rowStatusSave = new Timer(); rowStatusSave.Interval = 3000; rowStatusSave.Start(); rowStatusSave.Tick += TimedEventSave; } if (!temp && !modified) { context.Refresh(System.Data.Entity.Core.Objects.RefreshMode.StoreWins, (AIRSEG)AirSegBindingSource.Current); } }
private bool move() { GridViewAirSeg.CloseEditor(); ImageComboBoxEditAir.Focus(); // bindingNavigatorPositionItem.Focus();//trigger field leave event temp = newRec; if (checkForms()) { if (!temp) { context.Refresh(System.Data.Entity.Core.Objects.RefreshMode.StoreWins, (AIRSEG)AirSegBindingSource.Current); } lockGrid(true); newRec = false; modified = false; return(true); } return(false); }
private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e) { GridViewAirSeg.ClearColumnsFilter(); if (AirSegBindingSource.Current == null) { //fake query in order to create a link between the database table and the binding source AirSegBindingSource.DataSource = from opt in context.AIRSEG where opt.CODE == "KJM9" select opt; AirSegBindingSource.AddNew(); if (GridViewAirSeg.FocusedRowHandle == GridControl.AutoFilterRowHandle) { GridViewAirSeg.FocusedRowHandle = GridViewAirSeg.RowCount - 1; } setValues(); ImageComboBoxEditAir.Focus(); lockGrid(false); newRec = true; return; } ImageComboBoxEditAir.Focus(); // bindingNavigatorPositionItem.Focus(); //trigger field leave event GridViewAirSeg.CloseEditor(); temp = newRec; if (checkForms()) { if (!temp) { context.Refresh(System.Data.Entity.Core.Objects.RefreshMode.StoreWins, (AIRSEG)AirSegBindingSource.Current); } AirSegBindingSource.AddNew(); if (GridViewAirSeg.FocusedRowHandle == GridControl.AutoFilterRowHandle) { GridViewAirSeg.FocusedRowHandle = GridViewAirSeg.RowCount - 1; } ImageComboBoxEditAir.Focus(); lockGrid(false); newRec = true; } }