private void bindingNavigatorMoveLastItem_Click(object sender, EventArgs e) { if (move()) { SpecialValueBindingSource.MoveLast(); } }
private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e) { GridViewSpecVal.ClearColumnsFilter(); if (SpecialValueBindingSource.Current == null) { //fake query in order to create a link between the database table and the binding source SpecialValueBindingSource.DataSource = from opt in context.SpecialValue where opt.Code == "KJM9" select opt; SpecialValueBindingSource.AddNew(); if (GridViewSpecVal.FocusedRowHandle == GridControl.AutoFilterRowHandle) { GridViewSpecVal.FocusedRowHandle = GridViewSpecVal.RowCount - 1; } ComboBoxEditType.Focus(); setReadOnly(false); newRec = true; return; } ComboBoxEditType.Focus(); //bindingNavigatorPositionItem.Focus(); //trigger field leave event GridViewSpecVal.CloseEditor(); temp = newRec; if (checkForms()) { if (!temp) { context.Refresh(System.Data.Entity.Core.Objects.RefreshMode.StoreWins, (SpecialValue)SpecialValueBindingSource.Current); } SpecialValueBindingSource.AddNew(); if (GridViewSpecVal.FocusedRowHandle == GridControl.AutoFilterRowHandle) { GridViewSpecVal.FocusedRowHandle = GridViewSpecVal.RowCount - 1; } ComboBoxEditType.Focus(); setReadOnly(false); newRec = true; } }
private void bindingNavigatorDeleteItem_Click(object sender, EventArgs e) { if (SpecialValueBindingSource.Current == null) { return; } GridViewSpecVal.CloseEditor(); if (MessageBox.Show("Are you sure you want to delete?", "CONFIRM", MessageBoxButtons.YesNo) == DialogResult.Yes) { modified = false; newRec = false; SpecialValueBindingSource.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 = codeTextEdit.Text; }