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