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) { GridViewAirOff.ClearColumnsFilter(); if (AirOffBindingSource.Current == null) { //fake query in order to create a link between the database table and the binding source AirOffBindingSource.DataSource = from opt in context.AIROFF where opt.CODE == "KJM9" select opt; AirOffBindingSource.AddNew(); if (GridViewAirOff.FocusedRowHandle == GridControl.AutoFilterRowHandle) { GridViewAirOff.FocusedRowHandle = GridViewAirOff.RowCount - 1; } setValues(); ImageComboBoxEditAir.Focus(); setReadOnly(false); newRec = true; return; } ImageComboBoxEditAir.Focus(); // bindingNavigatorPositionItem.Focus(); //trigger field leave event GridViewAirOff.CloseEditor(); temp = newRec; if (checkForms()) { errorProvider1.Clear(); if (!temp) { context.Refresh(System.Data.Entity.Core.Objects.RefreshMode.StoreWins, ( AIROFF)AirOffBindingSource.Current); } AirOffBindingSource.AddNew(); if (GridViewAirOff.FocusedRowHandle == GridControl.AutoFilterRowHandle) { GridViewAirOff.FocusedRowHandle = GridViewAirOff.RowCount - 1; } setValues(); ImageComboBoxEditAir.Focus(); setReadOnly(false); newRec = true; } }