private void bindingNavigatorMoveLastItem_Click(object sender, EventArgs e) { if (move()) { BusTableBindingSource.MoveLast(); } }
private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e) { GridViewBusTable.ClearColumnsFilter(); if (BusTableBindingSource.Current == null) { //fake query in order to create a link between the database table and the binding source BusTableBindingSource.DataSource = from opt in context.BUSTABLE where opt.CODE == "KJM9" select opt; BusTableBindingSource.AddNew(); if (GridViewBusTable.FocusedRowHandle == GridControl.AutoFilterRowHandle) { GridViewBusTable.FocusedRowHandle = GridViewBusTable.RowCount - 1; } setValues(); newRec = true; return; } ImageComboBoxEditCode.Focus(); // bindingNavigatorPositionItem.Focus(); //trigger field leave event GridViewBusTable.CloseEditor(); temp = newRec; if (checkForms()) { if (!temp) { context.Refresh(System.Data.Entity.Core.Objects.RefreshMode.StoreWins, ( BUSTABLE)BusTableBindingSource.Current); } BusTableBindingSource.AddNew(); if (GridViewBusTable.FocusedRowHandle == GridControl.AutoFilterRowHandle) { GridViewBusTable.FocusedRowHandle = GridViewBusTable.RowCount - 1; } setValues(); newRec = true; } }
private void bindingNavigatorDeleteItem_Click(object sender, EventArgs e) { if (BusTableBindingSource.Current == null) { return; } GridViewBusTable.CloseEditor(); if (MessageBox.Show("Are you sure you want to delete?", "CONFIRM", MessageBoxButtons.YesNo) == DialogResult.Yes) { modified = false; newRec = false; BusTableBindingSource.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); } currentVal = ImageComboBoxEditCode.EditValue.ToString(); modified = false; newRec = false; }
private void aIRSEGBindingNavigatorSaveItem_Click(object sender, EventArgs e) { if (MessageBox.Show("Are you sure you want to save these changes?", "CONFIRM", MessageBoxButtons.YesNo) == DialogResult.Yes) { gridView2.MoveFirst(); gridView2.MoveLast(); BusTableBindingSource.EndEdit(); context.SaveChanges(); panelControlStatus.Visible = true; LabelStatus.Text = "Record Saved"; rowStatusSave = new Timer(); rowStatusSave.Interval = 3000; rowStatusSave.Start(); rowStatusSave.Tick += TimedEventSave; } }